mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1165309 - Make view source and print preview work in e10s-multi. r=mconley
This commit is contained in:
parent
a7d2e09c9e
commit
cb264cca60
@ -2275,6 +2275,7 @@ function BrowserViewSourceOfDocument(aArgsOrDocument) {
|
||||
relatedToCurrent: true,
|
||||
inBackground: false,
|
||||
forceNotRemote,
|
||||
relatedBrowser: args.browser
|
||||
});
|
||||
args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
|
||||
top.gViewSourceUtils.viewSourceInBrowser(args);
|
||||
@ -3237,7 +3238,8 @@ var PrintPreviewListener = {
|
||||
this._tabBeforePrintPreview = gBrowser.selectedTab;
|
||||
this._printPreviewTab = gBrowser.loadOneTab("about:blank",
|
||||
{ inBackground: false,
|
||||
forceNotRemote });
|
||||
forceNotRemote,
|
||||
relatedBrowser: browser });
|
||||
gBrowser.selectedTab = this._printPreviewTab;
|
||||
}
|
||||
return gBrowser.getBrowserForTab(this._printPreviewTab);
|
||||
|
@ -1483,6 +1483,7 @@
|
||||
var aForceNotRemote;
|
||||
var aNoReferrer;
|
||||
var aUserContextId;
|
||||
var aRelatedBrowser;
|
||||
if (arguments.length == 2 &&
|
||||
typeof arguments[1] == "object" &&
|
||||
!(arguments[1] instanceof Ci.nsIURI)) {
|
||||
@ -1500,6 +1501,7 @@
|
||||
aForceNotRemote = params.forceNotRemote;
|
||||
aNoReferrer = params.noReferrer;
|
||||
aUserContextId = params.userContextId;
|
||||
aRelatedBrowser = params.relatedBrowser;
|
||||
}
|
||||
|
||||
var bgLoad = (aLoadInBackground != null) ? aLoadInBackground :
|
||||
@ -1518,7 +1520,8 @@
|
||||
allowMixedContent: aAllowMixedContent,
|
||||
forceNotRemote: aForceNotRemote,
|
||||
noReferrer: aNoReferrer,
|
||||
userContextId: aUserContextId });
|
||||
userContextId: aUserContextId,
|
||||
relatedBrowser: aRelatedBrowser });
|
||||
if (!bgLoad)
|
||||
this.selectedTab = tab;
|
||||
|
||||
@ -1814,6 +1817,10 @@
|
||||
|
||||
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
|
||||
|
||||
if (aParams.relatedBrowser) {
|
||||
b.relatedBrowser = aParams.relatedBrowser;
|
||||
}
|
||||
|
||||
// Create the browserStack container
|
||||
var stack = document.createElementNS(NS_XUL, "stack");
|
||||
stack.className = "browserStack";
|
||||
@ -1892,7 +1899,8 @@
|
||||
browser = this._createBrowser({permanentKey: aTab.permanentKey,
|
||||
remote: remote,
|
||||
uriIsAboutBlank: uriIsAboutBlank,
|
||||
userContextId: aParams.userContextId});
|
||||
userContextId: aParams.userContextId,
|
||||
relatedBrowser: aParams.relatedBrowser});
|
||||
}
|
||||
|
||||
let notificationbox = this.getNotificationBox(browser);
|
||||
@ -1966,6 +1974,7 @@
|
||||
var aNoReferrer;
|
||||
var aUserContextId;
|
||||
var aEventDetail;
|
||||
var aRelatedBrowser;
|
||||
if (arguments.length == 2 &&
|
||||
typeof arguments[1] == "object" &&
|
||||
!(arguments[1] instanceof Ci.nsIURI)) {
|
||||
@ -1984,6 +1993,7 @@
|
||||
aNoReferrer = params.noReferrer;
|
||||
aUserContextId = params.userContextId;
|
||||
aEventDetail = params.eventDetail;
|
||||
aRelatedBrowser = params.relatedBrowser;
|
||||
}
|
||||
|
||||
// if we're adding tabs, we're past interrupt mode, ditch the owner
|
||||
@ -2050,7 +2060,8 @@
|
||||
// of tab.linkedBrowser.
|
||||
let browserParams = {
|
||||
forceNotRemote: aForceNotRemote,
|
||||
userContextId: aUserContextId
|
||||
userContextId: aUserContextId,
|
||||
relatedBrowser: aRelatedBrowser
|
||||
};
|
||||
let { usingPreloadedContent } = this._linkBrowserToTab(t, aURI, browserParams);
|
||||
let b = t.linkedBrowser;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIBrowser.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
@ -2485,6 +2486,34 @@ nsFrameLoader::SetClampScrollPosition(bool aClamp)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static
|
||||
ContentParent*
|
||||
GetContentParent(Element* aBrowser)
|
||||
{
|
||||
nsCOMPtr<nsIBrowser> browser = do_QueryInterface(aBrowser);
|
||||
if (!browser) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> related;
|
||||
browser->GetRelatedBrowser(getter_AddRefs(related));
|
||||
|
||||
nsCOMPtr<nsIFrameLoaderOwner> otherOwner = do_QueryInterface(related);
|
||||
if (!otherOwner) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFrameLoader> otherLoader = otherOwner->GetFrameLoader();
|
||||
TabParent* tabParent = TabParent::GetFrom(otherLoader);
|
||||
if (tabParent &&
|
||||
tabParent->Manager() &&
|
||||
tabParent->Manager()->IsContentParent()) {
|
||||
return tabParent->Manager()->AsContentParent();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
nsFrameLoader::TryRemoteBrowser()
|
||||
{
|
||||
@ -2543,6 +2572,9 @@ nsFrameLoader::TryRemoteBrowser()
|
||||
nsCaseInsensitiveStringComparator())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Try to get the related content parent from our browser element.
|
||||
openerContentParent = GetContentParent(mOwnerContent);
|
||||
}
|
||||
|
||||
uint32_t chromeFlags = 0;
|
||||
|
@ -1774,12 +1774,11 @@ TabParent::RecvSetCustomCursor(const nsCString& aCursorData,
|
||||
nsIXULBrowserWindow*
|
||||
TabParent::GetXULBrowserWindow()
|
||||
{
|
||||
nsCOMPtr<nsIContent> frame = do_QueryInterface(mFrameElement);
|
||||
if (!frame) {
|
||||
if (!mFrameElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = frame->OwnerDoc()->GetDocShell();
|
||||
nsCOMPtr<nsIDocShell> docShell = mFrameElement->OwnerDoc()->GetDocShell();
|
||||
if (!docShell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIBrowser.idl',
|
||||
'nsIHangReport.idl',
|
||||
]
|
||||
|
||||
|
17
dom/ipc/nsIBrowser.idl
Normal file
17
dom/ipc/nsIBrowser.idl
Normal file
@ -0,0 +1,17 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMElement;
|
||||
|
||||
[scriptable, uuid(14e5a0cb-e223-4202-95e8-fe53275193ea)]
|
||||
interface nsIBrowser : nsISupports
|
||||
{
|
||||
/**
|
||||
* Gets a related browser for a given browser (if any). If this exists, then
|
||||
* we should attempt to use the same content parent as its frameLoader
|
||||
* for any new tab parents.
|
||||
*/
|
||||
readonly attribute nsIDOMElement relatedBrowser;
|
||||
};
|
@ -12,7 +12,7 @@
|
||||
<content clickthrough="never">
|
||||
<children/>
|
||||
</content>
|
||||
<implementation type="application/javascript" implements="nsIObserver, nsIDOMEventListener, nsIMessageListener">
|
||||
<implementation type="application/javascript" implements="nsIObserver, nsIDOMEventListener, nsIMessageListener, nsIBrowser">
|
||||
<property name="autoscrollEnabled">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
@ -233,6 +233,20 @@
|
||||
onget="return this.mPrefs.QueryInterface(Components.interfaces.nsIPrefService);"
|
||||
readonly="true"/>
|
||||
|
||||
<!--
|
||||
Weak reference to the related browser (see
|
||||
nsIBrowser.getRelatedBrowser).
|
||||
-->
|
||||
<field name="_relatedBrowser">null</field>
|
||||
<property name="relatedBrowser">
|
||||
<getter><![CDATA[
|
||||
return this._relatedBrowser && this._relatedBrowser.get();
|
||||
]]></getter>
|
||||
<setter><![CDATA[
|
||||
this._relatedBrowser = Cu.getWeakReference(val);
|
||||
]]></setter>
|
||||
</property>
|
||||
|
||||
<field name="_docShell">null</field>
|
||||
|
||||
<property name="docShell" readonly="true">
|
||||
|
Loading…
Reference in New Issue
Block a user