зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 6 changesets (bug 1468817, bug 1467656, bug 1468824, bug 1468823, bug 1467542) for wpt mass failures on a CLOSED TREE
Backed out changeset 430a19ed4abb (bug 1468824) Backed out changeset 48c5051b0459 (bug 1468823) Backed out changeset 420221f34b31 (bug 1468817) Backed out changeset fc06c6dd1dad (bug 1467656) Backed out changeset d41449b85ea6 (bug 1467542) Backed out changeset 6aba20f105b0 (bug 1467542)
This commit is contained in:
Родитель
7aa70eced0
Коммит
8969d7bdf3
|
@ -9715,24 +9715,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/css-ui/cursor-pointer-links-001-manual.html": [
|
||||
[
|
||||
"/css/css-ui/cursor-pointer-links-001-manual.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-ui/cursor-pointer-links-002-manual.html": [
|
||||
[
|
||||
"/css/css-ui/cursor-pointer-links-002-manual.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-ui/cursor-pointer-links-003-manual.html": [
|
||||
[
|
||||
"/css/css-ui/cursor-pointer-links-003-manual.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-ui/cursor-text-001.html": [
|
||||
[
|
||||
"/css/css-ui/cursor-text-001.html",
|
||||
|
@ -288014,11 +287996,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"interfaces/css-fonts.idl": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"interfaces/css-typed-om.idl": [
|
||||
[
|
||||
{}
|
||||
|
@ -295154,12 +295131,7 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-read-contents.html": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-worker.js": [
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-mime-check-worker.js": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
|
@ -316619,12 +316591,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/css-fonts/idlharness.html": [
|
||||
[
|
||||
"/css/css-fonts/idlharness.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-fonts/test_datafont_same_origin.html": [
|
||||
[
|
||||
"/css/css-fonts/test_datafont_same_origin.html",
|
||||
|
@ -318359,12 +318325,6 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/css-multicol/filter-with-abspos.html": [
|
||||
[
|
||||
"/css/css-multicol/filter-with-abspos.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-multicol/going-out-of-flow-after-spanner.html": [
|
||||
[
|
||||
"/css/css-multicol/going-out-of-flow-after-spanner.html",
|
||||
|
@ -373481,9 +373441,9 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"service-workers/service-worker/fetch-request-css-cross-origin.https.html": [
|
||||
"service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https.html": [
|
||||
[
|
||||
"/service-workers/service-worker/fetch-request-css-cross-origin.https.html",
|
||||
"/service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
|
@ -508944,10 +508904,6 @@
|
|||
"d773f016699bcdcbe54f196118de13fbdbd60a69",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-fonts/idlharness.html": [
|
||||
"c8a4d33543cf5c9b77611c577116a71ca1ebfefb",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-fonts/language-specific-01.html": [
|
||||
"779c6c4875d44915e4c314acc028cc5ff21c4d42",
|
||||
"visual"
|
||||
|
@ -519336,10 +519292,6 @@
|
|||
"43a6f9e055b908a42b5811d6ce5e48acf8c9ed08",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-multicol/filter-with-abspos.html": [
|
||||
"099f4ae1562f9ba2908bfb8dfcb0a5c9afc8b423",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-multicol/float-and-block.html": [
|
||||
"435614e6d5dcdbd8325687f70014bea0e3dea5f7",
|
||||
"reftest"
|
||||
|
@ -538760,18 +538712,6 @@
|
|||
"9bcaa9b053c7f5a9d4db008cb2be1dfa13c90ab0",
|
||||
"manual"
|
||||
],
|
||||
"css/css-ui/cursor-pointer-links-001-manual.html": [
|
||||
"4d02ce48b672e22a2fdc9e9666c638c55d9c8209",
|
||||
"manual"
|
||||
],
|
||||
"css/css-ui/cursor-pointer-links-002-manual.html": [
|
||||
"651a5cdf4bc7fbd83f47a4fe6260da9b375f0e37",
|
||||
"manual"
|
||||
],
|
||||
"css/css-ui/cursor-pointer-links-003-manual.html": [
|
||||
"52d4b8e9637151738189c848071df7f32c2f8424",
|
||||
"manual"
|
||||
],
|
||||
"css/css-ui/cursor-text-001.html": [
|
||||
"f07e9bded7606975b35d4b9514043b4a80a59562",
|
||||
"manual"
|
||||
|
@ -588396,10 +588336,6 @@
|
|||
"a0d53cc4e88f38cce9fd45759963e5da9a6f3dc3",
|
||||
"support"
|
||||
],
|
||||
"interfaces/css-fonts.idl": [
|
||||
"ff2d83e9468c743993c9b4a1ecf3fab09684dc16",
|
||||
"support"
|
||||
],
|
||||
"interfaces/css-typed-om.idl": [
|
||||
"36526913c07a04f9fd329a5650430db82407d766",
|
||||
"support"
|
||||
|
@ -609680,8 +609616,8 @@
|
|||
"01a5220ff2abe5735d7b03c2ee3ccbe21c9a260e",
|
||||
"testharness"
|
||||
],
|
||||
"service-workers/service-worker/fetch-request-css-cross-origin.https.html": [
|
||||
"91ec6e3e7e56f20058cd32e97dad0d245eda7d79",
|
||||
"service-workers/service-worker/fetch-request-css-cross-origin-mime-check.https.html": [
|
||||
"d41f17b4a7ea596ba38a91cfbd910aa6be43e70f",
|
||||
"testharness"
|
||||
],
|
||||
"service-workers/service-worker/fetch-request-css-images.https.html": [
|
||||
|
@ -610465,7 +610401,7 @@
|
|||
"support"
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-mime-check-iframe.html": [
|
||||
"f014972c2230bd056c4b76e4a414c70e68477be9",
|
||||
"77fdb8a4bf48160dacb9b463fa075a91b1d34b10",
|
||||
"support"
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-mime-check-same.css": [
|
||||
|
@ -610476,12 +610412,8 @@
|
|||
"9770895a8ca9897a13b5f116e12b2b47dd59f009",
|
||||
"support"
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-read-contents.html": [
|
||||
"fcec3ece697564806719b32ca6144432f8216d9e",
|
||||
"support"
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-worker.js": [
|
||||
"20eaf7162096519d6811e4b5d513ca70fc46e8b6",
|
||||
"service-workers/service-worker/resources/fetch-request-css-cross-origin-mime-check-worker.js": [
|
||||
"5bdb78b2d188d06eea4a0243d7cf35c5542d868f",
|
||||
"support"
|
||||
],
|
||||
"service-workers/service-worker/resources/fetch-request-fallback-iframe.html": [
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[fetch-request-css-cross-origin.https.html]
|
||||
[Same-origin policy for access to CSS resources fetched via service worker]
|
||||
expected: FAIL
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<!doctype html>
|
||||
<title>css-fonts IDL tests</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
promise_test(async () => {
|
||||
const idl_array = new IdlArray();
|
||||
const idl = await fetch("/interfaces/css-fonts.idl").then(r => r.text());
|
||||
const cssom = await fetch("/interfaces/cssom.idl").then(r => r.text());
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(cssom);
|
||||
idl_array.test();
|
||||
}, "Test IDL implementation of css-fonts API");
|
||||
</script>
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Filtered block becomes containing block of absolutely positioned child</title>
|
||||
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
|
||||
<link rel="help" href="https://drafts.fxtf.org/filter-effects-1/#FilterProperty" title="5. Graphic filters: the filter property">
|
||||
<meta name="assert" content="A filtered block will be a containing block for absolutely positioned descendants. If all this takes place inside a multicol container, this means that the absolutely positioned box also has the multicol container in its containing block, which means that it should be fragmented.">
|
||||
<div id="multicol" style="columns:2;">
|
||||
<div id="container" style="height:100px;">
|
||||
<!-- The spanner is here to trigger the crash in crbug.com/847328 -->
|
||||
<div style="column-span:all;"></div>
|
||||
<div id="abspos" style="position:absolute; height:100px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let container = document.getElementById("container");
|
||||
let abspos = document.getElementById("abspos");
|
||||
document.body.offsetTop;
|
||||
assert_equals(abspos.getBoundingClientRect().height, 100);
|
||||
container.style.filter = "opacity(0.5)";
|
||||
assert_equals(abspos.getBoundingClientRect().height, 50);
|
||||
// The last step will cause a crash if crbug.com/847328 is present
|
||||
document.body.offsetTop;
|
||||
abspos.style.display = "none";
|
||||
}, "Making a container filtered, and then removing an abspos child");
|
||||
</script>
|
|
@ -1,16 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Basic User Interface Test: pointer cursor on svg links</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#cursor">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The pointer cursor is applied to SVG links">
|
||||
<style>
|
||||
</style>
|
||||
<body>
|
||||
<p>The test passes if, when moved over the blue text, the cursor indicates a link. Often rendered as the backside of a hand with the index finger poiting and the other fingers closed.</p>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<a xlink:href=""><text x="0" y="16" font-size="16" fill="blue">Hover me</text></a>
|
||||
</svg>
|
||||
</body>
|
|
@ -1,14 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Basic User Interface Test: pointer cursor on svg links</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#cursor">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The pointer cursor is applied to HTML links">
|
||||
<style>
|
||||
</style>
|
||||
<body>
|
||||
<p>The test passes if, when moved over the blue text, the cursor indicates a link. Often rendered as the backside of a hand with the index finger poiting and the other fingers closed.</p>
|
||||
<a href="" style="color: blue">Hover me</a>
|
||||
</body>
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Basic User Interface Test: pointer cursor on svg links</title>
|
||||
<link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-ui-4/#cursor">
|
||||
<meta name="flags" content="interact">
|
||||
<meta name="assert" content="The pointer cursor is applied to HTML image maps">
|
||||
<style>
|
||||
</style>
|
||||
<body>
|
||||
<p>The test passes if, when moved over the blue box, the cursor indicates a link. Often rendered as the backside of a hand with the index finger poiting and the other fingers closed.</p>
|
||||
<map name="m1"><area coords="0,0,100,100" href=""></map>
|
||||
<img usemap="#m1" src="../support/swatch-blue.png" alt="blue square" width=100 height=100>
|
||||
</body>
|
|
@ -1,35 +0,0 @@
|
|||
// GENERATED CONTENT - DO NOT EDIT
|
||||
// Content of this file was automatically extracted from the
|
||||
// "CSS Fonts Module Level 4" spec.
|
||||
// See: https://drafts.csswg.org/css-fonts-4/
|
||||
|
||||
[Exposed=Window]
|
||||
interface CSSFontFaceRule : CSSRule {
|
||||
readonly attribute CSSStyleDeclaration style;
|
||||
};
|
||||
|
||||
partial interface CSSRule { const unsigned short FONT_FEATURE_VALUES_RULE = 14;
|
||||
};
|
||||
interface CSSFontFeatureValuesRule : CSSRule { attribute CSSOMString fontFamily;
|
||||
readonly attribute CSSFontFeatureValuesMap annotation;
|
||||
readonly attribute CSSFontFeatureValuesMap ornaments;
|
||||
readonly attribute CSSFontFeatureValuesMap stylistic;
|
||||
readonly attribute CSSFontFeatureValuesMap swash;
|
||||
readonly attribute CSSFontFeatureValuesMap characterVariant;
|
||||
readonly attribute CSSFontFeatureValuesMap styleset;
|
||||
};
|
||||
|
||||
interface CSSFontFeatureValuesMap {
|
||||
maplike<CSSOMString, sequence<unsigned long>>;
|
||||
void set(CSSOMString featureValueName,
|
||||
(unsigned long or sequence<unsigned long>) values);
|
||||
};
|
||||
partial interface CSSRule {
|
||||
const unsigned short FONT_PALETTE_VALUES_RULE = 15;
|
||||
};
|
||||
|
||||
interface CSSFontPaletteValuesRule : CSSRule {
|
||||
maplike<unsigned long, (CSSOMString or CSSOMRGBColor)>;
|
||||
attribute CSSOMString fontFamily;
|
||||
attribute CSSOMString basePalette;
|
||||
};
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Service Worker: Mime type checking of CSS files fetched via SW.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script src="resources/test-helpers.sub.js"></script>
|
||||
<script>
|
||||
|
||||
function getElementColorInFrame(frame, id) {
|
||||
var element = frame.contentDocument.getElementById(id);
|
||||
var style = frame.contentWindow.getComputedStyle(element, '');
|
||||
return style['color'];
|
||||
}
|
||||
|
||||
promise_test(function(t) {
|
||||
var SCOPE =
|
||||
'resources/fetch-request-css-cross-origin-mime-check-iframe.html';
|
||||
var SCRIPT =
|
||||
'resources/fetch-request-css-cross-origin-mime-check-worker.js';
|
||||
var EXPECTED_COLOR = 'rgb(0, 0, 255)';
|
||||
|
||||
return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
|
||||
.then(r => wait_for_state(t, r.installing, 'activated'))
|
||||
.then(_ => with_iframe(SCOPE) )
|
||||
.then(f => {
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'crossOriginCss'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by cross origin CSS.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'crossOriginHtml'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must not be overridden by cross origin non CSS file.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'sameOriginCss'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by same origin CSS.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'sameOriginHtml'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by same origin non CSS file.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'synthetic'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by synthetic CSS.');
|
||||
f.remove();
|
||||
return service_worker_unregister_and_done(t, SCOPE);
|
||||
});
|
||||
}, 'Mime type checking of CSS files fetched via SW.');
|
||||
</script>
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Service Worker: Cross-origin CSS files fetched via SW.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script src="resources/test-helpers.sub.js"></script>
|
||||
<script>
|
||||
|
||||
function getElementColorInFrame(frame, id) {
|
||||
var element = frame.contentDocument.getElementById(id);
|
||||
var style = frame.contentWindow.getComputedStyle(element, '');
|
||||
return style['color'];
|
||||
}
|
||||
|
||||
promise_test(async t => {
|
||||
var SCOPE =
|
||||
'resources/fetch-request-css-cross-origin';
|
||||
var SCRIPT =
|
||||
'resources/fetch-request-css-cross-origin-worker.js';
|
||||
let registration = await service_worker_unregister_and_register(
|
||||
t, SCRIPT, SCOPE);
|
||||
promise_test(async t => {
|
||||
await registration.unregister();
|
||||
}, 'cleanup global state');
|
||||
|
||||
await wait_for_state(t, registration.installing, 'activated');
|
||||
}, 'setup global state');
|
||||
|
||||
promise_test(async t => {
|
||||
const EXPECTED_COLOR = 'rgb(0, 0, 255)';
|
||||
const PAGE =
|
||||
'resources/fetch-request-css-cross-origin-mime-check-iframe.html';
|
||||
|
||||
const f = await with_iframe(PAGE);
|
||||
t.add_cleanup(() => {f.remove(); });
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'crossOriginCss'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by cross origin CSS.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'crossOriginHtml'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must not be overridden by cross origin non CSS file.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'sameOriginCss'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by same origin CSS.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'sameOriginHtml'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by same origin non CSS file.');
|
||||
assert_equals(
|
||||
getElementColorInFrame(f, 'synthetic'),
|
||||
EXPECTED_COLOR,
|
||||
'The color must be overridden by synthetic CSS.');
|
||||
}, 'MIME checking of CSS resources fetched via service worker when Content-Type is not set.');
|
||||
|
||||
promise_test(async t => {
|
||||
const PAGE =
|
||||
'resources/fetch-request-css-cross-origin-read-contents.html';
|
||||
|
||||
const f = await with_iframe(PAGE);
|
||||
t.add_cleanup(() => {f.remove(); });
|
||||
assert_throws('SecurityError', () => {
|
||||
f.contentDocument.styleSheets[0].cssRules[0].cssText;
|
||||
});
|
||||
assert_equals(
|
||||
f.contentDocument.styleSheets[1].cssRules[0].cssText,
|
||||
'#crossOriginCss { color: blue; }',
|
||||
'cross-origin CORS approved response');
|
||||
assert_equals(
|
||||
f.contentDocument.styleSheets[2].cssRules[0].cssText,
|
||||
'#sameOriginCss { color: blue; }',
|
||||
'same-origin response');
|
||||
assert_equals(
|
||||
f.contentDocument.styleSheets[3].cssRules[0].cssText,
|
||||
'#synthetic { color: blue; }',
|
||||
'service worker generated response');
|
||||
}, 'Same-origin policy for access to CSS resources fetched via service worker');
|
||||
|
||||
</script>
|
|
@ -5,11 +5,11 @@
|
|||
#sameOriginHtml { color: red; }
|
||||
#synthetic { color: red; }
|
||||
</style>
|
||||
<link href="./cross-origin-css.css?mime=no" rel="stylesheet" type="text/css">
|
||||
<link href="./cross-origin-html.css?mime=no" rel="stylesheet" type="text/css">
|
||||
<link href="./cross-origin-css.css" rel="stylesheet" type="text/css">
|
||||
<link href="./cross-origin-html.css" rel="stylesheet" type="text/css">
|
||||
<link href="./fetch-request-css-cross-origin-mime-check-same.css" rel="stylesheet" type="text/css">
|
||||
<link href="./fetch-request-css-cross-origin-mime-check-same.html" rel="stylesheet" type="text/css">
|
||||
<link href="./synthetic.css?mime=no" rel="stylesheet" type="text/css">
|
||||
<link href="./synthetic.css" rel="stylesheet" type="text/css">
|
||||
<h1 id=crossOriginCss>I should be blue</h1>
|
||||
<h1 id=crossOriginHtml>I should be blue</h1>
|
||||
<h1 id=sameOriginCss>I should be blue</h1>
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
importScripts('/common/get-host-info.sub.js');
|
||||
importScripts('test-helpers.sub.js');
|
||||
|
||||
self.addEventListener('fetch', function(event) {
|
||||
if (event.request.url.indexOf('cross-origin-css.css') != -1) {
|
||||
event.respondWith(fetch(
|
||||
get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
|
||||
'fetch-request-css-cross-origin-mime-check-cross.css',
|
||||
{mode: 'no-cors'}));
|
||||
} else if (event.request.url.indexOf('cross-origin-html.css') != -1) {
|
||||
event.respondWith(fetch(
|
||||
get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
|
||||
'fetch-request-css-cross-origin-mime-check-cross.html',
|
||||
{mode: 'no-cors'}));
|
||||
} else if (event.request.url.indexOf('synthetic.css') != -1) {
|
||||
event.respondWith(new Response("#synthetic { color: blue; }"));
|
||||
} else {
|
||||
event.respondWith(fetch(event.request));
|
||||
}
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>iframe: cross-origin CSS via service worker</title>
|
||||
|
||||
<!-- Service worker responds with a cross-origin opaque response. -->
|
||||
<link href="cross-origin-css.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Service worker responds with a cross-origin CORS approved response. -->
|
||||
<link href="cross-origin-css.css?cors" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Service worker falls back to network. This is a same-origin response. -->
|
||||
<link href="fetch-request-css-cross-origin-mime-check-same.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Service worker responds with a new Response() synthetic response. -->
|
||||
<link href="synthetic.css" rel="stylesheet" type="text/css">
|
|
@ -1,65 +0,0 @@
|
|||
importScripts('/common/get-host-info.sub.js');
|
||||
importScripts('test-helpers.sub.js');
|
||||
|
||||
const HOST_INFO = get_host_info();
|
||||
const REMOTE_ORIGIN = HOST_INFO.HTTPS_REMOTE_ORIGIN;
|
||||
const BASE_PATH = base_path();
|
||||
const CSS_FILE = 'fetch-request-css-cross-origin-mime-check-cross.css';
|
||||
const HTML_FILE = 'fetch-request-css-cross-origin-mime-check-cross.html';
|
||||
|
||||
function add_pipe_header(url_str, header) {
|
||||
if (url_str.indexOf('?pipe=') == -1) {
|
||||
url_str += '?pipe=';
|
||||
} else {
|
||||
url_str += '|';
|
||||
}
|
||||
url_str += `header${header}`;
|
||||
return url_str;
|
||||
}
|
||||
|
||||
self.addEventListener('fetch', function(event) {
|
||||
const url = new URL(event.request.url);
|
||||
|
||||
const use_mime =
|
||||
(url.searchParams.get('mime') != 'no');
|
||||
const mime_header = '(Content-Type, text/css)';
|
||||
|
||||
const use_cors =
|
||||
(url.searchParams.has('cors'));
|
||||
const cors_header = '(Access-Control-Allow-Origin, *)';
|
||||
|
||||
const file = url.pathname.substring(url.pathname.lastIndexOf('/') + 1);
|
||||
|
||||
// Respond with a cross-origin CSS resource, using CORS if desired.
|
||||
if (file == 'cross-origin-css.css') {
|
||||
let fetch_url = REMOTE_ORIGIN + BASE_PATH + CSS_FILE;
|
||||
if (use_mime)
|
||||
fetch_url = add_pipe_header(fetch_url, mime_header);
|
||||
if (use_cors)
|
||||
fetch_url = add_pipe_header(fetch_url, cors_header);
|
||||
const mode = use_cors ? 'cors' : 'no-cors';
|
||||
event.respondWith(fetch(fetch_url, {'mode': mode}));
|
||||
return;
|
||||
}
|
||||
|
||||
// Respond with a cross-origin CSS resource with an HTML name. This is only
|
||||
// used in the MIME sniffing test, so MIME is never added.
|
||||
if (file == 'cross-origin-html.css') {
|
||||
const fetch_url = REMOTE_ORIGIN + BASE_PATH + HTML_FILE;
|
||||
event.respondWith(fetch(fetch_url, {mode: 'no-cors'}));
|
||||
return;
|
||||
}
|
||||
|
||||
// Respond with synthetic CSS.
|
||||
if (file == 'synthetic.css') {
|
||||
let headers = {};
|
||||
if (use_mime) {
|
||||
headers['Content-Type'] = 'text/css';
|
||||
}
|
||||
|
||||
event.respondWith(new Response("#synthetic { color: blue; }", {headers}));
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, fallback to network.
|
||||
});
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
import os
|
||||
from threading import Lock
|
||||
|
||||
from collections import defaultdict, Mapping
|
||||
|
||||
|
@ -73,6 +74,8 @@ class Config(Mapping):
|
|||
self.log_level = level_name
|
||||
self._logger_name = logger.name
|
||||
|
||||
self._ports_lock = Lock()
|
||||
|
||||
for k, v in self._default.iteritems():
|
||||
setattr(self, k, kwargs.pop(k, v))
|
||||
|
||||
|
@ -137,31 +140,38 @@ class Config(Mapping):
|
|||
|
||||
@property
|
||||
def ports(self):
|
||||
# To make this method thread-safe, we write to a temporary dict first,
|
||||
# and change self._computed_ports to the new dict at last atomically.
|
||||
new_ports = defaultdict(list)
|
||||
with self._ports_lock:
|
||||
try:
|
||||
old_ports = self._computed_ports
|
||||
except AttributeError:
|
||||
old_ports = {}
|
||||
|
||||
try:
|
||||
old_ports = self._computed_ports
|
||||
except AttributeError:
|
||||
old_ports = {}
|
||||
self._computed_ports = defaultdict(list)
|
||||
|
||||
for scheme, ports in self._ports.iteritems():
|
||||
for i, port in enumerate(ports):
|
||||
if scheme in ["wss", "https"] and not self.ssl_env.ssl_enabled:
|
||||
port = None
|
||||
if port == "auto":
|
||||
try:
|
||||
port = old_ports[scheme][i]
|
||||
except (KeyError, IndexError):
|
||||
port = get_port(self.server_host)
|
||||
else:
|
||||
port = port
|
||||
new_ports[scheme].append(port)
|
||||
for scheme, ports in self._ports.iteritems():
|
||||
for i, port in enumerate(ports):
|
||||
if scheme in ["wss", "https"] and not self.ssl_env.ssl_enabled:
|
||||
port = None
|
||||
if port == "auto":
|
||||
try:
|
||||
port = old_ports[scheme][i]
|
||||
except (KeyError, IndexError):
|
||||
port = get_port(self.server_host)
|
||||
else:
|
||||
port = port
|
||||
self._computed_ports[scheme].append(port)
|
||||
|
||||
self._computed_ports = new_ports
|
||||
return self._computed_ports
|
||||
|
||||
def __getstate__(self):
|
||||
state = self.__dict__
|
||||
del state["_ports_lock"]
|
||||
return state
|
||||
|
||||
def __setstate__(self, state):
|
||||
state["_ports_lock"] = Lock()
|
||||
self.__dict__ = state
|
||||
|
||||
@ports.setter
|
||||
def ports(self, v):
|
||||
self._ports = v
|
||||
|
|
Загрузка…
Ссылка в новой задаче