mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1018154 - part 2: adjust tests now that mayInheritPrincipal has gone the way of the dodo, r=Unfocused
--HG-- rename : browser/base/content/test/general/browser_middleMouse_inherit.js => browser/base/content/test/general/browser_middleMouse_noJSPaste.js
This commit is contained in:
parent
d8e39296ea
commit
ac0c756957
@ -309,11 +309,9 @@ skip-if = e10s # Bug ?????? - test directly manipulates content (gBrowser.conten
|
||||
skip-if = toolkit == "windows" # Disabled on Windows due to frequent failures (bug 969405)
|
||||
[browser_locationBarCommand.js]
|
||||
skip-if = os == "linux" || e10s # Linux: Intermittent failures, bug 917535; e10s: Bug ?????? - Focus issues (There should be no focused element - Got [object XULElement], expected null)
|
||||
[browser_locationBarExternalLoad.js]
|
||||
skip-if = e10s # Bug ?????? - URL bar issues ("There should be no focused element - Got [object XULElement], expected null")
|
||||
[browser_menuButtonFitts.js]
|
||||
skip-if = os != "win" || e10s # The Fitts Law menu button is only supported on Windows (bug 969376); # Bug ?????? - URL bar issues ("There should be no focused element - Got [object XULElement], expected null")
|
||||
[browser_middleMouse_inherit.js]
|
||||
[browser_middleMouse_noJSPaste.js]
|
||||
skip-if = e10s # Bug 921952 - Content:Click event issues
|
||||
[browser_minimize.js]
|
||||
skip-if = e10s # Bug ?????? - test directly manipulates content (TypeError: gBrowser.docShell is null)
|
||||
|
@ -11,10 +11,9 @@ function getPostDataString(aIS) {
|
||||
return dataLines[dataLines.length-1];
|
||||
}
|
||||
|
||||
function keywordResult(aURL, aPostData, aIsUnsafe) {
|
||||
function keywordResult(aURL, aPostData) {
|
||||
this.url = aURL;
|
||||
this.postData = aPostData;
|
||||
this.isUnsafe = aIsUnsafe;
|
||||
}
|
||||
|
||||
function keyWordData() {}
|
||||
@ -53,20 +52,20 @@ var testData = [
|
||||
new keywordResult("http://bmget-nosearch/", null)],
|
||||
|
||||
[new searchKeywordData("searchget", "http://searchget/?search={searchTerms}", null, "foo4"),
|
||||
new keywordResult("http://searchget/?search=foo4", null, true)],
|
||||
new keywordResult("http://searchget/?search=foo4", null)],
|
||||
|
||||
[new searchKeywordData("searchpost", "http://searchpost/", "search={searchTerms}", "foo5"),
|
||||
new keywordResult("http://searchpost/", "search=foo5", true)],
|
||||
new keywordResult("http://searchpost/", "search=foo5")],
|
||||
|
||||
[new searchKeywordData("searchpostget", "http://searchpostget/?search1={searchTerms}", "search2={searchTerms}", "foo6"),
|
||||
new keywordResult("http://searchpostget/?search1=foo6", "search2=foo6", true)],
|
||||
new keywordResult("http://searchpostget/?search1=foo6", "search2=foo6")],
|
||||
|
||||
// Bookmark keywords that don't take parameters should not be activated if a
|
||||
// parameter is passed (bug 420328).
|
||||
[new bmKeywordData("bmget-noparam", "http://bmget-noparam/", null, "foo7"),
|
||||
new keywordResult(null, null, true)],
|
||||
new keywordResult(null, null)],
|
||||
[new bmKeywordData("bmpost-noparam", "http://bmpost-noparam/", "not_a=param", "foo8"),
|
||||
new keywordResult(null, null, true)],
|
||||
new keywordResult(null, null)],
|
||||
|
||||
// Test escaping (%s = escaped, %S = raw)
|
||||
// UTF-8 default
|
||||
@ -88,7 +87,7 @@ var testData = [
|
||||
// getShortcutOrURIAndPostData for non-keywords (setupKeywords only adds keywords for
|
||||
// bmKeywordData objects)
|
||||
[{keyword: "http://gavinsharp.com"},
|
||||
new keywordResult(null, null, true)]
|
||||
new keywordResult(null, null)]
|
||||
];
|
||||
|
||||
function test() {
|
||||
@ -109,7 +108,6 @@ function test() {
|
||||
let expected = result.url || query;
|
||||
is(returnedData.url, expected, "got correct URL for " + data.keyword);
|
||||
is(getPostDataString(returnedData.postData), result.postData, "got correct postData for " + data.keyword);
|
||||
is(returnedData.mayInheritPrincipal, !result.isUnsafe, "got correct mayInheritPrincipal for " + data.keyword);
|
||||
}
|
||||
cleanupKeywords();
|
||||
}).then(finish);
|
||||
|
@ -1,65 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
nextTest();
|
||||
}
|
||||
|
||||
let urls = [
|
||||
"javascript:'foopy';",
|
||||
"data:text/html,<body>hi"
|
||||
];
|
||||
|
||||
function urlEnter(url) {
|
||||
gURLBar.value = url;
|
||||
gURLBar.focus();
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
}
|
||||
|
||||
function urlClick(url) {
|
||||
gURLBar.value = url;
|
||||
gURLBar.focus();
|
||||
let goButton = document.getElementById("urlbar-go-button");
|
||||
EventUtils.synthesizeMouseAtCenter(goButton, {});
|
||||
}
|
||||
|
||||
function nextTest() {
|
||||
let url = urls.shift();
|
||||
if (url) {
|
||||
testURL(url, urlEnter, function () {
|
||||
testURL(url, urlClick, nextTest);
|
||||
});
|
||||
}
|
||||
else
|
||||
finish();
|
||||
}
|
||||
|
||||
function testURL(url, loadFunc, endFunc) {
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
registerCleanupFunction(function () {
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
addPageShowListener(function () {
|
||||
let pagePrincipal = gBrowser.contentPrincipal;
|
||||
loadFunc(url);
|
||||
|
||||
addPageShowListener(function () {
|
||||
let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
|
||||
is(fm.focusedElement, null, "should be no focused element");
|
||||
is(fm.focusedWindow, gBrowser.contentWindow, "content window should be focused");
|
||||
|
||||
ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
|
||||
"load of " + url + " by " + loadFunc.name + " should produce a page with a different principal");
|
||||
endFunc();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function addPageShowListener(func) {
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function loadListener() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", loadListener, false);
|
||||
func();
|
||||
});
|
||||
}
|
@ -20,7 +20,7 @@ function test() {
|
||||
let pagePrincipal = gBrowser.contentPrincipal;
|
||||
|
||||
// copy javascript URI to the clipboard
|
||||
let url = "javascript:1+1";
|
||||
let url = "javascript:http://www.example.com/";
|
||||
waitForClipboard(url,
|
||||
function() {
|
||||
Components.classes["@mozilla.org/widget/clipboardhelper;1"]
|
||||
@ -39,9 +39,7 @@ function test() {
|
||||
);
|
||||
|
||||
addPageShowListener(function () {
|
||||
is(gBrowser.currentURI.spec, url, "url loaded by middle click");
|
||||
ok(!gBrowser.contentPrincipal.equals(pagePrincipal),
|
||||
"middle click load of " + url + " should produce a page with a different principal");
|
||||
is(gBrowser.currentURI.spec, url.replace(/^javascript:/, ""), "url loaded by middle click doesn't include JS");
|
||||
finish();
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user