Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'left' and 'right' for 'clear' property animation. #4676

Merged
merged 8 commits into from Jan 31, 2017
Merged
3 changes: 2 additions & 1 deletion XMLHttpRequest/resources/corsenabled.py
Expand Up @@ -5,7 +5,7 @@ def main(request, response):
("Access-Control-Allow-Credentials", "true"),
("Access-Control-Allow-Methods", "GET, POST, PUT, FOO"),
("Access-Control-Allow-Headers", "x-test, x-foo"),
("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length")]
("Access-Control-Expose-Headers", "x-request-method, x-request-content-type, x-request-query, x-request-content-length, x-request-data")]

if "delay" in request.GET:
delay = int(request.GET.first("delay"))
Expand All @@ -15,5 +15,6 @@ def main(request, response):
headers.append(("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"))
headers.append(("X-Request-Content-Length", request.headers.get("Content-Length", "NO")))
headers.append(("X-Request-Content-Type", request.headers.get("Content-Type", "NO")))
headers.append(("X-Request-Data", request.body))

return headers, "Test"
48 changes: 40 additions & 8 deletions XMLHttpRequest/send-redirect-to-cors.htm
Expand Up @@ -9,28 +9,60 @@
<body>
<div id="log"></div>
<script>
function redirect(code) {
function extractBody(body) {
if (body === null) {
return { body: "", type: "NO" };
}

if (typeof body == "string") {
return { body: body, type: "text/plain;charset=UTF-8" };
}

if (body instanceof Uint8Array) {
var arr = Array.prototype.slice.call(body);
return { body: String.fromCharCode.apply(null, arr), type: "NO" }
}

return { body: "EXTRACT NOT IMPLEMENTED",
type: "EXTRACT NOT IMPLEMENTED" }
}

function redirect(code, method = "GET", body = null, setExplicitType = true) {
var test = async_test(document.title + " (" + code + ")")
test.step(function() {
var client = new XMLHttpRequest()
client.onreadystatechange = function() {
test.step(function() {
if(client.readyState == 4) {
assert_equals(client.getResponseHeader("x-request-method"), "GET")
assert_equals(client.getResponseHeader("x-request-content-type"), "application/x-pony")
test.done()
if (client.readyState == 4) {
assert_equals(client.status, 200);
assert_equals(client.getResponseHeader("x-request-method"),
method);
var { body: expectedBody, type: expectedType } = extractBody(body);
if (setExplicitType) {
expectedType = "application/x-pony";
}
assert_equals(client.getResponseHeader("x-request-content-type"),
expectedType);
assert_equals(client.getResponseHeader("x-request-data"),
expectedBody);
test.done();
}
})
}
client.open("GET", "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+"&code=" + code)
client.setRequestHeader("Content-Type", "application/x-pony")
client.send(null)
client.open(method, "resources/redirect.py?location="+encodeURIComponent("http://www2."+location.host+(location.pathname.replace(/[^\/]+$/, ''))+'resources/corsenabled.py')+"&code=" + code)
if (setExplicitType) {
client.setRequestHeader("Content-Type", "application/x-pony")
}
client.send(body)
})
}
redirect("301")
redirect("302")
redirect("303")
redirect("307")
redirect("307", "POST", null, false);
redirect("307", "POST", "hello", false);
redirect("307", "POST", new Uint8Array([65, 66, 67]), false);
</script>
</body>
</html>
Expand Up @@ -40,6 +40,6 @@ <h1>Description</h1>
</ul>
</p>

<iframe id="frameContext" onload="onload_test();" src="http://www.apple.com" style="width: 250px; height: 250px;"></iframe>
<iframe id="frameContext" onload="onload_test();" src="{{location[scheme]}}://{{domains[www2]}}:{{ports[http][0]}}/common/blank.html" style="width: 250px; height: 250px;"></iframe>
</body>
</html>
6 changes: 3 additions & 3 deletions referrer-policy/generic/common.js
Expand Up @@ -111,7 +111,7 @@ function queryIframe(url, callback, referrer_policy) {
window.addEventListener("message", listener);
}

function queryImage(url, callback, attributes, referrerPolicy) {
function queryImage(url, callback, attributes, referrerPolicy, test) {
// For images, we'll test:
// - images in a `srcdoc` frame to ensure that it uses the referrer
// policy of its parent,
Expand Down Expand Up @@ -152,11 +152,11 @@ function queryImage(url, callback, attributes, referrerPolicy) {
}, attributes, window);
});

Promise.all([noSrcDocPolicy, srcDocPolicy, pagePolicy]).then(values => {
Promise.all([noSrcDocPolicy, srcDocPolicy, pagePolicy]).then(test.step_func(values => {
assert_equals(values[0].headers.referer, values[2].headers.referer, "Referrer inside 'srcdoc' without its own policy should be the same as embedder's referrer.");
assert_equals((iframePolicy === "no-referrer" ? undefined : document.location.href), values[1].headers.referer, "Referrer inside 'srcdoc' should use the iframe's policy if it has one");
callback(wrapResult(url, values[2]), url);
});
}));
}

function queryXhr(url, callback) {
Expand Down
10 changes: 6 additions & 4 deletions referrer-policy/generic/referrer-policy-test-case.js
Expand Up @@ -70,7 +70,7 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
t._expectedReferrerUrl = referrerUrlResolver[t._scenario.referrer_url]();
},

_invokeSubresource: function(callback) {
_invokeSubresource: function(callback, test) {
var invoker = subresourceInvoker[t._scenario.subresource];

// Depending on the delivery method, extend the subresource element with
Expand All @@ -85,9 +85,11 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
if (delivery_method in elementAttributesForDeliveryMethod) {
invoker(t._subresourceUrl,
callback,
elementAttributesForDeliveryMethod[delivery_method], t._scenario.referrer_policy);
elementAttributesForDeliveryMethod[delivery_method],
t._scenario.referrer_policy,
test);
} else {
invoker(t._subresourceUrl, callback, null, t._scenario.referrer_policy);
invoker(t._subresourceUrl, callback, null, t._scenario.referrer_policy, test);
}

},
Expand Down Expand Up @@ -116,7 +118,7 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
}, "Reported Referrer URL is as expected: " + t._scenario.referrer_url);

test.done();
})
}, test);

}
}
Expand Down
Expand Up @@ -73,6 +73,9 @@
async_test(msg_event_test.bind(this, 'current-extension-expired-different-task'),
'Test calling waitUntil after the current extension expired in a different task fails');

async_test(msg_event_test.bind(this, 'script-extendable-event'),
'Test calling waitUntil on a script constructed ExtendableEvent throws exception');

async_test(function(t) {
var testBody = function(worker) {
return with_iframe('./resources/pending-respondwith-async-waituntil/dummy.html');
Expand Down
Expand Up @@ -110,7 +110,8 @@
frame.src =
scope + '?mode=cors&url=' +
encodeURIComponent(host_info['HTTPS_REMOTE_ORIGIN'] + path +
'?ACAOrigin=' + host_info['HTTPS_ORIGIN']);
'?ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true');
document.body.appendChild(frame);
return getLoadedFrameAsObject(frame);
})
Expand Down Expand Up @@ -183,7 +184,8 @@
var win = window.open(
scope + '?mode=cors&url=' +
encodeURIComponent(host_info['HTTPS_REMOTE_ORIGIN'] + path +
'?ACAOrigin=' + host_info['HTTPS_ORIGIN']));
'?ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true'));
return getLoadedWindowAsObject(win);
})
.then(function(result) {
Expand Down