Closed Bug 808641 Opened 7 years ago Closed 10 months ago

Registering an nsIContentPolicy implementation causes error "this.docShell is null" in the "browser.xml" binding

Categories

(Firefox Graveyard :: SocialAPI, defect)

defect
Not set

Tracking

(firefox17-, firefox18-, firefox19-)

RESOLVED WONTFIX
Tracking Status
firefox17 - ---
firefox18 - ---
firefox19 - ---

People

(Reporter: Paolo, Unassigned)

References

Details

(Keywords: regression)

If an add-on registers its own nsIContentPolicy implementation, even if it
does nothing and always returns ACCEPT, the following is displayed in the
Error Console every time a new window is opened:

Error: this.docShell is null
Source File: chrome://global/content/bindings/browser.xml
Line: 323

I observed this with the Mozilla Archive Format and Adblock Plus add-ons.
This happens in release but does not happen with the latest ESR version.

Excerpt from chrome.manifest:

component	{7380f280-ab36-4a23-b213-35c64f8586a0}	components/mafContentPolicy.js
contract	@amadzone.org/maf/content-policy;1	{7380f280-ab36-4a23-b213-35c64f8586a0}
category	content-policy	MafContentPolicy	@amadzone.org/maf/content-policy;1

Excerpt from mafContentPolicy.js:

function MafContentPolicy() {

}

MafContentPolicy.prototype = {
  // General XPCOM component attributes
  classDescription: "Mozilla Archive Format Content Policy",
  classID:          Components.ID("{7380f280-ab36-4a23-b213-35c64f8586a0}"),
  contractID:       "@amadzone.org/maf/content-policy;1",
  QueryInterface:   XPCOMUtils.generateQI([Ci.nsIContentPolicy]),

  // Use XPCOMUtils to register with the category manager
  _xpcom_categories: [{category: "content-policy"}],

  // --- nsIContentPolicy interface functions ---

  shouldLoad: function(aContentType, aContentLocation, aRequestOrigin,
                       aContext, aMimeTypeGuess, aExtra) {
    return Ci.nsIContentPolicy.ACCEPT;
  },

  shouldProcess: function(aContentType, aContentLocation, aRequestOrigin,
                          aContext, aMimeType, aExtra) {
    return Ci.nsIContentPolicy.ACCEPT;
  }
};
Regression window
Good:
http://hg.mozilla.org/mozilla-central/rev/00405b1daf05
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/16.0 Firefox/16.0 ID:20120716070121
Bad:
http://hg.mozilla.org/mozilla-central/rev/6fdf9985acfe
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/16.0 Firefox/16.0 ID:20120716084624
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=00405b1daf05&tochange=6fdf9985acfe


In local build:
Last Good: 075af07e9952
First Bad: 934ef44ce5af

Triggered by: 934ef44ce5af	Shane Caraveo — Bug 771826: implement Social toolbar button UI, including notification icons, notification panel, and "profile" panel. Styling only for Windows/Mac for the moment, r=gavin
Component: Image Blocking → XBL
Tracking minus for 17 since we're about to build & ship our final beta and this regression just displays an error in the console.
Component: XBL → SocialAPI
Product: Core → Firefox
I'm skeptical that social-specific code is really at fault here - more likely that somehow just changed timing such that this became a problem. Unless the sidebar is involved, I guess? But we should look into it.
Paolo/Alic - is there any user impact in this bug other than the Error Console message?
I doubt that there's any noticeable breakage coming from this. Given that AdBlock Plus triggers it, I think we'd know by now.
Blocks: abp
(In reply to Alex Keybl [:akeybl] from comment #4)
> Paolo/Alic - is there any user impact in this bug other than the Error
> Console message?

Not that I know of. This is just more work for AMO Editors, who need to figure
out that this error message is due to a Firefox bug, and that add-ons suffering
from it can pass editorial review regardless.
Duplicate of this bug: 871176
This bug is causing my tests to always fail for a Jetpack extension that uses ContentPolicy. Any ideas on how to work around it for now?

Excerpt from result of cfx test:

Error: TypeError: getDocShell(...) is null 
 Traceback (most recent call last):
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://jid1-mnnxcxisbpnsxq-at-jetpack/myextension/tests/test-content-policy.js", line 1, in 
    let { Policy } = require("./contentPolicy.js");
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://jid1-mnnxcxisbpnsxq-at-jetpack/myextension/lib/contentPolicy.js", line 15, in 
    const { settingsMap } = require("./ui");
  File "resource://gre/modules/commonjs/sdk/loader/cuddlefish.js", line 129, in CuddlefishLoader/options<.load
    result = load(loader, module);
  File "resource://jid1-mnnxcxisbpnsxq-at-jetpack/myextension/lib/ui.js", line 48, in 
    panel: pbPanel
  File "resource://gre/modules/commonjs/sdk/widget.js", line 354, in Widget
    w._initWidget(options);
  File "resource://gre/modules/commonjs/sdk/widget.js", line 259, in _initWidget
    browserManager.addItem(this);
  File "resource://gre/modules/commonjs/sdk/widget.js", line 549, in browserManager_addItem
    this.windows.forEach(function (w) w.addItems([item]));
  File "resource://gre/modules/commonjs/sdk/widget.js", line 549, in 
    this.windows.forEach(function (w) w.addItems([item]));
  File "resource://gre/modules/commonjs/sdk/widget.js", line 576, in BW_addItems
    items.forEach(this._addItemToWindow, this);
  File "resource://gre/modules/commonjs/sdk/widget.js", line 596, in BW__addItemToWindow
    item.fill();
  File "resource://gre/modules/commonjs/sdk/widget.js", line 791, in WC_fill
    this.setContent();
  File "resource://gre/modules/commonjs/sdk/widget.js", line 852, in WC_setContent
    onMessage: function(message) {
  File "resource://gre/modules/commonjs/sdk/deprecated/traits.js", line 114, in Trait
    return self.constructor.apply(self, arguments) || self._public;
  File "resource://gre/modules/commonjs/sdk/content/symbiont.js", line 62, in Symbiont
    this._initFrame(options.frame);
  File "resource://gre/modules/commonjs/sdk/content/symbiont.js", line 110, in _initFrame
    getDocShell(frame).allowJavascript = this.allow.script;
0 of 1 tests passed.
SocialAPI was removed from Firefox 57 and is no longer available in any current release.
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → WONTFIX
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.