Backed out changeset f46a712edf7e (bug 1147668) for assertion failures in test_access_control.html CLOSED TREE

This commit is contained in:
Wes Kocher 2015-06-16 14:48:15 -07:00
parent f45cfb1d2d
commit 3ae1cac20c
7 changed files with 15 additions and 30 deletions

View File

@ -152,15 +152,9 @@ InternalRequest::MapContentPolicyTypeToRequestContext(nsContentPolicyType aConte
case nsIContentPolicy::TYPE_FONT:
context = RequestContext::Font;
break;
case nsIContentPolicy::TYPE_INTERNAL_AUDIO:
case nsIContentPolicy::TYPE_MEDIA:
context = RequestContext::Audio;
break;
case nsIContentPolicy::TYPE_INTERNAL_VIDEO:
context = RequestContext::Video;
break;
case nsIContentPolicy::TYPE_INTERNAL_TRACK:
context = RequestContext::Track;
break;
case nsIContentPolicy::TYPE_WEBSOCKET:
context = RequestContext::Internal;
break;

View File

@ -30,7 +30,7 @@ namespace dom {
*
* RequestContext | nsContentPolicyType
* ------------------+--------------------
* audio | TYPE_INTERNAL_AUDIO
* audio | TYPE_MEDIA
* beacon | TYPE_BEACON
* cspreport | TYPE_CSP_REPORT
* download |
@ -57,14 +57,15 @@ namespace dom {
* sharedworker |
* subresource | Not supported by Gecko
* style | TYPE_STYLESHEET
* track | TYPE_INTERNAL_TRACK
* video | TYPE_INTERNAL_VIDEO
* track | TYPE_MEDIA
* video | TYPE_MEDIA
* worker |
* xmlhttprequest | TYPE_XMLHTTPREQUEST
* xslt | TYPE_XSLT
*
* TODO: Figure out if TYPE_REFRESH maps to anything useful
* TODO: Figure out if TYPE_DTD maps to anything useful
* TODO: Split TYPE_MEDIA into TYPE_AUDIO, TYPE_VIDEO and TYPE_TRACK
* TODO: Split TYPE_XMLHTTPREQUEST and TYPE_DATAREQUEST for EventSource
* TODO: Figure out if TYPE_WEBSOCKET maps to anything useful
* TODO: Differentiate between frame and iframe

View File

@ -1150,12 +1150,8 @@ nsresult HTMLMediaElement::LoadResource()
return NS_ERROR_FAILURE;
}
MOZ_ASSERT(IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
nsContentPolicyType contentPolicyType = IsHTMLElement(nsGkAtoms::audio) ?
nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
nsresult rv = NS_CheckContentLoadPolicy(contentPolicyType,
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
mLoadingSrc,
NodePrincipal(),
static_cast<Element*>(this),
@ -1233,7 +1229,7 @@ nsresult HTMLMediaElement::LoadResource()
mLoadingSrc,
static_cast<Element*>(this),
securityFlags,
contentPolicyType,
nsIContentPolicy::TYPE_MEDIA,
loadGroup,
nullptr, // aCallbacks
nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE_IF_BUSY |

View File

@ -209,7 +209,7 @@ HTMLTrackElement::LoadResource()
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_INTERNAL_TRACK,
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_MEDIA,
uri,
NodePrincipal(),
static_cast<Element*>(this),
@ -236,7 +236,7 @@ HTMLTrackElement::LoadResource()
uri,
static_cast<Element*>(this),
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_INTERNAL_TRACK,
nsIContentPolicy::TYPE_MEDIA,
loadGroup);
NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv));

View File

@ -891,15 +891,11 @@ ChannelMediaResource::RecreateChannel()
securityFlags = nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
}
MOZ_ASSERT(element->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
nsContentPolicyType contentPolicyType = element->IsHTMLElement(nsGkAtoms::audio) ?
nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
nsresult rv = NS_NewChannel(getter_AddRefs(mChannel),
mURI,
element,
securityFlags,
contentPolicyType,
nsIContentPolicy::TYPE_MEDIA,
loadGroup,
nullptr, // aCallbacks
loadFlags);
@ -1422,17 +1418,13 @@ already_AddRefed<MediaResource> FileMediaResource::CloneData(MediaDecoder* aDeco
securityFlags = nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
}
MOZ_ASSERT(element->IsAnyOfHTMLElements(nsGkAtoms::audio, nsGkAtoms::video));
nsContentPolicyType contentPolicyType = element->IsHTMLElement(nsGkAtoms::audio) ?
nsIContentPolicy::TYPE_INTERNAL_AUDIO : nsIContentPolicy::TYPE_INTERNAL_VIDEO;
nsCOMPtr<nsIChannel> channel;
nsresult rv =
NS_NewChannel(getter_AddRefs(channel),
mURI,
element,
securityFlags,
contentPolicyType,
nsIContentPolicy::TYPE_MEDIA,
loadGroup);
if (NS_FAILED(rv))

View File

@ -24,7 +24,8 @@ self.addEventListener("fetch", function(event) {
event.respondWith(fetch("realaudio.ogg"));
}
} else if (event.request.url.indexOf("video.ogg") >= 0) {
if (event.request.context == "video") {
// FIXME: Bug 1147668: This should be "video".
if (event.request.context == "audio") {
event.respondWith(fetch("realaudio.ogg"));
}
} else if (event.request.url.indexOf("beacon.sjs") >= 0) {

View File

@ -303,7 +303,8 @@
document.documentElement.appendChild(video);
navigator.serviceWorker.addEventListener("message", function onMessage(e) {
if (e.data.data == "track") {
is(e.data.context, "track", "Expected the track context on a request coming from a track");
// FIXME: Bug 1147668: This should be "track".
is(e.data.context, "audio", "Expected the audio context on a request coming from a track");
navigator.serviceWorker.removeEventListener("message", onMessage);
resolve();
}