зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1420702 - Test referrer when clicking cross domain link from pinned tab r=ckerschb
MozReview-Commit-ID: DokwVqZcrx7 --HG-- extra : rebase_source : 02f9ee54485288b7bf6fe2651acf3648db5a52c7
This commit is contained in:
Родитель
1cbe6d16c5
Коммит
51c703955b
|
@ -16,6 +16,7 @@ skip-if = os == 'linux' # Bug 1145199
|
|||
[browser_referrer_open_link_in_window_in_container.js]
|
||||
skip-if = os == 'linux' # Bug 1145199
|
||||
[browser_referrer_simple_click.js]
|
||||
[browser_referrer_click_pinned_tab.js]
|
||||
[browser_referrer_open_link_in_container_tab.js]
|
||||
skip-if = os == 'linux' # Bug 1144816
|
||||
[browser_referrer_open_link_in_container_tab2.js]
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/* 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/. */
|
||||
|
||||
// We will open a new tab if clicking on a cross domain link in pinned tab
|
||||
// So, override the tests data in head.js, adding "cross: true".
|
||||
|
||||
_referrerTests = [
|
||||
{
|
||||
fromScheme: "http://",
|
||||
toScheme: "http://",
|
||||
cross: true,
|
||||
result: "http://test1.example.com/browser" // full referrer
|
||||
},
|
||||
{
|
||||
fromScheme: "https://",
|
||||
toScheme: "http://",
|
||||
cross: true,
|
||||
result: "" // no referrer when downgrade
|
||||
},
|
||||
{
|
||||
fromScheme: "https://",
|
||||
toScheme: "http://",
|
||||
policy: "origin",
|
||||
cross: true,
|
||||
result: "https://test1.example.com/" // origin, even on downgrade
|
||||
},
|
||||
{
|
||||
fromScheme: "https://",
|
||||
toScheme: "http://",
|
||||
policy: "origin",
|
||||
rel: "noreferrer",
|
||||
cross: true,
|
||||
result: "" // rel=noreferrer trumps meta-referrer
|
||||
},
|
||||
{
|
||||
fromScheme: "https://",
|
||||
toScheme: "https://",
|
||||
policy: "no-referrer",
|
||||
cross: true,
|
||||
result: "" // same origin https://test1.example.com/browser
|
||||
},
|
||||
{
|
||||
fromScheme: "http://",
|
||||
toScheme: "https://",
|
||||
policy: "no-referrer",
|
||||
cross: true,
|
||||
result: "" // cross origin http://test1.example.com
|
||||
},
|
||||
];
|
||||
|
||||
async function startClickPinnedTabTestCase(aTestNumber) {
|
||||
info("browser_referrer_click_pinned_tab: " +
|
||||
getReferrerTestDescription(aTestNumber));
|
||||
let browser = gTestWindow.gBrowser;
|
||||
|
||||
browser.pinTab(browser.selectedTab);
|
||||
someTabLoaded(gTestWindow).then(function(aNewTab) {
|
||||
checkReferrerAndStartNextTest(aTestNumber, null, aNewTab,
|
||||
startClickPinnedTabTestCase);
|
||||
});
|
||||
|
||||
clickTheLink(gTestWindow, "testlink", {});
|
||||
}
|
||||
|
||||
function test() {
|
||||
requestLongerTimeout(10); // slowwww shutdown on e10s
|
||||
startReferrerTest(startClickPinnedTabTestCase);
|
||||
}
|
|
@ -11,9 +11,11 @@ function handleRequest(request, response)
|
|||
let scheme = query.get("scheme");
|
||||
let policy = query.get("policy");
|
||||
let rel = query.get("rel");
|
||||
let cross = query.get("cross");
|
||||
|
||||
let linkUrl = scheme +
|
||||
"test1.example.com/browser/browser/base/content/test/referrer/" +
|
||||
let host = cross ? "example.com" : "test1.example.com";
|
||||
let linkUrl = scheme + host +
|
||||
"/browser/browser/base/content/test/referrer/" +
|
||||
"file_referrer_testserver.sjs";
|
||||
let metaReferrerTag =
|
||||
policy ? `<meta name='referrer' content='${policy}'>` : "";
|
||||
|
|
|
@ -11,10 +11,13 @@ function handleRequest(request, response)
|
|||
let scheme = query.get("scheme");
|
||||
let policy = query.get("policy");
|
||||
let rel = query.get("rel");
|
||||
let cross = query.get("cross");
|
||||
|
||||
let linkUrl = scheme +
|
||||
"test1.example.com/browser/browser/base/content/test/referrer/" +
|
||||
let host = cross ? "example.com" : "test1.example.com";
|
||||
let linkUrl = scheme + host +
|
||||
"/browser/browser/base/content/test/referrer/" +
|
||||
"file_referrer_testserver.sjs";
|
||||
|
||||
let referrerPolicy =
|
||||
policy ? `referrerpolicy="${policy}"` : "";
|
||||
|
||||
|
|
|
@ -206,7 +206,8 @@ function referrerTestCaseLoaded(aTestNumber, aParams) {
|
|||
let url = test.fromScheme + server +
|
||||
"?scheme=" + escape(test.toScheme) +
|
||||
"&policy=" + escape(test.policy || "") +
|
||||
"&rel=" + escape(test.rel || "");
|
||||
"&rel=" + escape(test.rel || "") +
|
||||
"&cross=" + escape(test.cross || "");
|
||||
let browser = gTestWindow.gBrowser;
|
||||
return BrowserTestUtils.openNewForegroundTab(browser, () => {
|
||||
browser.selectedTab = browser.addTab(url, aParams);
|
||||
|
|
Загрузка…
Ссылка в новой задаче