Bug 1687805 - Part 3: Support submitting form data with noopener enabled, r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D103361
This commit is contained in:
Nika Layzell
2021-01-29 22:15:46 +00:00
parent 051b109be1
commit faf9d9907c
2 changed files with 57 additions and 47 deletions

View File

@@ -8575,7 +8575,8 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER)),
"Only INTERNAL_LOAD_FLAGS_NO_OPENER and "
"INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER can be set");
MOZ_ASSERT(!aLoadState->PostDataStream());
MOZ_ASSERT_IF(aLoadState->PostDataStream(),
aLoadState->IsFormSubmission());
MOZ_ASSERT(!aLoadState->HeadersStream());
// If OnLinkClickSync was invoked inside the onload handler, the load
// type would be set to LOAD_NORMAL_REPLACE; otherwise it should be
@@ -8617,6 +8618,10 @@ nsresult nsDocShell::PerformRetargeting(nsDocShellLoadState* aLoadState) {
loadState->SetHasValidUserGestureActivation(
aLoadState->HasValidUserGestureActivation());
// Propagate POST data to the new load.
loadState->SetPostDataStream(aLoadState->PostDataStream());
loadState->SetIsFormSubmission(aLoadState->IsFormSubmission());
rv = win->Open(NS_ConvertUTF8toUTF16(spec),
aLoadState->Target(), // window name
u""_ns, // Features