[tor-commits] [tor-browser] 30/73: Bug 1781759 use media element node principal instead of channel loading principal for cross-origin resource test r=padenot a=RyanVM

gitolite role git at cupani.torproject.org
Wed Sep 21 20:17:23 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch geckoview-102.3.0esr-12.0-1
in repository tor-browser.

commit ba3564bcf0e5b8773ad04275f0ade02cbaaa5ef0
Author: Karl Tomlinson <karlt+ at karlt.net>
AuthorDate: Tue Aug 23 00:23:51 2022 +0000

    Bug 1781759 use media element node principal instead of channel loading principal for cross-origin resource test r=padenot a=RyanVM
    
    When the media resource is loaded as a document, the response from the initial
    document load gets reused, as an optimization, as an emulated load for the
    resource of the media host element in the generated HTML document.
    https://searchfox.org/mozilla-central/rev/5644fae86d5122519a0e34ee03117c88c6ed9b47/dom/html/VideoDocument.cpp#114
    https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-media
    The loadingPrincipal of the initial channel comes from the parent document,
    and so is not useful to determine whether the response is cross-origin with
    the media element.
    
    This change makes the cross-origin test on the initial document load
    consistent with subsequent requests on the same resource and non-document
    loads, which already use the node principal for the loadingPrincipal.
    https://searchfox.org/mozilla-central/rev/1061fae5e225a99ef5e43dbdf560a91a0c0d00d1/dom/media/ChannelMediaResource.cpp#750
    https://searchfox.org/mozilla-central/rev/4f2984be127d2e7c788cf1848d63dca63022beec/dom/html/HTMLMediaElement.cpp#1708
    
    Depends on D154039
    
    Differential Revision: https://phabricator.services.mozilla.com/D154040
---
 dom/media/ChannelMediaResource.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dom/media/ChannelMediaResource.cpp b/dom/media/ChannelMediaResource.cpp
index 7266998f60fc9..e0a44ab805d52 100644
--- a/dom/media/ChannelMediaResource.cpp
+++ b/dom/media/ChannelMediaResource.cpp
@@ -827,7 +827,7 @@ void ChannelMediaResource::UpdatePrincipal() {
         // media element, they are not considered opaque when verifying
         // network responses; they can be mixed with non-opaque responses from
         // subsequent loads on the same-origin finalURI.
-        !nsContentUtils::CheckMayLoad(loadInfo->GetLoadingPrincipal(), mChannel,
+        !nsContentUtils::CheckMayLoad(MediaElement()->NodePrincipal(), mChannel,
                                       /*allowIfInheritsPrincipal*/ true);
     if (!hadData) {  // First response with data
       mSharedInfo->mFinalResponsesAreOpaque = finalResponseIsOpaque;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list