Closed
Bug 798857
Opened 12 years ago
Closed 12 years ago
After chrome code accesses screen.width, content can't access it
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: jruderman, Unassigned)
References
Details
(Keywords: testcase)
1. Install https://www.squarefree.com/extensions/domFuzzLite3.xpi
2. Load the testcase.
Result:
JavaScript error: file:///Users/jruderman/Desktop/r.html, line 7: Permission denied to access property 'width'
If I change the testcase to access screen.width before the privileged call, then suddenly the access after the privileged call works!
Here's what the Chrome code does:
function safeResizeTo(aWindow)
{
function clamp(a, b, c)
{
return Math.min(c, Math.max(a, b));
}
return function(w, h) {
w = clamp(200, w, aWindow.screen.width);
h = clamp(200, h, aWindow.screen.height);
aWindow.resizeTo(w, h);
};
}
Comment 1•12 years ago
|
||
nsScreen doesn't do the precreate dance. Are we ending up creating an XPCWrappedNative in the chrome compartment and then giving wrappers to the content compartment?
In which case, would bug 793244 solve this problem?
Comment 2•12 years ago
|
||
Based on my reading of the current code, the answers to your questions are yes and yes.
Depends on: 793244
Comment 3•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #1)
> nsScreen doesn't do the precreate dance. Are we ending up creating an
> XPCWrappedNative in the chrome compartment and then giving wrappers to the
> content compartment?
If it doesn't do the PreCreate dance, we should just be creating a new XPCWN in the content scope, right? So how would this happen?
Comment 4•12 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #3)
> If it doesn't do the PreCreate dance, we should just be creating a new XPCWN
> in the content scope, right? So how would this happen?
nsScreen doesn't do the PreCreate dance, but it does implement nsWrapperCache (via nsDOMEventTargetHelper). So we'll create the WN and then find it, cached on the object when content goes to access .screen.
Comment 5•12 years ago
|
||
(In reply to Blake Kaplan (:mrbkap) from comment #4)
> nsScreen doesn't do the PreCreate dance, but it does implement
> nsWrapperCache (via nsDOMEventTargetHelper). So we'll create the WN and then
> find it, cached on the object when content goes to access .screen.
Oh wow, ok. Yeah, having an nsWrapperCache without a proper precreate hook is totally wrong. :-(
Comment 6•12 years ago
|
||
Oh, I missed that we had a wrapper cache, which is why comment 1 had questions, not statements. As in, I couldn't answer the comemnt 3 question. ;)
So this is actually a regression from bug 720794, then.
Do we care about getting this fixed on branches?
Ms2ger, what's the ETA on bug 793244?
Blocks: 720794
status-firefox15:
--- → affected
status-firefox16:
--- → affected
status-firefox17:
--- → affected
status-firefox18:
--- → affected
Comment 7•12 years ago
|
||
End of the week, I hope.
Updated•12 years ago
|
Status: NEW → RESOLVED
Closed: 12 years ago
Component: Security → DOM
Resolution: --- → DUPLICATE
Target Milestone: --- → mozilla19
Reporter | ||
Comment 9•12 years ago
|
||
More like "Fixed by" than "Duplicate of".
Flags: in-testsuite?
Resolution: DUPLICATE → FIXED
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•