зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1314249 - if the target changes, assume we should not pass an opener ref, r=smaug
MozReview-Commit-ID: 7DBrRW1WiMP --HG-- rename : browser/base/content/test/general/browser_bug1064280_changeUrlInPinnedTab.js => browser/base/content/test/tabs/browser_navigatePinnedTab.js extra : rebase_source : 2aa1a459e07cd0d326e9c3d6e1b87afd0dbbc28b
This commit is contained in:
Родитель
a594637fd6
Коммит
be8efc6f08
|
@ -272,7 +272,6 @@ tags = mcb
|
|||
[browser_bug970746.js]
|
||||
[browser_bug1015721.js]
|
||||
skip-if = os == 'win'
|
||||
[browser_bug1064280_changeUrlInPinnedTab.js]
|
||||
[browser_accesskeys.js]
|
||||
[browser_clipboard.js]
|
||||
subsuite = clipboard
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
skip-if = !e10s # Tab spinner is e10s only.
|
||||
[browser_tabSwitchPrintPreview.js]
|
||||
skip-if = os == 'mac'
|
||||
[browser_navigatePinnedTab.js]
|
||||
|
|
|
@ -29,8 +29,31 @@ add_task(function* () {
|
|||
is(appTab.linkedBrowser.currentURI.spec, TEST_LINK_CHANGED,
|
||||
"New page loaded in the app tab");
|
||||
is(gBrowser.tabs.length, initialTabsNo, "No additional tabs were opened");
|
||||
|
||||
// Now check that opening a link that does create a new tab works,
|
||||
// and also that it nulls out the opener.
|
||||
let pageLoadPromise = BrowserTestUtils.browserLoaded(appTab.linkedBrowser, "http://example.com/");
|
||||
yield BrowserTestUtils.loadURI(appTab.linkedBrowser, "http://example.com/");
|
||||
info("Started loading example.com");
|
||||
yield pageLoadPromise;
|
||||
info("Loaded example.com");
|
||||
let newTabPromise = BrowserTestUtils.waitForNewTab(gBrowser, "http://example.org/");
|
||||
yield ContentTask.spawn(browser, null, function* () {
|
||||
let link = content.document.createElement("a");
|
||||
link.href = "http://example.org/";
|
||||
content.document.body.appendChild(link);
|
||||
link.click();
|
||||
});
|
||||
info("Created & clicked link");
|
||||
let extraTab = yield newTabPromise;
|
||||
info("Got a new tab");
|
||||
yield ContentTask.spawn(extraTab.linkedBrowser, null, function* () {
|
||||
is(content.opener, null, "No opener should be available");
|
||||
});
|
||||
yield BrowserTestUtils.removeTab(extraTab);
|
||||
});
|
||||
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
});
|
|
@ -13785,6 +13785,7 @@ public:
|
|||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream,
|
||||
bool aNoOpenerImplied,
|
||||
bool aIsTrusted);
|
||||
|
||||
NS_IMETHOD Run() override
|
||||
|
@ -13801,6 +13802,7 @@ public:
|
|||
mHandler->OnLinkClickSync(mContent, mURI,
|
||||
mTargetSpec.get(), mFileName,
|
||||
mPostDataStream, mHeadersDataStream,
|
||||
mNoOpenerImplied,
|
||||
nullptr, nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -13815,6 +13817,7 @@ private:
|
|||
nsCOMPtr<nsIInputStream> mHeadersDataStream;
|
||||
nsCOMPtr<nsIContent> mContent;
|
||||
PopupControlState mPopupState;
|
||||
bool mNoOpenerImplied;
|
||||
bool mIsTrusted;
|
||||
};
|
||||
|
||||
|
@ -13825,6 +13828,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
|
|||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream,
|
||||
bool aNoOpenerImplied,
|
||||
bool aIsTrusted)
|
||||
: mHandler(aHandler)
|
||||
, mURI(aURI)
|
||||
|
@ -13834,6 +13838,7 @@ OnLinkClickEvent::OnLinkClickEvent(nsDocShell* aHandler,
|
|||
, mHeadersDataStream(aHeadersDataStream)
|
||||
, mContent(aContent)
|
||||
, mPopupState(mHandler->mScriptGlobal->GetPopupControlState())
|
||||
, mNoOpenerImplied(aNoOpenerImplied)
|
||||
, mIsTrusted(aIsTrusted)
|
||||
{
|
||||
}
|
||||
|
@ -13871,11 +13876,15 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
|
|||
nsAutoString target;
|
||||
|
||||
nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
|
||||
bool noOpenerImplied = false;
|
||||
if (browserChrome3) {
|
||||
nsCOMPtr<nsIDOMNode> linkNode = do_QueryInterface(aContent);
|
||||
nsAutoString oldTarget(aTargetSpec);
|
||||
rv = browserChrome3->OnBeforeLinkTraversal(oldTarget, aURI,
|
||||
linkNode, mIsAppTab, target);
|
||||
if (!oldTarget.Equals(target)) {
|
||||
noOpenerImplied = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -13884,7 +13893,8 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
|
|||
|
||||
nsCOMPtr<nsIRunnable> ev =
|
||||
new OnLinkClickEvent(this, aContent, aURI, target.get(), aFileName,
|
||||
aPostDataStream, aHeadersDataStream, aIsTrusted);
|
||||
aPostDataStream, aHeadersDataStream, noOpenerImplied,
|
||||
aIsTrusted);
|
||||
return NS_DispatchToCurrentThread(ev);
|
||||
}
|
||||
|
||||
|
@ -13895,6 +13905,7 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
|||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream,
|
||||
nsIInputStream* aHeadersDataStream,
|
||||
bool aNoOpenerImplied,
|
||||
nsIDocShell** aDocShell,
|
||||
nsIRequest** aRequest)
|
||||
{
|
||||
|
@ -13960,6 +13971,9 @@ nsDocShell::OnLinkClickSync(nsIContent* aContent,
|
|||
flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
|
||||
}
|
||||
}
|
||||
if (aNoOpenerImplied) {
|
||||
flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the owner document of the link that was clicked, this will be
|
||||
|
|
|
@ -207,6 +207,7 @@ public:
|
|||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream = 0,
|
||||
nsIInputStream* aHeadersDataStream = 0,
|
||||
bool aNoOpenerImplied = false,
|
||||
nsIDocShell** aDocShell = 0,
|
||||
nsIRequest** aRequest = 0) override;
|
||||
NS_IMETHOD OnOverLink(nsIContent* aContent,
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
* @param aFileName non-null when the link should be downloaded as the given file
|
||||
* @param aPostDataStream the POST data to send
|
||||
* @param aHeadersDataStream ???
|
||||
* @param aNoOpenerImplied if the link implies "noopener"
|
||||
* @param aDocShell (out-param) the DocShell that the request was opened on
|
||||
* @param aRequest the request that was opened
|
||||
*/
|
||||
|
@ -68,6 +69,7 @@ public:
|
|||
const nsAString& aFileName,
|
||||
nsIInputStream* aPostDataStream = 0,
|
||||
nsIInputStream* aHeadersDataStream = 0,
|
||||
bool aNoOpenerImplied = false,
|
||||
nsIDocShell** aDocShell = 0,
|
||||
nsIRequest** aRequest = 0) = 0;
|
||||
|
||||
|
|
|
@ -829,7 +829,7 @@ HTMLFormElement::SubmitSubmission(HTMLFormSubmission* aFormSubmission)
|
|||
rv = linkHandler->OnLinkClickSync(this, actionURI,
|
||||
target.get(),
|
||||
NullString(),
|
||||
postDataStream, nullptr,
|
||||
postDataStream, nullptr, false,
|
||||
getter_AddRefs(docShell),
|
||||
getter_AddRefs(mSubmittingRequest));
|
||||
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
||||
|
|
Загрузка…
Ссылка в новой задаче