Open
Bug 772353
Opened 14 years ago
Updated 3 years ago
Accessing hiddenDOMWindow at final-ui-startup leads to IsCallerChrome() returning false for Chrome code
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
NEW
People
(Reporter: MattN, Unassigned)
Details
On Windows and Linux where the hidden DOM Window is XHTML, simply accessing Services.appShell.hiddenDOMWindow during final-ui-startup would break things like PageThumbs.jsm's capture method. It calls canvas.mozFetchAsStream[1] (which can only be called from chrome code) and IsCallerChrome() returns false. If I don't access Services.appShell.hiddenDOMWindow during startup then IsCallerChrome() returns true for the call to mozFetchAsStream.
STR:
1) Include |let hdw = Services.appShell.hiddenDOMWindow;| in a final-ui-startup observer.
2) Enable the browser environment in the scratchpad (devtools.chrome.enabled = true).
3) Open a scratchpad and set the environment to "Browser" from the menu bar.
4) Run the following code in a scratchpad with :
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
let doc = Services.appShell.hiddenDOMWindow.document;
let canvas = doc.createElementNS(HTML_NAMESPACE, "canvas");
canvas.mozFetchAsStream(function() {
Cu.reportError("callback called");
});
Expected result:
"Callback called" appears in the error console
Actual result:
"NS_ERROR_FAILURE: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMHTMLCanvasElement.mozFetchAsStream] at..."
because IsCallerChrome() returns false in mozFetchAsStream.
[1] https://mxr.mozilla.org/mozilla-central/source/browser/components/thumbnails/PageThumbs.jsm?rev=960b6d4ea73b#140
Comment 1•8 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046
Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.
If you have questions, please contact :mdaly.
Priority: -- → P5
| Assignee | ||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•