forked from mirrors/gecko-dev
MozReview-Commit-ID: 1nPyv7G3q7d --HG-- extra : rebase_source : 9b0b75c43d441a13992f085ce6f766aee0614666 extra : source : 6036b8acdab58eb565f15e12f8184f8abe7c6413
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
const kURL =
|
|
"http://example.com/browser/browser/base/content/test/general/dummy_page.html";
|
|
"data:text/html,<a href=''>Middle-click me</a>";
|
|
|
|
/*
|
|
* Check that when manually opening content JS links in new tabs/windows,
|
|
* we use the correct principal, and we don't clear the URL bar.
|
|
*/
|
|
add_task(function* () {
|
|
yield BrowserTestUtils.withNewTab(kURL, function* (browser) {
|
|
let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser);
|
|
yield ContentTask.spawn(browser, null, function* () {
|
|
let a = content.document.createElement("a");
|
|
a.href = "javascript:document.write('spoof'); void(0);";
|
|
a.textContent = "Some link";
|
|
content.document.body.appendChild(a);
|
|
});
|
|
info("Added element");
|
|
yield BrowserTestUtils.synthesizeMouseAtCenter("a", {button: 1}, browser);
|
|
let newTab = yield newTabPromise;
|
|
is(newTab.linkedBrowser.contentPrincipal.origin, "http://example.com",
|
|
"Principal should be for example.com");
|
|
yield BrowserTestUtils.switchTab(gBrowser, newTab);
|
|
info(gURLBar.value);
|
|
isnot(gURLBar.value, "", "URL bar should not be empty.");
|
|
yield BrowserTestUtils.removeTab(newTab);
|
|
});
|
|
});
|