forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1828375 - Do gradual ORB transition. r=sefeng,necko-reviewers
Add a separate check for spec breaking allows of certain MIME types. Having this separated out means that we can make the rest of the implementation behave exactly like spec. Some tradeoffs that we need in the current state are: * Allowing "application/dash+xml" * Allowing "application/vnd.apple.mpegurl" * Allowing "text/vtt" * Allow all MIME types beginning with "audio/mpeg" * Allow "text/plain" when there is a no-sniff header. Differential Revision: https://phabricator.services.mozilla.com/D176821
- Loading branch information
Showing
8 changed files
with
107 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
testing/web-platform/meta/fetch/corb/img-mime-types-coverage.tentative.sub.html.ini
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
testing/web-platform/meta/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[img-mime-types-coverage.tentative.sub.html] | ||
[ORB should block the response if Content-Type is: 'application/dash+xml'. ] | ||
expected: FAIL | ||
|
||
[ORB should block the response if Content-Type is: 'application/vnd.apple.mpegurl'. ] | ||
expected: FAIL | ||
|
||
[ORB should block the response if Content-Type is: 'audio/mpegurl'. ] | ||
expected: FAIL | ||
|
||
[ORB should block the response if Content-Type is: 'text/vtt'. ] | ||
expected: FAIL |
43 changes: 43 additions & 0 deletions
43
...web-platform/mozilla/tests/fetch/orb/tentative/img-mime-types-coverage.tentative.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!-- Test verifies that cross-origin, nosniff images are 1) blocked when their | ||
MIME type is covered by ORB and 2) allowed otherwise. | ||
This test is very similar to fetch/orb/img-mime-types-coverage.tentative.sub.html, | ||
except that it focuses on MIME types relevant to ORB. | ||
--> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<div id=log></div> | ||
<script> | ||
var passes = [ | ||
// These are exceptions that allow more MIME types than the ORB spec does. | ||
// This is due to web compat, but might be removed in the future. | ||
// See Bug 1828375 | ||
"application/dash+xml", | ||
"application/vnd.apple.mpegurl", | ||
"audio/mpegurl", | ||
"audio/mpeg", | ||
"text/vtt", | ||
] | ||
|
||
const get_url = (mime) => { | ||
// www1 is cross-origin, so the HTTP response is ORB-eligible --> | ||
url = "http://{{domains[www1]}}:{{ports[http][0]}}" | ||
url = url + "/fetch/nosniff/resources/image.py" | ||
if (mime != null) { | ||
url += "?type=" + encodeURIComponent(mime) | ||
} | ||
return url | ||
} | ||
|
||
passes.forEach(function (mime) { | ||
async_test(function (t) { | ||
var img = document.createElement("img") | ||
img.onerror = t.unreached_func("Unexpected error event") | ||
img.onload = t.step_func_done(function () { | ||
assert_equals(img.width, 96) | ||
}) | ||
img.src = get_url(mime) | ||
document.body.appendChild(img) | ||
}, "ORB should allow the response if Content-Type is: '" + mime + "'. ") | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters