Closed
Bug 761519
Opened 13 years ago
Closed 10 years ago
SDK Add-ons have blank Panel if the content have illegal java-script
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: thomas, Unassigned)
References
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/15.0 Firefox/15.0a1
Build ID: 20120602051513
Steps to reproduce:
1. Open Firefox with blank profile
2. install the xpi
or put lib/main.js with
///////////////////////////?
var data = require("self").data;
var windows = require("windows").browserWindows;
var delegate = {
onTrack: function (window) {
var doc = window.document;
if (doc.documentElement.getAttribute("windowtype") !== "navigator:browser") {
doc = null;
return;
}
// Modify the window!
if (doc.getElementById("nav-bar") !== null && doc.getElementById("plurk_button") === null) {
var navBar = doc.getElementById("nav-bar");
if (!navBar) {
return;
}
var btn = doc.createElement("toolbarbutton");
btn.id = 'plurk_button';
btn.setAttribute('type', 'button');
btn.setAttribute('class', 'toolbarbutton-1');
btn.setAttribute('image', data.url('icon16.png'));
btn.setAttribute('orient', 'horizontal');
btn.setAttribute('label', 'Plurk Button');
btn.addEventListener('click', function () {
try {
panel.show(this);
} catch (err) {}
}, false)
navBar.appendChild(btn);
}
doc = null;
},
onUntrack: function (window) {
// Clean up
var doc = window.document;
if (doc.documentElement.getAttribute("windowtype") !== "navigator:browser") {
doc = null;
return;
}
// Modify the window!
if (doc.getElementById("plurk_button") !== null) {
var btn = doc.getElementById("plurk_button");
btn.parentNode.removeChild(btn);
}
doc = null;
}
};
var winUtils = require("window-utils");
var tracker = new winUtils.WindowTracker(delegate);
var panel = require("panel").Panel({
contentURL: "http://m.plurk.com/",
width: 360,
height: 520
});
///////////////////////////
you also need icon16.png
3. Click toolbox icon
Actual results:
your will see blank panel
Expected results:
your will see a panel with content of http://m.plurk.com/
But open http://m.plurk.com/ in new tab work just fine.
And open http://m.facebook.com/ will have no problem
Component: Untriaged → General
Product: Firefox → Add-on SDK
Version: Trunk → unspecified
I just installed the attached addon, and clicked the button it added to the toolbar. The panel loaded and showed everything just fine.
I do see an error logged in the error console while installing the addon, but I don't think it affects anything yet, as it's just a deprecation warning:
Timestamp: 6/5/2012 2:37:48 AM
Error: Exposing chrome JS objects to content without __exposedProps__ is insecure and deprecated. See https://developer.mozilla.org/en/XPConnect_wrappers for more information.
Source File: resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/cuddlefish.js -> resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/sandbox.js -> resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/data/worker.js
Line: 130
I'm running a Nightly build of Firefox 15, if that makes a difference. I'll try with a release version tomorrow and see if anything different happens.
Works for me in 12 and (the now released) 13.
I use Nightly 15.0a1 (2012-06-02) it work for my profile but fail when I open a new profile using add-ons SDK ( cfx run -b /usr/bin/firefox-trunk -p "~/tmp/profile2222"
)
Whiteboard: [triage:followup]
Dave, can you find someone to see if this is platform specific?
The comment I get from AMO. They also seen the blank panel
Your add-on, Plurk Button 0.5, has been reviewed by an editor and did not meet the criteria for full review. However, your add-on has been granted preliminary review and is now available for download in our gallery at https://addons.mozilla.org/addon/plurk-button/
Reviewer:
Kris Maglione
Comments:
This version didn't pass full review because of the following issues:
1) Your add-on makes it impossible for a user to permanently remove its toolbar button, which we can't allow. Inserting your toolbar button at first run is fine, and recommended, but doing so at every startup or making it impossible to move or remove is not.
You might want to try the toolbarbutton.js library.
2) Your panel is entirely empty for me.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You need to correct them to get full approval. Thanks.
Your add-on will now appear in search results and categories with some limitations. You may re-request full review by addressing the editor's comments and uploading a new version. To learn more about the review process, please visit https://addons.mozilla.org/developers/docs/policies/reviews#selection
If you have any questions or comments on this review, please reply to this email or join #amo-editors on irc.mozilla.org
--
Mozilla Add-ons
https://addons.mozilla.org
===================================================================
You received this email because you're subscribed to:
* email me when my add-on is reviewed by an editor
You can't unsubscribe from this type of email.
Manage email notifications: https://addons.mozilla.org/users/edit#acct-notify
Comment 7•13 years ago
|
||
I see this on Linux, Windows, and OS-X on 13.0.1. I don't have any reason to think that it has anything to do with JS errors, however.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 8•12 years ago
|
||
I'm able to reproduce it with simplier test case:
let panel = require("panel").Panel({
contentURL: "http://www.plurk.com/m/t",
width: 360,
height: 520
});
require("widget").Widget({
id: "test-btn",
label: "Test",
content: "test",
panel: panel
});
Thomasy, Kris: Do you have any idea what could be special with http://www.plurk.com/m/t ? I saved the the page locally and loaded it through self.data.url() and it works ... It appears to only fail when we use it remotely.
Comment 9•12 years ago
|
||
I'm not entirely sure, but breaking navigator.userAgent via CAPS, which short circuits the first script on the page, seems to fix the problem.
Comment 10•12 years ago
|
||
It looks like there is a race condition. The simple fact of adding `contentScriptWhen: "ready"` to Panel options will make it work.
It explains why it work locally ...
Do you know what could possibly fail in this website due to some slowness ?
Any hint is more than welcome.
Comment 11•12 years ago
|
||
I can't even guess without knowing what's actually happening. Unfortunately, that's hard to find out given that the panel disappears before it's possible to inspect it via DOMi or a REPL.
Reporter | ||
Comment 12•12 years ago
|
||
I found that if I disable and than enable the add-on will work.
Reporter | ||
Comment 13•12 years ago
|
||
To Alex
I use the simpler test case you provide
After I click on the widget, it shows some error but it is not quite related I think
Traceback (most recent call last):
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js", line 290, in _onShow
let textColor = win.getComputedStyle(node).getPropertyValue("color");
[Exception... "Operation is not supported" code: "9" nsresult: "0x80530009 (NotSupportedError)" location: "resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/cuddlefish.js -> resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js Line: 290"]
using Nightly 16.0a1 (2012-06-22)
Reporter | ||
Comment 14•12 years ago
|
||
But the panel is not blank.
Reporter | ||
Comment 15•12 years ago
|
||
More accurate I found that when I get to http://www.plurk.com/m/ will get a blank page and this time it shows some error. While get to http://www.plurk.com/m/t will work just fine.
TypeError: this.__xulPanel is null
error: An exception occurred.
Traceback (most recent call last):
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/content/symbiont.js", line 151, in _onRead
self._onInit();
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js", line 321, in _onIni
this._emit('inited');
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/events.js", line 119, in _emi
return this._emitOnObject.apply(this, args);
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/events.js", line 149, in _emitOnObjec
listener.apply(targetObj, params);
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js", line 282, in _onSho
this._frameLoadersSwapped = true;
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js", line 60, in
.swapFrameLoaders(this._viewFrame);
File "resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js", line 259, in
get _viewFrame() this.__xulPanel.children[0],
TypeError: this.__xulPanel is null
Comment 16•12 years ago
|
||
(In reply to Thomasy from comment #13)
> To Alex
>
> I use the simpler test case you provide
>
> After I click on the widget, it shows some error but it is not quite related
> I think
>
> Traceback (most recent call last):
> File "resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js",
> line 290, in _onShow
> let textColor = win.getComputedStyle(node).getPropertyValue("color");
> [Exception... "Operation is not supported" code: "9" nsresult: "0x80530009
> (NotSupportedError)" location:
> "resource://jid1-rnptqeapnjmyoa-at-jetpack/api-utils/lib/cuddlefish.js ->
> resource://jid1-rnptqeapnjmyoa-at-jetpack/addon-kit/lib/panel.js Line: 290"]
>
> using Nightly 16.0a1 (2012-06-22)
We are facing a regression on nightly that will be fixed by 1.9 SDK version.
So you should avoid using nightly without 1.9 or git version.
Are you having these exceptions on stable release?
Alex, we're probably going to be spinning a 1.8.1 hotfix for bug 771825. Would we be able to pick up this change there as well?
Assignee: nobody → poirot.alex
Whiteboard: [triage:followup]
Comment 18•12 years ago
|
||
Something really weird happen with mobile version of plurk.com.
The iframe's document stay in `interactive` state. DOMContentLoaded event is dispatched, but the document never fully loads so that `load` event isn't fired and readyState never switch to `complete`.
Here is a scratchpad test case:
let iframe = document.createElement("iframe");
function onload() {
// This callback is never called
Components.utils.reportError("onload");
}
iframe.addEventListener("load", onload, true);
iframe.setAttribute("onload", "Components.utils.reportError('onload');");
iframe.setAttribute("type", "content");
iframe.setAttribute("src", "http://www.plurk.com/m/t");
document.documentElement.appendChild(iframe);
setTimeout(function () {
// The document state is still "interactive"
Components.utils.reportError("state: "+iframe.contentDocument.readyState);
iframe.parentNode.removeChild(iframe);
}, 10000);
Thomasy, would you happen to know if there is anything special with http://www.plurk.com/m/t ??
Priority: -- → P2
Comment 19•12 years ago
|
||
Ok so the behavior exposed in comment 18 is expected.
The google ad script loaded in this website uses document.open() without ever calling document.close(), which end up blocking `load` event to be fired!
We may have to listen to another events in order to prevent such infinite waiting.
In bug 776529, Henri exposed various way where DOMContentLoaded and load event aren't triggered. I'm thinking about listening to nsIWebProgressListener event, which are used for urlbar throbber loading indecator which doesn't suffer from infinite loading on this website.
Comment 20•11 years ago
|
||
That makes me sad to not fix that bug, but consider that as a quite important one.
Given that I never had time to get back to any sdk-related bug, I'm unassigning to let a chance to someone to take it.
This bug means that some content script will never be applied when a document uses document.open()
and that highlights some issues about just listening to document load event.
Assignee: poirot.alex → nobody
Comment 21•10 years ago
|
||
The error here was occurring in the content/symbiont.js module which has been removed now.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•