mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 734076: make use of the new openUILink form to simplify context menu callers, r=dao
--HG-- extra : transplant_source : %D6%90%13%91%EA%3D3%CB%93B1%CD%7F%0Cf%D1%08%00%A4%E6
This commit is contained in:
parent
d5d8dbb0b3
commit
a4a4d8383b
@ -775,7 +775,8 @@ nsContextMenu.prototype = {
|
||||
urlSecurityCheck(frameURL, this.browser.contentPrincipal,
|
||||
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
||||
var referrer = doc.referrer;
|
||||
this.browser.loadURI(frameURL, referrer ? makeURI(referrer) : null);
|
||||
openUILinkIn(frameURL, "current", { disallowInheritPrincipal: true,
|
||||
referrerURI: referrer ? makeURI(referrer) : null });
|
||||
},
|
||||
|
||||
// View Partial Source
|
||||
@ -847,7 +848,8 @@ nsContextMenu.prototype = {
|
||||
}
|
||||
|
||||
var doc = this.target.ownerDocument;
|
||||
openUILink(viewURL, e, null, null, null, null, doc.documentURIObject );
|
||||
openUILink(viewURL, e, { disallowInheritPrincipal: true,
|
||||
referrerURI: doc.documentURIObject });
|
||||
},
|
||||
|
||||
saveVideoFrameAsImage: function () {
|
||||
@ -883,7 +885,8 @@ nsContextMenu.prototype = {
|
||||
this.browser.contentPrincipal,
|
||||
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
||||
var doc = this.target.ownerDocument;
|
||||
openUILink(this.bgImageURL, e, null, null, null, null, doc.documentURIObject );
|
||||
openUILink(this.bgImageURL, e, { disallowInheritPrincipal: true,
|
||||
referrerURI: doc.documentURIObject });
|
||||
},
|
||||
|
||||
disableSetDesktopBackground: function() {
|
||||
|
@ -281,6 +281,7 @@ _BROWSER_FILES = \
|
||||
redirect_bug623155.sjs \
|
||||
browser_tabDrop.js \
|
||||
browser_lastAccessedTab.js \
|
||||
browser_bug734076.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
107
browser/base/content/test/browser_bug734076.js
Normal file
107
browser/base/content/test/browser_bug734076.js
Normal file
@ -0,0 +1,107 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
registerCleanupFunction(function () {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
let browser = tab.linkedBrowser;
|
||||
browser.stop(); // stop the about:blank load
|
||||
|
||||
let writeDomainURL = encodeURI("data:text/html,<script>document.write(document.domain);</script>");
|
||||
let tests = [
|
||||
{
|
||||
name: "view background image",
|
||||
url: "http://mochi.test:8888/",
|
||||
go: function (cb) {
|
||||
let contentBody = browser.contentDocument.body;
|
||||
contentBody.style.backgroundImage = "url('" + writeDomainURL + "')";
|
||||
doOnLoad(function () {
|
||||
let domain = browser.contentDocument.body.textContent;
|
||||
is(domain, "", "no domain was inherited for view background image");
|
||||
cb();
|
||||
});
|
||||
|
||||
let contextMenu = initContextMenu(contentBody);
|
||||
contextMenu.viewBGImage();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "view image",
|
||||
url: "http://mochi.test:8888/",
|
||||
go: function (cb) {
|
||||
doOnLoad(function () {
|
||||
let domain = browser.contentDocument.body.textContent;
|
||||
is(domain, "", "no domain was inherited for view image");
|
||||
cb();
|
||||
});
|
||||
|
||||
let doc = browser.contentDocument;
|
||||
let img = doc.createElement("img");
|
||||
img.setAttribute("src", writeDomainURL);
|
||||
doc.body.appendChild(img);
|
||||
|
||||
let contextMenu = initContextMenu(img);
|
||||
contextMenu.viewMedia();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "show only this frame",
|
||||
url: "http://mochi.test:8888/",
|
||||
go: function (cb) {
|
||||
doOnLoad(function () {
|
||||
let domain = browser.contentDocument.body.textContent;
|
||||
is(domain, "", "no domain was inherited for 'show only this frame'");
|
||||
cb();
|
||||
});
|
||||
|
||||
let doc = browser.contentDocument;
|
||||
let iframe = doc.createElement("iframe");
|
||||
iframe.setAttribute("src", writeDomainURL);
|
||||
doc.body.appendChild(iframe);
|
||||
|
||||
iframe.addEventListener("load", function onload() {
|
||||
let contextMenu = initContextMenu(iframe.contentDocument.body);
|
||||
contextMenu.showOnlyThisFrame();
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
function doOnLoad(cb) {
|
||||
browser.addEventListener("load", function onLoad(e) {
|
||||
if (e.target != browser.contentDocument)
|
||||
return;
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
cb();
|
||||
}, true);
|
||||
}
|
||||
|
||||
function doNext() {
|
||||
let test = tests.shift();
|
||||
if (test) {
|
||||
info("Running test: " + test.name);
|
||||
doOnLoad(function () {
|
||||
test.go(function () {
|
||||
executeSoon(doNext);
|
||||
});
|
||||
});
|
||||
browser.contentDocument.location = test.url;
|
||||
} else {
|
||||
executeSoon(finish);
|
||||
}
|
||||
}
|
||||
|
||||
doNext();
|
||||
}
|
||||
|
||||
function initContextMenu(aNode) {
|
||||
document.popupNode = aNode;
|
||||
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
|
||||
let contextMenu = new nsContextMenu(contentAreaContextMenu, gBrowser);
|
||||
return contextMenu;
|
||||
}
|
Loading…
Reference in New Issue
Block a user