Closed
Bug 400204
Opened 17 years ago
Closed 17 years ago
[FIX] window.innerWidth throws exception when called on a non-displayed frame
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla1.9beta2
People
(Reporter: ted, Assigned: jst)
References
()
Details
(Keywords: regression)
Attachments
(3 files)
665 bytes,
text/html
|
Details | |
3.03 KB,
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
3.42 KB,
patch
|
sicking
:
review+
sicking
:
superreview+
|
Details | Diff | Splinter Review |
The testsuite in the URL apparently tries to access innerWidth on an iframe that isn't displayed. This works in FF2, but now throws an exception in trunk builds.
STR:
1) Load the URL
2) Click the second run button in the list on the left (first one times out from a remote host...)
3) Test does not load, exception in Error Console:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.innerWidth]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://mavra.perilith.com/~luser/openlayers/tests/run-tests.html :: anonymous :: line 902" data: no]
Should be easy enough to write an automated test for.
Assignee | ||
Comment 1•17 years ago
|
||
This is a trivial fix, we shouldn't ship with this regression IMO.
Status: NEW → ASSIGNED
Flags: blocking1.9?
Reporter | ||
Comment 2•17 years ago
|
||
Will show "FAIL" if it gets an exception, otherwise will print the innerWidth/Height twice and then PASS. Tries to access innerWidth/Height, then set both of them, then access them again.
I'll convert this to a mochitest as well.
Reporter | ||
Comment 3•17 years ago
|
||
mochitest, in patch form. This fails 4/6 on trunk (interestingly enough setting the values passes), and passes 6/6 on latest-1.8.
Attachment #285284 -
Flags: review?(jst)
Assignee | ||
Comment 4•17 years ago
|
||
Interesting. I bet setting the value succeeds because it's set on a frame, and setting the innerWidht/Height on a frame is a no-op. Given that, I think would be safe to leave the setters alone for the [i]frame case, but I'll still fix them as well to match how we used to deal with this in Firefox 2 when dealing with a closed window or what not.
Reporter | ||
Comment 5•17 years ago
|
||
I could add more tests if you'd like to test closed windows or something, just give me a pointer as to what we'd be testing.
Assignee | ||
Comment 6•17 years ago
|
||
This fixes both the getters and setters. I don't actually know if the setter change is testable, as closing a window will null out its mDocShell, so we'd never get to the piece of code that's changing here. I'd still prefere to make that change though for consistency with the getters if nothing else.
Attachment #285289 -
Flags: superreview?(jonas)
Attachment #285289 -
Flags: review?(jonas)
Assignee | ||
Updated•17 years ago
|
Attachment #285284 -
Flags: review?(jst) → review+
Attachment #285289 -
Flags: superreview?(jonas)
Attachment #285289 -
Flags: superreview+
Attachment #285289 -
Flags: review?(jonas)
Attachment #285289 -
Flags: review+
Reporter | ||
Comment 7•17 years ago
|
||
Comment on attachment 285289 [details] [diff] [review]
Fix. Don't throw exceptions, just return 0.
Maybe I'm missing something, but does this patch actually init the out params to 0 if presContext is NULL?
Assignee | ||
Comment 8•17 years ago
|
||
The code that's changed here already does that, but it's earlier in the code than what you can see in the context in the diff.
Reporter | ||
Comment 9•17 years ago
|
||
Ah, bugzilla just doesn't play nice with your git diffs.
Assignee | ||
Updated•17 years ago
|
Target Milestone: --- → mozilla1.9 M10
Assignee | ||
Updated•17 years ago
|
Flags: blocking1.9? → blocking1.9+
Assignee | ||
Updated•17 years ago
|
Summary: window.innerWidth throws exception when called on a non-displayed frame → [FIX] window.innerWidth throws exception when called on a non-displayed frame
Priority: -- → P3
Assignee | ||
Comment 10•17 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 11•17 years ago
|
||
Neglected to check in that mochitest, just did it now.
Flags: in-testsuite+
Assignee | ||
Comment 12•17 years ago
|
||
Duh, thanks Ted!
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
•