Closed Bug 1268688 Opened 8 years ago Closed 8 years ago

Start browser element API when swapFrameLoaders moves from XUL to HTML frame

Categories

(Core :: DOM: Core & HTML, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla49
Iteration:
49.1 - May 9
Tracking Status
firefox49 --- fixed

People

(Reporter: jryans, Assigned: jryans)

References

Details

(Whiteboard: [multiviewport] [mvp-rdm] btpp-active)

Attachments

(1 file)

In bug 1242644, we added support for swapFrameLoaders with <iframe mozbrowser>, including across frame types (XUL <-> HTML).

One edge case that comes up is:

1. Create XUL frame A
2. Create HTML frame B
3. swapFrameLoaders
4. Try to use APIs from BrowserElement.webidl

Currently the APIs fail because:

* BrowserElementParent.js is listening on the old message manager and needs to switch to the new one
* The frame script BrowserElementChild.js has not been loaded for the frame that moved into HTML
Whiteboard: [multiviewport][triage] → [multiviewport][triage] btpp-active
Iteration: --- → 49.1 - May 9
Flags: qe-verify-
Priority: -- → P1
Whiteboard: [multiviewport][triage] btpp-active → [multiviewport] [mvp-rdm] btpp-active
Comment on attachment 8746782 [details]
MozReview Request: Bug 1268688 - Start browser API for frames swapping to HTML. r=bz

https://reviewboard.mozilla.org/r/49567/#review46559

::: dom/base/nsFrameLoader.cpp:1006
(Diff revision 1)
>    otherShell->BackingScaleFactorChanged();
>  
>    ourDoc->FlushPendingNotifications(Flush_Layout);
>    otherDoc->FlushPendingNotifications(Flush_Layout);
>  
> +  // Initialize browser API if needed now that owner content has changed.

This won't "tear down" the browser API in the place where it should no longer exist, right?  Should it?

::: dom/base/nsFrameLoader.cpp:1014
(Diff revision 1)
> +
>    mInSwap = aOther->mInSwap = false;
>  
> -  Unused << mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
> -  Unused << aOther->mRemoteBrowser->SendSwappedWithOtherRemoteLoader();
> +  // Send an updated tab context since owner content type may have changed.
> +  MutableTabContext ourContext;
> +  rv = GetNewTabContext(&ourContext);

This will ignore the signed package stuff, if any.  Is that OK?

r=me
Attachment #8746782 - Flags: review?(bzbarsky) → review+
https://reviewboard.mozilla.org/r/49567/#review46559

> This won't "tear down" the browser API in the place where it should no longer exist, right?  Should it?

That's correct, for a frame that moves from HTML -> XUL, the browser API is still running, even though it can't be accessed since the API is not exposed for such elements.  I think that's okay for now, but if we find that it causes problems, we can add an explicit tear down step in follow up work.

I also noticed that since the child frame script side is always loaded, it may repeat its setup unnecessarily (in the HTML -> HTML swap case, for example).  I'll add a guard to make sure the child frame script aborts early if its work is already done.

> This will ignore the signed package stuff, if any.  Is that OK?

Yes, that seems okay to me.  I am not aware of a current use case for swapFrameLoaders where signed packages are also used.  If someone tries to use it, we'll currently crash the child, since the new tab context would have missing / different signed package info.  We can address this in the future if it comes up.
https://hg.mozilla.org/mozilla-central/rev/88d9ca956c2c
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
This is causing a crash as described here: https://bugzilla.mozilla.org/show_bug.cgi?id=1271792
(In reply to Tanvi Vyas [:tanvi] from comment #7)
> This is causing a crash as described here:
> https://bugzilla.mozilla.org/show_bug.cgi?id=1271792

I'll reply in the new bug.
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: