Overriding function in FF 42 causes strange exception

Hello,
I need to override the new Firefox function called ‘clearPluginCookies’ (replace it temporarily with a dummy function).
See Firefox\browser\omni.ja\chrome\browser\content\browser\sanitize.js, line 248.

if ( typeof Sanitizer !== 'function' ) {
      Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
      .getService(Components.interfaces.mozIJSSubScriptLoader)
      .loadSubScript("chrome://browser/content/sanitize.js", null);
}
Sanitizer.prototype.items.clearPluginCookies = undefined;
Sanitizer.prototype.items.clearPluginCookies = function()
{;}
//Exception during sanitize: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getBoolPref]"
//nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://browser/content/sanitize.js ::
//Sanitizer.prototype.sanitize/itemsToClear< :: line 66"  data: no]

NOTE: If you look closer at the original function clearPluginCookies, you will see that this function does not necessarily return promises: See especially the scope of

if (!this.range || age >= 0) {.....}

However I also tried to return a list of promises, and even tried to replace the function with the exact original FF function.

Always the same exception.
Anyone any ideas?

I’m not sure what the problem is exactly, personally I think that that method not returning a promise at all is a bug. Also, it doesn’t look like it’s supposed to return a list of promises, only a single promise.

(It’s worth noting that particular piece of code changed considerably in Firefox 44 for bug 1089695.)

The problem might not be (only) in the return values themselves, but rather in some out-of-context var somewhere, like one of the constants or the phInterface at the top, or even the value |this|. None of those might expect the environment of your add-on if you don’t properly bind the method to its intended parent.

Like I said, I don’t know exactly the problem, just throwing things out there to be considered. :smile: