mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 23:13:18 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1233914 - P1. ping doesn't honor the TP list. r=francois (14b9df4e67) - Bug 1233914 - P2. Testcase. r=francois (4aa1142877) - bit of Bug 1178058 (9309410d6d) - Bug 1253538 - Window.open() should not reuse an existing window if it's running a different container - patch 2, r=bz (1c62d48537) - Bug 1254103 - Window.open() should not reuse an existing window if it's running a different container, r=bz (ce5bf89b65) - Bug 1253538 - Window.open() should not reuse an existing window if it's running a different container - patch 1, r=bz (45692fa791) - Bug 682294 - Add an error page for file access denied. r=bz (e94be73e70) - Bug 682294 - Remove redundant trailing spaces. r=bz (f299d7302d) - Bug 1122642 - Have an error page for H2 INADEQUATE_SECURITY r=mcmanus,bz (70e89ed8f0) - Bug 1253792 - Handle another case of re-entrancy through nsDocShell::InternalLoad. r=smaug (87f436cc4b) - Bug 1240246 - Handle re-entrancy in nsDocShell::InternalLoad more gracefully. r=smaug (98985d7233) - Bug 1247810 - Redirect the enum query on Core profiles. - r=jrmuizel (f55c0fb46c) - Bug 1257861 - Test that we send cookies from XHRs in web workers when 3rd party cookies are disabled. r=sicking (2334c6621e) - Bug 1257861 - Default to sending all cookies if we can't compute 3rdpartyness. r=sicking (817fe6fbfc)
This commit is contained in:
@@ -522,8 +522,9 @@ SendPing(void* aClosure, nsIContent* aContent, nsIURI* aURI,
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't bother caching the result of this URI load.
|
||||
chan->SetLoadFlags(nsIRequest::INHIBIT_CACHING);
|
||||
// Don't bother caching the result of this URI load, but do not exempt
|
||||
// it from Safe Browsing.
|
||||
chan->SetLoadFlags(nsIRequest::INHIBIT_CACHING | nsIChannel::LOAD_CLASSIFY_URI);
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(chan);
|
||||
if (!httpChan) {
|
||||
@@ -1510,8 +1511,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
|
||||
}
|
||||
// Don't inherit from the current page. Just do the safe thing
|
||||
// and pretend that we were loaded by a nullprincipal.
|
||||
owner = do_CreateInstance("@mozilla.org/nullprincipal;1");
|
||||
NS_ENSURE_TRUE(owner, NS_ERROR_FAILURE);
|
||||
owner = nsNullPrincipal::Create();
|
||||
inheritOwner = false;
|
||||
}
|
||||
}
|
||||
@@ -3475,6 +3475,11 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (static_cast<nsDocShell*>(targetDS.get())->GetOriginAttributes() !=
|
||||
static_cast<nsDocShell*>(accessingDS.get())->GetOriginAttributes()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// A private document can't access a non-private one, and vice versa.
|
||||
if (static_cast<nsDocShell*>(targetDS.get())->UsePrivateBrowsing() !=
|
||||
static_cast<nsDocShell*>(accessingDS.get())->UsePrivateBrowsing()) {
|
||||
@@ -4788,6 +4793,9 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||
} else if (NS_ERROR_FILE_NOT_FOUND == aError) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
error.AssignLiteral("fileNotFound");
|
||||
} else if (NS_ERROR_FILE_ACCESS_DENIED == aError) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
error.AssignLiteral("fileAccessDenied");
|
||||
} else if (NS_ERROR_UNKNOWN_HOST == aError) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
// Get the host
|
||||
@@ -5034,6 +5042,11 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||
// ServiceWorker intercepted request, but something went wrong.
|
||||
error.AssignLiteral("corruptedContentError");
|
||||
break;
|
||||
case NS_ERROR_NET_INADEQUATE_SECURITY:
|
||||
// Server negotiated bad TLS for HTTP/2.
|
||||
error.AssignLiteral("inadequateSecurityError");
|
||||
addHostPort = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -7563,6 +7576,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
//
|
||||
if (url && NS_FAILED(aStatus)) {
|
||||
if (aStatus == NS_ERROR_FILE_NOT_FOUND ||
|
||||
aStatus == NS_ERROR_FILE_ACCESS_DENIED ||
|
||||
aStatus == NS_ERROR_CORRUPTED_CONTENT ||
|
||||
aStatus == NS_ERROR_INVALID_CONTENT_ENCODING) {
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
@@ -7787,6 +7801,7 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
aStatus == NS_ERROR_UNSAFE_CONTENT_TYPE ||
|
||||
aStatus == NS_ERROR_REMOTE_XUL ||
|
||||
aStatus == NS_ERROR_INTERCEPTION_FAILED ||
|
||||
aStatus == NS_ERROR_NET_INADEQUATE_SECURITY ||
|
||||
NS_ERROR_GET_MODULE(aStatus) == NS_ERROR_MODULE_SECURITY) {
|
||||
// Errors to be shown for any frame
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
@@ -9647,6 +9662,11 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
|
||||
|
||||
NS_ENSURE_TRUE(!mIsBeingDestroyed, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
rv = EnsureScriptEnvironment();
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// wyciwyg urls can only be loaded through history. Any normal load of
|
||||
// wyciwyg through docshell is illegal. Disallow such loads.
|
||||
if (aLoadType & LOAD_CMD_NORMAL) {
|
||||
@@ -9662,15 +9682,11 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
|
||||
isJavaScript = false;
|
||||
}
|
||||
|
||||
//
|
||||
// First, notify any nsIContentPolicy listeners about the document load.
|
||||
// Only abort the load if a content policy listener explicitly vetos it!
|
||||
//
|
||||
nsCOMPtr<Element> requestingElement;
|
||||
// Use nsPIDOMWindow since we _want_ to cross the chrome boundary if needed
|
||||
if (mScriptGlobal) {
|
||||
requestingElement = mScriptGlobal->GetFrameElementInternal();
|
||||
}
|
||||
nsCOMPtr<Element> requestingElement =
|
||||
mScriptGlobal->GetFrameElementInternal();
|
||||
|
||||
RefPtr<nsGlobalWindow> MMADeathGrip = mScriptGlobal;
|
||||
|
||||
@@ -9832,8 +9848,6 @@ nsDocShell::InternalLoad2(nsIURI* aURI,
|
||||
if (aURI) {
|
||||
aURI->GetSpec(spec);
|
||||
}
|
||||
// RM 2018-12-03 We miss all loadInfo setting up here
|
||||
// so we cannot set aIsFromProcessingFrameAttributes
|
||||
rv = win->OpenNoNavigate(NS_ConvertUTF8toUTF16(spec),
|
||||
name, // window name
|
||||
EmptyString(), // Features
|
||||
@@ -10590,10 +10604,16 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
nsIURI* aBaseURI,
|
||||
nsContentPolicyType aContentPolicyType)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURILoader> uriLoader;
|
||||
// Double-check that we're still around to load this URI.
|
||||
if (mIsBeingDestroyed) {
|
||||
// Return NS_OK despite not doing anything to avoid throwing exceptions from
|
||||
// nsLocation::SetHref if the unload handler of the existing page tears us
|
||||
// down.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID, &rv);
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURILoader> uriLoader = do_GetService(NS_URI_LOADER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@@ -10635,10 +10655,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
|
||||
bool isSrcdoc = !aSrcdoc.IsVoid();
|
||||
|
||||
// There are three cases we care about:
|
||||
// * Null mScriptGlobal: shouldn't happen but does (see bug 1240246). In this
|
||||
// case, we create a loadingPrincipal as for a top-level load, but we leave
|
||||
// requestingNode and requestingWindow null.
|
||||
// There are two cases we care about:
|
||||
// * Top-level load (GetFrameElementInternal returns null). In this case,
|
||||
// requestingNode is null, but requestingWindow is our mScriptGlobal.
|
||||
// TODO we want to pass null for loadingPrincipal in this case.
|
||||
@@ -10649,18 +10666,20 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
nsCOMPtr<nsPIDOMWindow> requestingWindow;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> loadingPrincipal;
|
||||
if (mScriptGlobal) {
|
||||
requestingNode = mScriptGlobal->GetFrameElementInternal();
|
||||
if (requestingNode) {
|
||||
// If we have a requesting node, then use that as our loadingPrincipal.
|
||||
loadingPrincipal = requestingNode->NodePrincipal();
|
||||
} else {
|
||||
MOZ_ASSERT(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT);
|
||||
requestingWindow = mScriptGlobal;
|
||||
requestingNode = mScriptGlobal->GetFrameElementInternal();
|
||||
if (requestingNode) {
|
||||
// If we have a requesting node, then use that as our loadingPrincipal.
|
||||
loadingPrincipal = requestingNode->NodePrincipal();
|
||||
} else {
|
||||
if (aContentPolicyType != nsIContentPolicy::TYPE_DOCUMENT) {
|
||||
// If this isn't a top-level load and mScriptGlobal's frame element is
|
||||
// null, then the element got removed from the DOM while we were trying to
|
||||
// load this resource. This docshell is scheduled for destruction already,
|
||||
// so bail out here.
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (!loadingPrincipal) {
|
||||
requestingWindow = mScriptGlobal;
|
||||
if (mItemType != typeChrome) {
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
ssm->GetDocShellCodebasePrincipal(aURI, this, getter_AddRefs(loadingPrincipal));
|
||||
|
||||
Reference in New Issue
Block a user