author | Ben Kelly <ben@wanderview.com> |
Wed, 10 Jan 2018 13:59:29 -0500 | |
changeset 398672 | 1e1991807b395b83e2e1e7b1eb67ce00c479da2e |
parent 398671 | d055b4f81d592ee54a6593d09d928c28901b689d |
child 398673 | a4c611046a0c977a82d0797af446a1b2fca2ee7a |
push id | 33228 |
push user | aciure@mozilla.com |
push date | Thu, 11 Jan 2018 09:55:35 +0000 |
treeherder | mozilla-central@e61c4485494e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | asuth |
bugs | 1426979 |
milestone | 59.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/nsGlobalWindowInner.cpp +++ b/dom/base/nsGlobalWindowInner.cpp @@ -1745,18 +1745,42 @@ nsGlobalWindowInner::InnerSetNewDocument nsresult nsGlobalWindowInner::EnsureClientSource() { MOZ_DIAGNOSTIC_ASSERT(mDoc); bool newClientSource = false; + // Get the load info for the document if we performed a load. Be careful + // not to look at about:blank or about:srcdoc loads, though. They will have + // a channel and loadinfo, but their loadinfo will never be controlled. This + // would in turn inadvertantly trigger the logic below to clear the inherited + // controller. + nsCOMPtr<nsILoadInfo> loadInfo; nsCOMPtr<nsIChannel> channel = mDoc->GetChannel(); - nsCOMPtr<nsILoadInfo> loadInfo = channel ? channel->GetLoadInfo() : nullptr; + if (channel) { + nsCOMPtr<nsIURI> uri; + Unused << channel->GetURI(getter_AddRefs(uri)); + + bool ignoreLoadInfo = false; + + // Note, this is mostly copied from NS_IsAboutBlank(). Its duplicated + // here so we can efficiently check about:srcdoc as well. + bool isAbout = false; + if (NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)) && isAbout) { + nsCString spec = uri->GetSpecOrDefault(); + ignoreLoadInfo = spec.EqualsLiteral("about:blank") || + spec.EqualsLiteral("about:srcdoc"); + } + + if (!ignoreLoadInfo) { + loadInfo = channel->GetLoadInfo(); + } + } // Take the initial client source from the docshell immediately. Even if we // don't end up using it here we should consume it. UniquePtr<ClientSource> initialClientSource; nsIDocShell* docshell = GetDocShell(); if (docshell) { initialClientSource = docshell->TakeInitialClientSource(); }