Closed
Bug 787517
Opened 12 years ago
Closed 12 years ago
mozbrowser throws an exception when its iframe is removed from the DOM
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
People
(Reporter: mounir, Assigned: kk1fff)
References
Details
(Keywords: feature, Whiteboard: [mentor=jlebar][lang=js][WebAPI:P3])
Attachments
(2 files, 5 obsolete files)
2.29 KB,
patch
|
kk1fff
:
review+
|
Details | Diff | Splinter Review |
4.62 KB,
patch
|
kk1fff
:
review+
|
Details | Diff | Splinter Review |
You have two test cases already in the tree with the removal part commented out.
See:
dom/indexedDB/test/file_app_isolation.js
(actual tests are test_app_isolation_inproc.html and test_app_isolation_oop.html)
and
extensions/cookie/test/test_permissionmanager_app_isolation.html
Comment 1•12 years ago
|
||
We discussed this in triage and decided this is a blocker.
blocking-basecamp: ? → +
Comment 3•12 years ago
|
||
I'm not actively working on this, so unassigning myself. Maybe Dale will get to it before me.
Assignee: justin.lebar+bug → nobody
Comment 4•12 years ago
|
||
I think this is a relatively simple fix, should be a good first bug.
Whiteboard: [mentor=jlebar][lang=js]
Assignee | ||
Comment 5•12 years ago
|
||
Just to make sure if I reproduce this bug correctly: uncomment the line of removing iframe in file_app_isolation.js, then run test_app_isolation_oop.html. I get a failure result because an exception from BrowserElementParent.js. (It doesn't crash the whole program.)
Is anybody working on this bug? If not, may I take this bug?
Comment 6•12 years ago
|
||
> I get a failure result because an exception from BrowserElementParent.js. (It doesn't crash the
> whole program.)
I think that's correct. I don't think there's a crash.
> Is anybody working on this bug? If not, may I take this bug?
Go for it!
Updated•12 years ago
|
Summary: Crash in mozbrowser when removing the iframe from the DOM → mozbrowser throws an exception when its iframe is removed from the DOM
Updated•12 years ago
|
Whiteboard: [mentor=jlebar][lang=js] → [mentor=jlebar][lang=js][WebAPI:P3]
Comment 7•12 years ago
|
||
(In reply to Patrick Wang [:kk1fff] from comment #5)
> Is anybody working on this bug? If not, may I take this bug?
Thanks, Patrick, I've assigned the bug to you.
Assignee: nobody → pwang
Keywords: feature
Assignee | ||
Comment 8•12 years ago
|
||
Test case for removing mozbrowser in inproc and oop mode. This test case may reproduce this bug.
Attachment #659661 -
Flags: review?(justin.lebar+bug)
Assignee | ||
Comment 9•12 years ago
|
||
Update bug number in comment of previous version.
Attachment #659661 -
Attachment is obsolete: true
Attachment #659661 -
Flags: review?(justin.lebar+bug)
Attachment #659662 -
Flags: review?(justin.lebar+bug)
Assignee | ||
Comment 10•12 years ago
|
||
Catch NS_ERROR_NOT_INITIALIZED exceptions of:
(1) callback functions.
(2) BEP's 'mozvisibilitychange' handler.
For (2), should we just remove the listener after NS_ERROR_NOT_INITIALIZE is caught?
Attachment #659664 -
Flags: feedback?(justin.lebar+bug)
Comment 11•12 years ago
|
||
Comment on attachment 659662 [details] [diff] [review]
Test case to reproduce this bug
>diff --git a/dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js b/dom/browser-element/mochitest/browserElement_RemoveBrowserElement.js
>+/* Any copyright is dedicated to the public domain.
>+ http://creativecommons.org/publicdomain/zero/1.0/ */
>+
>+"use strict";
Please add a comment here with the relevant bug number and briefly explaining
what you're testing.
>+ window.error = function(e) {
Isn't it window.onerror? (or window.addEventListener("error", ...).) Maybe
this test works because mochitest is already listening to onerror and causes
the test to fail if it hears an error.
>+ receivedFail = true;
>+ throw e;
>+ };
>+}
r=me with these nits addressed.
Attachment #659662 -
Flags: review?(justin.lebar+bug) → review+
Comment 12•12 years ago
|
||
Comment on attachment 659664 [details] [diff] [review]
Patch: Catch exceptions in callback functions.
> Catch NS_ERROR_NOT_INITIALIZED exceptions of:
> (1) callback functions.
Why aren't we catching the error elsewhere? If I call _goBack on an iframe
that's not in the DOM, I'm likewise going to get an exception, which seems no
good.
I know we discussed this on IRC, but I forget the conclusion we reached.
The only place where I care if the sendAsyncMsg failed is in sendDOMRequest (I
think!), because (to fix bug 787519), I want to fire onerror there if the
request failed. Everywhere else, it looks like we want to silently ignore the
error. Unless I'm missing something?
If I'm not missing something, how about we make _sendAsyncMsg silently eat
NS_ERROR_NOT_INITIALIZED? Then in bug 787519, we can make _sendAsyncMsg return
a boolean (success/failure) and make _sendDOMRequest do the right thing if
_sendAsyncMsg returns false.
> (2) BEP's 'mozvisibilitychange' handler.
>
> For (2), should we just remove the listener after NS_ERROR_NOT_INITIALIZE is caught?
Probably not, since then we'd have to add it back if the iframe were
re-inserted into the DOM.
Attachment #659664 -
Flags: feedback?(justin.lebar+bug)
Assignee | ||
Comment 13•12 years ago
|
||
Attachment #659662 -
Attachment is obsolete: true
Attachment #660032 -
Flags: review?(justin.lebar+bug)
Assignee | ||
Comment 14•12 years ago
|
||
Prevent NS_ERROR_NOT_INITIALIZED from being thrown outside sendAsyncMsg.
Attachment #659664 -
Attachment is obsolete: true
Attachment #660039 -
Flags: review?(justin.lebar+bug)
Assignee | ||
Comment 15•12 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #12)
> how about we make _sendAsyncMsg silently eat
> NS_ERROR_NOT_INITIALIZED? Then in bug 787519, we can make _sendAsyncMsg
> return
> a boolean (success/failure) and make _sendDOMRequest do the right thing if
> _sendAsyncMsg returns false.
>
Okay. For bug 787519, I've reproduced it today, it is a little bit different from this one. BEP is notified 'oop-frameloader-crashed' before getScreenshot() called, and _sendAsyncMsg() doesn't throw in that bug. I think I can submit patch for that bug in days.
Comment 16•12 years ago
|
||
> and _sendAsyncMsg() doesn't throw in that bug.
Ah, interesting. Okay!
We probably should still fire onerror on the DOMRequest when we get an exception, because I presume we /would/ get an exception if you did getScreenshot() on an iframe that's not in the DOM. I'm happy if you do that in this bug or in a separate bug.
Comment 17•12 years ago
|
||
Comment on attachment 660032 [details] [diff] [review]
Test case to reproduce this bug
> +// Bug 787517: Remove iframe in the handler of showmodalprompt.
Nit: This is a good description of what to do to /cause/ the problem, but I'd also like you to describe what the problem we're testing for actually is. For example:
"Remove the iframe from the DOM during the showmodalprompt handler. This shouldn't cause an exception to be thrown."
Attachment #660032 -
Flags: review?(justin.lebar+bug) → review+
Comment 18•12 years ago
|
||
Comment on attachment 660039 [details] [diff] [review]
Patch: Catch NS_ERROR_NOT_INITIALIZED in _sendAsyncMsg()
+ // Handle NS_ERROR_NOT_INITIALIZED
+ if (e.result == Cr.NS_ERROR_NOT_INITIALIZED) {
+ debug("Handle NS_ERROR_NOT_INITIALIZED");
+ return;
+ }
"Handle" isn't the right word; it's more like we're /ignoring/ NS_ERROR_NOT_INITIALIZED.
Please indicate in the comment why it's OK to ignore this particular error. Perhaps "Ignore NS_ERROR_NOT_INITIALIZED: It is thrown when we call sendAsyncMessage if our frame element is not in the DOM, in which case there's no child to receive the message."
Attachment #660039 -
Flags: review?(justin.lebar+bug) → review+
Assignee | ||
Comment 19•12 years ago
|
||
r+ in comment 18. fix nit.
Attachment #660039 -
Attachment is obsolete: true
Attachment #660337 -
Flags: review+
Assignee | ||
Comment 20•12 years ago
|
||
r+ in comment 17. update comment.
Attachment #660032 -
Attachment is obsolete: true
Attachment #660338 -
Flags: review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 21•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/3d59d22a34c1
https://hg.mozilla.org/integration/mozilla-inbound/rev/9374b6502e7a
Keywords: checkin-needed
Comment 22•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/3d59d22a34c1
https://hg.mozilla.org/mozilla-central/rev/9374b6502e7a
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Updated•12 years ago
|
Component: DOM: Mozilla Extensions → DOM
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
•