Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qbrt fails to start #170

Open
benfrancis opened this issue Dec 20, 2018 · 19 comments
Open

qbrt fails to start #170

benfrancis opened this issue Dec 20, 2018 · 19 comments

Comments

@benfrancis
Copy link

STR:

  • npm install -g qbrt
  • qbrt run https://eggtimer.org/

Error:

JavaScript error: file:///home/tola/.nvm/versions/node/v8.11.3/lib/node_modules/qbrt/dist/linux/runtime/qbrt/components/DisabledAddonManager.js, line 24: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: file:///home/tola/.nvm/versions/node/v8.11.3/lib/node_modules/qbrt/dist/linux/runtime/qbrt/components/DisabledTelemetryStartup.js, line 14: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: file:///home/tola/.nvm/versions/node/v8.11.3/lib/node_modules/qbrt/dist/linux/runtime/qbrt/components/CommandLineHandler.js, line 42: TypeError: XPCOMUtils.generateQI is not a function

Tested on Ubuntu 18.04 LTS.

@patrickalima98
Copy link

Same problem here
STR:

  • npm i -g qbrt
  • qbrt run https://eggtimer.org/

Error:

JavaScript error: file:///C:/Users/patri/AppData/Roaming/npm/node_modules/qbrt/dist/win32/runtime/qbrt/components/DisabledAddonManager.js, line 24: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: file:///C:/Users/patri/AppData/Roaming/npm/node_modules/qbrt/dist/win32/runtime/qbrt/components/DisabledTelemetryStartup.js, line 14: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: file:///C:/Users/patri/AppData/Roaming/npm/node_modules/qbrt/dist/win32/runtime/qbrt/components/CommandLineHandler.js, line 42: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: resource://gre/modules/ActorManagerChild.jsm, line 269: TypeError: singletons is null

Tested on Windows 10 x64 Version 1809

@rafaelmr2
Copy link

Same here in Manjaro.

@MattGyverLee
Copy link

Me too.

@MattGyverLee
Copy link

It's a Mozilla issue: mozilla/tls-canary#171

@lewisthoma5
Copy link

Windows 10 same issue.

@guilmour
Copy link

guilmour commented Apr 16, 2019

Same here in Debian 9.8 (stretch) 😿

  • npm i -g qbrt

  • qbrt run https://eggtimer.org/

JavaScript error: file:///home/guilmour/.nvm/versions/node/v11.10.1/lib/node_modules/qbrt/dist/linux/runtime/qbrt/components/DisabledAddonManager.js, line 24: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: file:///home/guilmour/.nvm/versions/node/v11.10.1/lib/node_modules/qbrt/dist/linux/runtime/qbrt/components/DisabledTelemetryStartup.js, line 14: TypeError: XPCOMUtils.generateQI is not a function
JavaScript error: file:///home/guilmour/.nvm/versions/node/v11.10.1/lib/node_modules/qbrt/dist/linux/runtime/qbrt/components/CommandLineHandler.js, line 42: TypeError: XPCOMUtils.generateQI is not a function

Someone did get success on troubleshooting this issue?

@star-buck
Copy link

same on debian buster... can a fix be deployed for qrbt similar to that in the ticket above?

@guilmour
Copy link

@star-buck I tried that, but now I'm stuck at the error:

JavaScript error: file:///home/guilmour/gits/qbrt6/components/CommandLineHandler.js, line 28: NS_ERROR_FILE_NOT_FOUND: Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIChannel.open2]

:/

@nothingismagick
Copy link

Same on MacOS

@dragondaksh
Copy link

Still the issue persists, please can someone tell what can be done?

@star-buck
Copy link

star-buck commented May 13, 2019 via email

@benfrancis
Copy link
Author

I am totally out of my depth here, but let's see where we can get with this. These errors are being generated by:

  • DisabledAddonManager.js
  • DisabledTelemetryStartup.js
  • CommandLineHandler.js

These are all in qbrt's components directory and to my untrained eye appear to be designed to stub out components that aren't used by qbrt but that Firefox (being used as a runtime) somehow expects to be there.

The errors appear to be caused by calls these components make to an XPCOMUtils.generateQI() method which no longer exists. Thunderbird apparently had the same problem and they solved it by "providing their own little generateQI implementation", which @cr didn't seem to like.

If I comment out the lines in those components which call XPCOMUtils.generateQI() (which removes the QueryInterface property of an object in each case) then XPCOMUtils.jsm complains that QueryInterface doesn't exist. Which I assume is why it's there in the first place!

JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 458: TypeError: this._instance.QueryInterface is not a function
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 458: TypeError: this._instance.QueryInterface is not a function
JavaScript error: resource://gre/modules/XPCOMUtils.jsm, line 433: TypeError: (new component(...)).QueryInterface is not a function

...and that is as far as I have got.

@benfrancis
Copy link
Author

benfrancis commented Jul 12, 2019

I note that mozilla/tls-canary#172 fixed a similar error by replacing instances of XPCOMUtils.generateQI() with ChromeUtils.generateQI().

If I do this for qbrt I no longer get the error messages above, I get a new error:

error starting runtime: [Exception... "Component does not have requested interface" nsresult: "0x80004002 (NS_NOINTERFACE)" location: "JS frame :: resource://qbrt/modules/Runtime.jsm :: getOuterWindowID :: line 176" data: no]

Progress..?

@benfrancis
Copy link
Author

Note: The above is the error I get when trying to run my own application with the qbrt runtime with qbrt run ./

If I try to run the eggtimer example as in the STR at the top of this issue (qbrt run https://eggtimer.org/), a blank window is opened but I see a different error on the command line:

JavaScript error: chrome://global/content/elements/browser-custom-element.js, line 874: TypeError: aParams is null

@cr
Copy link

cr commented Jul 13, 2019

Thunderbird apparently had the same problem and they solved it by "providing their own little generateQI implementation", which @cr didn't seem to like.

There wasn't a need to develop a like or dislike while Firefox still has ChromeUtils.generateQI() to use instead, and it works well for TLS Canary's intents and purposes.

@cr
Copy link

cr commented Jul 13, 2019

Progress..?

I just have the vague understanding of what's going on that .generateQI() is used to call C++ functions from JS, but whatever C++ object you're trying to query here for may not be supporting generating the requested interfaces. Perhaps you can look for an alternate that gets you what you need and also supports ChromeUtils.generateQI()?

@cr
Copy link

cr commented Jul 13, 2019

Any calls on top of .generateQI() fall through to respective C++ methods through IDL, so I'd start looking at the associated IDL specs. For example:

window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;

should first go through https://searchfox.org/mozilla-central/source/xpcom/base/nsIInterfaceRequestor.idl , which defines a .getInterface() method (as throwing NS_NOINTERFACE on error), and also https://searchfox.org/mozilla-central/source/dom/interfaces/base/nsIDOMWindowUtils.idl supports the .outerWindowID attribute. So one may have to check argument types, but the error is obviously elsewhere:

I think the actual call failing is .getInterface(Ci.nsIDOMWindowUtils), unable to instantiate the nsIDOMWindowUtils interface for the particular object passed to .getOuterWindowID(). The code of Runtime.js a bit hard to follow, so it's hard to say what objects are passed in as target at

['window', getOuterWindowID(target), target];
. But whatever they are, they might not all be window like objects?

Another thing that has sometimes mended things was importing the right modules. The only other code I could find querying Ci.nsDOMWindowUtils is https://searchfox.org/mozilla-central/source/dom/canvas/test/webgl-conf/checkout/js/js-test-pre.js#730 . Perhaps the webgl-conf test harness makes some magic imports before that code is run?

Anyway, just a few pointers and loose threads. I wish I could help you more to the point.

@benfrancis
Copy link
Author

Thanks for the pointers @cr!

Whilst I haven't got any further trying to fix that bug, I have realised that this broken code is part of the openDevTools() method in Runtime.jsm. If I don't try to open devtools in my application then qbrt will actually launch the application successfully. So this seems to be a recurrence of #132, where @mykmelez warned breakage with devtools was likely to happen again.

So replacing instances of XPCOMUtils.generateQI() with ChromeUtils.generateQI() does actually fix the bug reported in this issue for custom applications and qbrt can be started successfully.

The remaining error when trying to launch the example egg timer app appears to be related to the loadURI() method of the <browser> element in the default default Shell.js. Specifically, https://github.com/mozilla/qbrt/blob/master/shell/shell.js#L106 is trying to do:

browser.loadURI(url, null, null);

which worked previously, but for some reason now returns TypeError: aParams is null

From the docs and source code I haven't been able to figure out why this no longer works.

I'd also really like to get devtools working again!

@benfrancis
Copy link
Author

Looks like loadURI() now expects an object as its second argument and requires that triggeringPrincipal be set.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1513241#c35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants