Bug 1141337 - [e10s] "Save Page|Frame As..." in remote browser causes unsafe CPOW usage warnings
So in order to do this, I think I need to better understand jld's patch in bug 1101100.
Ok, I think I see what's going on here.
Here's my solution to this problem:
- Add a new method to nsIWebBrowserPersistable called startPersistenceWithOuterWindowId that finds the document with the matching outer window ID, and persists that (returning NS_ERROR_FAILURE if we can't find it)
- Add the startPersistenceWithOuterWindowId method to nsFrameLoader.cpp, and maybe make startPersistence depend on it, or some common method.
- Done?
Actually…. no, I have a better idea. Or, maybe I do.
Why does nsFrameLoader need to implement nsIWebBrowserPersistable? Why
can't we add a new method "persistSubFrame" to nsFrameLoader, and have
persistSubFrame take an outerWindowID?
I'll needinfo jld on bug 1101100.
Okay, I think I know how to proceed - though I think I should probably
wait for jld's patch to solidify before I build on top of it.
Okay, it's landed! LET'S DO THIS.
10:10 AM
<
mconley
> smaug: hey - I feel like I should know this... but suppose I
have some outerWindowID, and some docShell X... if I resolve that
outerWindowID to an nsIDOMWindow Y, is there a way I can ensure that Y's
docshell is a child of X?
10:10 AM
<
mconley
> without having to iterate all of X's child docshells?
10:11 AM
⇐
jesup|laptop
quit (
chatzilla@moz-l7d6u7.fios.verizon.net
) Quit: ChatZilla 0.9.91.1 [Firefox 41.0a2/20150703004018]
10:12 AM
<
smaug
> mconley: Y.GetParent() == X ?
10:12 AM
<
smaug
> whatever the actual method name is
10:12 AM
<
smaug
> or are you interested in all the descendants of X?
10:12 AM
<
mconley
> smaug: is that going to work if Y is a distant descendant of X?
10:13 AM
<
smaug
> I think you need to iterate Y's parent chain
10:13 AM
<
smaug
> Y's dochell's parent chain that is
10:13 AM
<
mconley
> smaug: alright, sounds good.
10:13 AM
<
mconley
> thanks
10:14 AM
<
smaug
> mconley: nsDocShell has nsDocShell::GetParentDocshell()
10:14 AM
<
smaug
> so you may want to play with that, and not with nsIDocShell
10:14 AM
<
mconley
> ah, ok - cool, thanks
Grawr… how do I get the outerWindowID sent down to the child? What's
the path here? I thought this would be more straight forward...
OK Focus. Build problems. What's the problem? I've added outerWindowID
as something that can be passed down
through SendPWebBrowserPersistDocumentConstructor.
And I think I need to update some headers and function signatures to make this work.
1:11.61 ../dist/include/mozilla/dom/TabParent.h:437:47: error: 'AllocPWebBrowserPersistDocumentParent' marked 'override' but does not override any member functions
1:11.61
virtual PWebBrowserPersistDocumentParent* AllocPWebBrowserPersistDocumentParent() override;
This means that AllocPWebBrowserPersistDocumentParent is probably having its signature changed by my change to the IPDL...
Ah
1:11.63 /Users/mikeconley/Projects/mozilla-central/obj-debug/ipc/ipdl/_ipdlheaders/mozilla/dom/PBrowserParent.h:795:5: note: unimplemented pure virtual method 'AllocPWebBrowserPersistDocumentParent' in 'TabParent'
1:11.63 AllocPWebBrowserPersistDocumentParent(const uint64_t& aOuterWindowID) = 0;
So my adding the outerWindowID to the constructor means it's passed to the allocator in the parent. *Sigh*.
It's so weird that the parent might hear about this outer window ID too.
Okay, so solved that one by updating the headers… now it's complaining
about RecvPWebBrowserPersistDocumentConstructor in TabChild:
0:42.32
virtual bool RecvPWebBrowserPersistDocumentConstructor(PWebBrowserPersistDocumentChild *aActor,
0:42.32 ^
0:42.34 Warning: -Woverloaded-virtual in /Users/mikeconley/Projects/mozilla-central/obj-debug/dist/include/mozilla/dom/TabChild.h: 'mozilla::dom::TabChild::RecvPWebBrowserPersistDocumentConstructor' hides overloaded virtual function
0:42.34 ../../dist/include/mozilla/dom/TabChild.h:498:18: warning: 'mozilla::dom::TabChild::RecvPWebBrowserPersistDocumentConstructor' hides overloaded virtual function [-Woverloaded-virtual]
0:42.34 /Users/mikeconley/Projects/mozilla-central/obj-debug/ipc/ipdl/_ipdlheaders/mozilla/dom/PBrowserChild.h:504:5: note: hidden overloaded virtual function 'mozilla::dom::PBrowserChild::RecvPWebBrowserPersistDocumentConstructor' declared here
0:42.34 RecvPWebBrowserPersistDocumentConstructor(
0:42.34 ^
0:42.75 VoicemailParent.o
0:43.35 In file included from /Users/mikeconley/Projects/mozilla-central/layout/generic/nsPluginFrame.cpp:90:
0:43.35 ../../dist/include/mozilla/dom/TabChild.h:498:18: error: 'RecvPWebBrowserPersistDocumentConstructor' marked 'override' but does not override any member functions
0:43.35
virtual bool RecvPWebBrowserPersistDocumentConstructor(PWebBrowserPersistDocumentChild *aActor,
0:43.35 ^
0:43.36 Warning: -Woverloaded-virtual in /Users/mikeconley/Projects/mozilla-central/obj-debug/dist/include/mozilla/dom/TabChild.h: 'mozilla::dom::TabChild::RecvPWebBrowserPersistDocumentConstructor' hides overloaded virtual function
0:43.36 ../../dist/include/mozilla/dom/TabChild.h:498:18: warning: 'mozilla::dom::TabChild::RecvPWebBrowserPersistDocumentConstructor' hides overloaded virtual function [-Woverloaded-virtual]
0:43.36 /Users/mikeconley/Projects/mozilla-central/obj-debug/ipc/ipdl/_ipdlheaders/mozilla/dom/PBrowserChild.h:504:5: note: hidden overloaded virtual function 'mozilla::dom::PBrowserChild::RecvPWebBrowserPersistDocumentConstructor' declared here
0:43.36 RecvPWebBrowserPersistDocumentConstructor(
RecvPWebBrowserPersistDocumentConstructor...
OK, now:
14:10.55 /Users/mikeconley/Projects/mozilla-central/embedding/components/webbrowserpersist/WebBrowserPersistResourcesChild.cpp:40:24: error: no matching member function for call to 'SendPWebBrowserPersistDocumentConstructor'
14:10.55 if (!grandManager->SendPWebBrowserPersistDocumentConstructor(subActor)) {
14:10.55 ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14:10.56 /Users/mikeconley/Projects/mozilla-central/obj-debug/ipc/ipdl/_ipdlheaders/mozilla/dom/PBrowserChild.h:790:5: note: candidate function not viable: no known conversion from 'mozilla::WebBrowserPersistDocumentChild *' to 'const uint64_t' (aka 'const unsigned long long') for 1st argument
14:10.56 SendPWebBrowserPersistDocumentConstructor(const uint64_t& aOuterWindowID);
14:10.56 ^
14:10.56 /Users/mikeconley/Projects/mozilla-central/obj-debug/ipc/ipdl/_ipdlheaders/mozilla/dom/PBrowserChild.h:793:5: note: candidate function not viable: requires 2 arguments, but 1 was provided
14:10.56 SendPWebBrowserPersistDocumentConstructor(
14:10.56 ^
14:10.89 1 error generated.
14:10.92
14:10.92 In the directory /Users/mikeconley/Projects/mozilla-central/obj-debug/embed
HOLY SHIT I GOT IT TO WORK. It seems to work!
Also, I realized that I should just modify the startPersistence method
instead of adding a new startSubframePersistence method. Seems cleaner
this way.