import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1254752 - Remove deprecated functions from nsIIOService. r=mcmanus (1b9872da0f)
- Bug 1256030 - Update NetUtil.jsm to handle file loads. r=mcmanus r=sicking (4eac2d2d23)
- Bug 1257339 - Bring back deprecated newChannel() API on nsIIOService. r=sicking, r=mcmanus CLOSED TREE (eac97ce42a)
- Bug 1105556 - Allow loadInfo->loadingNode and loadInfo->loadingPrincipal to be null for TYPE_DOCUMENT loads. r=sicking, ckerschb (b41db96a85)
- Bug 1105556 - (a2626c4533)
- Bug 1105556 - We won't have a channelLoadingPrincipal for top level loads, so nsChannelClassifier::SameLoadingURI will return false. Adding a comment to indicate that the behavior is fine since Tracking Protection doesn't apply to top level loads. r=fmarier (8f3823a917)
- Bug 1243586 - Test Upgrade-Insecure-Requests HTTP Request Header Field. r=rbarnes (a529e70155)
- Bug 1105556 - Add a hidden preference that is checked in debug mode to determine whether the main LoadInfo() constructor should assert that the ContentPolicyType is not TYPE_DOCUMENT. (153b80c661)
- Bug 1259678 - Refactor SubjectToCSP to avoid calling ShouldLoad if CSP doesn't apply to the content type. r=ckerschb (73d79be6f9)
- Bug 1093642 - Part 1: Use parentAllowsMixedContent to decide if child tab should load mixed content. r=tanvi, r=MattN (f7ccc7a0fd)
- Bug 1250958 - fix browser_markPageAsFollowedLink.js for e10s (and fix framed link coloring to make it pass). r=jaws (04e97444ee)
- Bug 1093642 - Part 2: Decide if we allow mixed content before sending click event to remote tab. r=tanvi. (d470aaa152)
- fix net error (32a2aaba25)
- Bug 1257930 - Update NetUtil.asyncFetch() to use asyncOpen2(). r=sicking (bcbd754e4c)
- Bug 908933 - Part1 - CSP: Call ShouldLoad inside ShouldProcess for TYPE_OBJECT. r=ckerschb (eb87244649)
- Bug 1125916 - Fix code that miss proper flags and originAttributes in LoadInfo. Also fix some tests. r=sicking, r=jduell (35f5a07635)
- Bug 1263790 - Resource timing initiatorType should be "iframe" instead of "subdocument" r=bz (e38569e488)
- Bug 1257809 - "Improve telemetry for PR_Connect". r=mcmanus (225fc45f80)
- Bug 698882 - mozilla::net::PollableEvent r=dragana r=mayhemer (abf47e4653)
- Bug 1260218 - SocketTransportService socket expansion r=dragana (6045e8d1a4)
- align comment (4b4cb6ac97)
- Bug 1253711 - delete unused MediaFormatReader::ByteInterval typedef; r=jya (b66387bb4f)
- Bug 1265974 - Don't fire push events in MediaQueue::PushFront(). r=jya. (f5caa8dcd4)
- Bug 1265969 - Don't fire pop events in MediaQueue::Reset(). r=jya. (601f546522)
- Bug 1250934: Don't reopen input AudioCallbackDrivers on a second use r=padenot (a5beb7ad31)
- Bug 1246310 - Resample the AudioSegment in SourceMediaStream::AddAudioTrack. r=padenot (bd3964f725)
- Bug 1239911 - Remove unused |mAudioChannel|. r=bechen. (8ba8408728)
- Bug 1250934: remove unused method from MediaStreamGraphImpl r=padenot (5d5767a14f)
- Bug 1199069 - Remove ancient deopt from AudioStream required for MSVC2010. r=jwwang (73b4390bfa)
- Bug 1229256: P1. Only check readyState update upon buffered range completion. r=jwwang (189ea2bd9e)
- Bug 1242338 - fix numerical issue in MediaDecoder::Seek(); r=jwwang (fa45e4bc4a)
- part of Bug 1158448 Part 2 (ee6f4fb502)
- Bug 1266680 - Fix stopping MediaStreamTrack when there are clones. r=jib (ffc225f820)
- Bug 1252459 - Replaced 'identity.name' by 'name' to fix identity undefined bug, r=mt (cc105ed048)
- Bug 1213056 - change getStats to be maplike. r=bz (95cadfa385)
- Bug 1259728 - minimal fix for reentrancy in pc.close(). r=jesup (56f8f5945e)
- Bug 1257100 - Report we can play type 'audio/mp4; codecs=mp4a.40.29'. r=jya (dbc04361a6)
- align some media tests (dfd85dfa34)
- Bug 1206341 - Fix memory tool direction for rtl locales. r=ntim (2cd20f8ccc)
- Bug 1261159 - Tree map zooming is awkward. r=fitzgen (3177935dce)
- Bug 1263397 - The tree map should zoom at centering around the mouse pointer. r=fitzgen (b15861f721)
- Bug 1253784 - Add Immutable.js. r=bgrins, r=gerv, r=fitzgen (99838a287b)
- Bug 1241050 - Cleanup developer-toolbar imports. r=jwalker (44f337ea8c)
- Bug 1248600 - Remove registerBrowserWindow/forgetBrowserWindow calls from /browser/. r=jryans (ebaf99a8b1)
- Bug 1247203 - Move telemetry ping from gDevTools to gDevToolsBrowser. r=jryans (8207402d38)
- Bug 1233463 - Expose about:devtools-toolbox shortcut to load the toolbox. r=jryans (116da60f72)
- Bug 1247203 - Emit devtools-loaded from the loader. r=jryans (510bd48b5a)
- Bug 1247203 - Register tools and themes in the sorted order. r=jryans (17f62ab1e1)
- Bug 1247203 - Cleanup relations between main client module and devtools-browser. r=jryans (7cc6c4525a)
This commit is contained in:
2024-07-07 23:35:08 +08:00
parent 0baaacb716
commit 2bd895cc55
423 changed files with 11296 additions and 1029 deletions
+55 -31
View File
@@ -10635,6 +10635,11 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}
if (IsFrame()) {
MOZ_ASSERT(aContentPolicyType == nsIContentPolicy::TYPE_INTERNAL_IFRAME ||
aContentPolicyType == nsIContentPolicy::TYPE_INTERNAL_FRAME,
"DoURILoad thinks this is a frame and InternalLoad does not");
// Only allow view-source scheme in top-level docshells. view-source is
// the only scheme to which this applies at the moment due to potential
// timing attacks to read data from cross-origin iframes. If this widens
@@ -10653,8 +10658,12 @@ nsDocShell::DoURILoad(nsIURI* aURI,
nestedURI->GetInnerURI(getter_AddRefs(tempURI));
nestedURI = do_QueryInterface(tempURI);
}
} else {
MOZ_ASSERT(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT,
"DoURILoad thinks this is a document and InternalLoad does not");
}
// For mozWidget, display a load error if we navigate to a page which is not
// claimed in |widgetPages|.
// When we go to display a load error for an invalid mozWidget page, we will
@@ -10689,37 +10698,31 @@ nsDocShell::DoURILoad(nsIURI* aURI,
bool isSrcdoc = !aSrcdoc.IsVoid();
// 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.
// * Subframe load: requestingWindow is null, but requestingNode is the frame
// * Top-level load: In this case, loadingNode is null, but loadingWindow
// is our mScriptGlobal. We pass null for loadingPrincipal in this case.
// * Subframe load: loadingWindow is null, but loadingNode is the frame
// element for the load. loadingPrincipal is the NodePrincipal of the frame
// element.
nsCOMPtr<nsINode> requestingNode;
nsCOMPtr<nsPIDOMWindowOuter> requestingWindow;
nsCOMPtr<nsINode> loadingNode;
nsCOMPtr<nsPIDOMWindowOuter> loadingWindow;
nsCOMPtr<nsIPrincipal> loadingPrincipal;
requestingNode = mScriptGlobal->AsOuter()->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;
}
requestingWindow = mScriptGlobal->AsOuter();
if (mItemType != typeChrome) {
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
ssm->GetDocShellCodebasePrincipal(aURI, this, getter_AddRefs(loadingPrincipal));
if (aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) {
loadingNode = nullptr;
loadingPrincipal = nullptr;
loadingWindow = mScriptGlobal->AsOuter();
} else {
loadingWindow = nullptr;
loadingNode = mScriptGlobal->AsOuter()->GetFrameElementInternal();
if (loadingNode) {
// If we have a loading node, then use that as our loadingPrincipal.
loadingPrincipal = loadingNode->NodePrincipal();
} else {
// This is a top-level chrome load, use a system principal for the
// loadingPrincipal.
loadingPrincipal = nsContentUtils::GetSystemPrincipal();
// 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;
}
}
@@ -10727,6 +10730,10 @@ nsDocShell::DoURILoad(nsIURI* aURI,
// only inherit if we have a triggeringPrincipal
bool inherit = false;
// Get triggeringPrincipal. This code should be updated by bug 1181370.
// Until then, we cannot rely on the triggeringPrincipal for TYPE_DOCUMENT
// or TYPE_SUBDOCUMENT loads. Notice the triggeringPrincipal falls back to
// systemPrincipal below.
nsCOMPtr<nsIPrincipal> triggeringPrincipal = do_QueryInterface(aOwner);
if (triggeringPrincipal) {
inherit = nsContentUtils::ChannelShouldInheritPrincipal(
@@ -10750,13 +10757,24 @@ nsDocShell::DoURILoad(nsIURI* aURI,
securityFlags |= nsILoadInfo::SEC_SANDBOXED;
}
if (mInPrivateBrowsing) {
securityFlags |= nsILoadInfo::SEC_FORCE_PRIVATE_BROWSING;
}
RefPtr<LoadInfo> loadInfo =
requestingWindow ?
new LoadInfo(requestingWindow, loadingPrincipal, triggeringPrincipal,
(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) ?
new LoadInfo(loadingWindow, triggeringPrincipal,
securityFlags) :
new LoadInfo(loadingPrincipal, triggeringPrincipal, requestingNode,
new LoadInfo(loadingPrincipal, triggeringPrincipal, loadingNode,
securityFlags, aContentPolicyType);
// We have to do this in case our OriginAttributes are different from the
// OriginAttributes of the parent document. Or in case there isn't a
// parent document.
NeckoOriginAttributes neckoAttrs;
neckoAttrs.InheritFromDocShellToNecko(GetOriginAttributes());
loadInfo->SetOriginAttributes(neckoAttrs);
if (aIsFromProcessingFrameAttributes) {
loadInfo->SetIsFromProcessingFrameAttributes();
}
@@ -10784,6 +10802,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
}
return rv;
}
if (aBaseURI) {
nsCOMPtr<nsIViewSourceChannel> vsc = do_QueryInterface(channel);
if (vsc) {
@@ -11022,8 +11041,13 @@ nsDocShell::DoURILoad(nsIURI* aURI,
nsCOMPtr<nsITimedChannel> timedChannel(do_QueryInterface(channel));
if (timedChannel) {
timedChannel->SetTimingEnabled(true);
if (IsFrame()) {
timedChannel->SetInitiatorType(NS_LITERAL_STRING("subdocument"));
nsCOMPtr<nsPIDOMWindowOuter> win = GetWindow();
if (IsFrame() && win) {
nsCOMPtr<Element> frameElement = win->GetFrameElementInternal();
if (frameElement) {
timedChannel->SetInitiatorType(frameElement->LocalName());
}
}
}