Bug 1150120 - Pass outerWindowID up when sending contextmenu message up from content process. r=gabor.

This will hopefully allow us to avoid using CPOWs for contentDocument and contentWindow
when doing things like printing or viewing the source of subframes.

--HG--
extra : rebase_source : aa17cd0be26f136cefbde1c4683ac99a07c6bf15
extra : amend_source : ec32ff88015c74031977824d134922edd9a91c04
This commit is contained in:
Mike Conley 2015-04-01 13:38:24 -04:00
Родитель 5e706b024b
Коммит d3d4344540
3 изменённых файлов: 25 добавлений и 13 удалений

Просмотреть файл

@ -164,6 +164,9 @@ let handleContentContextMenu = function (event) {
let baseURI = doc.baseURI;
let referrer = doc.referrer;
let referrerPolicy = doc.referrerPolicy;
let frameOuterWindowID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
// Media related cache info parent needs for saving
let contentType = null;
@ -199,7 +202,8 @@ let handleContentContextMenu = function (event) {
sendSyncMessage("contextmenu",
{ editFlags, spellInfo, customMenuItems, addonInfo,
principal, docLocation, charSet, baseURI, referrer,
referrerPolicy, contentType, contentDisposition },
referrerPolicy, contentType, contentDisposition,
frameOuterWindowID },
{ event, popupNode: event.target });
}
else {

Просмотреть файл

@ -599,24 +599,31 @@ nsContextMenu.prototype = {
this.focusedWindow = win;
this.focusedElement = elt;
let ownerDoc = this.target.ownerDocument;
// If this is a remote context menu event, use the information from
// gContextMenuContentData instead.
if (this.isRemote) {
this.browser = gContextMenuContentData.browser;
this.principal = gContextMenuContentData.principal;
this.frameOuterWindowID = gContextMenuContentData.frameOuterWindowID;
} else {
editFlags = SpellCheckHelper.isEditable(this.target, window);
this.browser = this.target.ownerDocument.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
this.principal = this.target.ownerDocument.nodePrincipal;
this.browser = ownerDoc.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
this.principal = ownerDoc.nodePrincipal;
this.frameOuterWindowID = ownerDoc.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
}
this.onSocial = !!this.browser.getAttribute("origin");
// Check if we are in a synthetic document (stand alone image, video, etc.).
this.inSyntheticDoc = this.target.ownerDocument.mozSyntheticDocument;
this.inSyntheticDoc = ownerDoc.mozSyntheticDocument;
// First, do checks for nodes that never have children.
if (this.target.nodeType == Node.ELEMENT_NODE) {
// See if the user clicked on an image.
@ -635,7 +642,7 @@ nsContextMenu.prototype = {
var descURL = this.target.getAttribute("longdesc");
if (descURL) {
this.imageDescURL = makeURLAbsolute(this.target.ownerDocument.body.baseURI, descURL);
this.imageDescURL = makeURLAbsolute(ownerDoc.body.baseURI, descURL);
}
}
else if (this.target instanceof HTMLCanvasElement) {
@ -685,7 +692,7 @@ nsContextMenu.prototype = {
this.onKeywordField = (editFlags & SpellCheckHelper.KEYWORD);
}
else if (this.target instanceof HTMLHtmlElement) {
var bodyElt = this.target.ownerDocument.body;
var bodyElt = ownerDoc.body;
if (bodyElt) {
let computedURL;
try {
@ -776,11 +783,11 @@ nsContextMenu.prototype = {
this.onMathML = true;
// See if the user clicked in a frame.
var docDefaultView = this.target.ownerDocument.defaultView;
var docDefaultView = ownerDoc.defaultView;
if (docDefaultView != docDefaultView.top) {
this.inFrame = true;
if (this.target.ownerDocument.isSrcdocDocument) {
if (ownerDoc.isSrcdocDocument) {
this.inSrcdocFrame = true;
}
}
@ -805,7 +812,7 @@ nsContextMenu.prototype = {
InlineSpellCheckerUI.initFromRemote(gContextMenuContentData.spellInfo);
}
else {
var targetWin = this.target.ownerDocument.defaultView;
var targetWin = ownerDoc.defaultView;
var editingSession = targetWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIInterfaceRequestor)

Просмотреть файл

@ -3776,6 +3776,7 @@
referrerPolicy: aMessage.data.referrerPolicy,
contentType: aMessage.data.contentType,
contentDisposition: aMessage.data.contentDisposition,
frameOuterWindowID: aMessage.data.frameOuterWindowID,
};
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
let event = gContextMenuContentData.event;