Page 1 of 1

Custom about: URLs

Posted: 2018-08-18, 05:44
by RealityRipple
One of the extension forks I maintain, Palesomething, has a leftover easter egg from Firesomething - about:firesomething, an "extended edition" excerpt from the Book of Mozilla. It doesn't seem to be working on PM 28, though. The code that handles it is here. And the error message I'm getting is:

Code: Select all

A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'?
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Date: Fri Aug 17 2018 22:33:11 GMT-0700 (Pacific Standard Time)
Full Message: Component returned failure code: 0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED) [nsIWebNavigation.loadURIWithOptions]
Full Stack: JS frame :: chrome://global/content/bindings/browser.xml :: loadURIWithFlags/< :: line 157
JS frame :: chrome://global/content/bindings/browser.xml :: _wrapURIChangeCall :: line 50
JS frame :: chrome://global/content/bindings/browser.xml :: loadURIWithFlags :: line 156
JS frame :: chrome://browser/content/tabbrowser.xml :: loadURIWithFlags :: line 2815
JS frame :: chrome://browser/content/urlbarBindings.xml :: loadCurrent :: line 315
JS frame :: chrome://browser/content/urlbarBindings.xml :: continueOperation :: line 350
JS frame :: chrome://browser/content/urlbarBindings.xml :: handleCommand/< :: line 286
JS frame :: chrome://browser/content/urlbarBindings.xml :: _canonizeURL/< :: line 415
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: process :: line 932
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: walkerLoop :: line 813
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: scheduleWalkerLoop/< :: line 747
I've noticed a lot of nested function methods don't work on ES6, so maybe that's what's doing it. Once I find a good backward compatible methodology for faking modules, I'll probably switch all the extensions I've made or ported to use it, but that tends to get a "undefined" or "not a function" error, whereas this seems to be related to the component registrar? I'm not really sure...

Re: Custom about: URLs

Posted: 2018-08-18, 05:46
by Moonchild
RealityRipple wrote:I've made or ported to use it, but that tends to get a "undefined" or "not a function" error, whereas this seems to be related to the component registrar? I'm not really sure...
Full Message: Component returned failure code: 0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED) [nsIWebNavigation.loadURIWithOptions]

Re: Custom about: URLs

Posted: 2018-08-18, 11:04
by Isengrim
The newChannel method in the nsIAboutModule interface has changed. I had to make this change in one of my add-ons:

Code: Select all

- newChannel: function(aURI) {
-     let channel = Services.io.newChannel(ABOUTPAGE_URI, null, null);
+ newChannel: function(aURI, aLoadInfo) {
+     let uri = Services.io.newURI(ABOUTPAGE_URI, null, null);
+     let channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
+     channel.originalURI = aURI;
+     return channel;

Re: Custom about: URLs

Posted: 2018-08-18, 17:45
by RealityRipple
Moonchild wrote:
RealityRipple wrote:I've made or ported to use it, but that tends to get a "undefined" or "not a function" error, whereas this seems to be related to the component registrar? I'm not really sure...
Full Message: Component returned failure code: 0x80570030 (NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED) [nsIWebNavigation.loadURIWithOptions]
I meant a function I had defined. loadURIWithOptions is part of the framework. Or was.

Re: Custom about: URLs

Posted: 2018-08-18, 18:25
by RealityRipple
Isengrim wrote:The newChannel method in the nsIAboutModule interface has changed. I had to make this change in one of my add-ons:

Code: Select all

- newChannel: function(aURI) {
-     let channel = Services.io.newChannel(ABOUTPAGE_URI, null, null);
+ newChannel: function(aURI, aLoadInfo) {
+     let uri = Services.io.newURI(ABOUTPAGE_URI, null, null);
+     let channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
+     channel.originalURI = aURI;
+     return channel;
Still getting the same error with just that. You helped me find this, though, so I'm sure I'll find my mistake. Thank you!

Edit: Yep, I was missing the getURIFlags function as well!

Re: Custom about: URLs

Posted: 2018-08-18, 18:57
by Isengrim
Glad to hear, and happy to help. :)