mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-14 03:07:31 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
1
testing/web-platform/tests/cors/resources/.gitignore
vendored
Normal file
1
testing/web-platform/tests/cors/resources/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
logs.txt
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
def main(request, response):
|
||||
token = request.GET.first("token")
|
||||
if request.server.stash.remove(token) is not None:
|
||||
return "1"
|
||||
else:
|
||||
return "0"
|
||||
21
testing/web-platform/tests/cors/resources/cors-cookie.py
Normal file
21
testing/web-platform/tests/cors/resources/cors-cookie.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
def main(request, response):
|
||||
origin = request.GET.first("origin", request.headers["origin"])
|
||||
credentials = request.GET.first("credentials", "true")
|
||||
|
||||
headers = [("Content-Type", "text/plain")]
|
||||
if origin != 'none':
|
||||
headers.append(("Access-Control-Allow-Origin", origin))
|
||||
if credentials != 'none':
|
||||
headers.append(("Access-Control-Allow-Credentials", credentials))
|
||||
|
||||
ident = request.GET.first('ident', 'test')
|
||||
|
||||
if ident in request.cookies:
|
||||
body = request.cookies[ident].value
|
||||
response.delete_cookie(ident)
|
||||
else:
|
||||
response.set_cookie(ident, "COOKIE");
|
||||
body = "NO_COOKIE"
|
||||
|
||||
return headers, body
|
||||
24
testing/web-platform/tests/cors/resources/cors-headers.asis
Normal file
24
testing/web-platform/tests/cors/resources/cors-headers.asis
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
HTTP/1.1 200 OK
|
||||
Access-Control-Allow-Origin: *
|
||||
Access-Control-Expose-Headers: X-Custom-Header, X-Custom-Header-Empty, X-Custom-Header-Comma, X-Custom-Header-Bytes
|
||||
Access-Control-Expose-Headers: X-Second-Expose
|
||||
Access-Control-Expose-Headers: Date
|
||||
Content-Type: text/plain
|
||||
X-Custom-Header: test
|
||||
X-Custom-Header: test
|
||||
Set-Cookie: test1=t1;max-age=2
|
||||
Set-Cookie2: test2=t2;Max-Age=2
|
||||
X-Custom-Header-Empty:
|
||||
X-Custom-Header-Comma: 1
|
||||
X-Custom-Header-Comma: 2
|
||||
X-Custom-Header-Bytes: …
|
||||
X-Nonexposed: unicorn
|
||||
X-Second-Expose: flyingpig
|
||||
Cache-Control: no-cache
|
||||
Content-Language: nn
|
||||
Expires: Thu, 01 Dec 1994 16:00:00 GMT
|
||||
Last-Modified: Thu, 01 Dec 1994 10:00:00 GMT
|
||||
Pragma: no-cache
|
||||
Date: Wed, 22 Oct 2013 10:00:00 GMT
|
||||
|
||||
TEST
|
||||
67
testing/web-platform/tests/cors/resources/cors-makeheader.py
Normal file
67
testing/web-platform/tests/cors/resources/cors-makeheader.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import json
|
||||
|
||||
def main(request, response):
|
||||
origin = request.GET.first("origin", request.headers.get('origin'))
|
||||
|
||||
if "check" in request.GET:
|
||||
token = request.GET.first("token")
|
||||
value = request.server.stash.take(token)
|
||||
if value is not None:
|
||||
if request.GET.first("check", None) == "keep":
|
||||
request.server.stash.put(token, value)
|
||||
body = "1"
|
||||
else:
|
||||
body = "0"
|
||||
return [("Content-Type", "text/plain")], body
|
||||
|
||||
|
||||
if origin != 'none':
|
||||
response.headers.set("Access-Control-Allow-Origin", origin)
|
||||
if 'origin2' in request.GET:
|
||||
response.headers.append("Access-Control-Allow-Origin", request.GET.first('origin2'))
|
||||
|
||||
#Preflight
|
||||
if 'headers' in request.GET:
|
||||
response.headers.set("Access-Control-Allow-Headers", request.GET.first('headers'))
|
||||
if 'credentials' in request.GET:
|
||||
response.headers.set("Access-Control-Allow-Credentials", request.GET.first('credentials'))
|
||||
if 'methods' in request.GET:
|
||||
response.headers.set("Access-Control-Allow-Methods", request.GET.first('methods'))
|
||||
|
||||
code_raw = request.GET.first('code', None)
|
||||
if code_raw:
|
||||
code = int(code_raw)
|
||||
else:
|
||||
code = None
|
||||
if request.method == 'OPTIONS':
|
||||
#Override the response code if we're in a preflight and it's asked
|
||||
if 'preflight' in request.GET:
|
||||
code = int(request.GET.first('preflight'))
|
||||
|
||||
#Log that the preflight actually happened if we have an ident
|
||||
if 'token' in request.GET:
|
||||
request.server.stash.put(request.GET['token'], True)
|
||||
|
||||
if 'location' in request.GET:
|
||||
if code is None:
|
||||
code = 302
|
||||
|
||||
if code >= 300 and code < 400:
|
||||
response.headers.set("Location", request.GET.first('location'))
|
||||
|
||||
headers = {}
|
||||
for name, values in request.headers.iteritems():
|
||||
if len(values) == 1:
|
||||
headers[name] = values[0]
|
||||
else:
|
||||
#I have no idea, really
|
||||
headers[name] = values
|
||||
|
||||
headers['get_value'] = request.GET.first('get_value', '')
|
||||
|
||||
body = json.dumps(headers)
|
||||
|
||||
if code:
|
||||
return (code, "StatusText"), [], body
|
||||
else:
|
||||
return body
|
||||
35
testing/web-platform/tests/cors/resources/preflight.py
Normal file
35
testing/web-platform/tests/cors/resources/preflight.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/plain")]
|
||||
|
||||
if "check" in request.GET:
|
||||
token = request.GET.first("token")
|
||||
value = request.server.stash.take(token)
|
||||
if value == None:
|
||||
body = "0"
|
||||
else:
|
||||
if request.GET.first("check", None) == "keep":
|
||||
request.server.stash.put(token, value)
|
||||
body = "1"
|
||||
|
||||
return headers, body
|
||||
|
||||
if request.method == "OPTIONS":
|
||||
if not "Access-Control-Request-Method" in request.headers:
|
||||
response.set_error(400, "No Access-Control-Request-Method header")
|
||||
return "ERROR: No access-control-request-method in preflight!"
|
||||
|
||||
headers.append(("Access-Control-Allow-Methods",
|
||||
request.headers['Access-Control-Request-Method']))
|
||||
|
||||
if "max_age" in request.GET:
|
||||
headers.append(("Access-Control-Max-Age", request.GET['max_age']))
|
||||
|
||||
if "token" in request.GET:
|
||||
request.server.stash.put(request.GET.first("token"), 1)
|
||||
|
||||
headers.append(("Access-Control-Allow-Origin", "*"))
|
||||
headers.append(("Access-Control-Allow-Headers", "x-print"))
|
||||
|
||||
body = request.headers.get("x-print", "NO")
|
||||
|
||||
return headers, body
|
||||
28
testing/web-platform/tests/cors/resources/remote-xhrer.html
Normal file
28
testing/web-platform/tests/cors/resources/remote-xhrer.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<!doctype html>
|
||||
<title>Child helper</title>
|
||||
|
||||
<script>
|
||||
window.addEventListener("message", function(e) {
|
||||
// e.source.postMessage(e.data, e.origin);
|
||||
|
||||
var client = new XMLHttpRequest();
|
||||
var localurl = e.data.url
|
||||
.replace("<host>", location.host)
|
||||
.replace("<protocol>", location.protocol);
|
||||
|
||||
client.open('GET', localurl, true);
|
||||
client.onload = function() {
|
||||
e.data.state = "load";
|
||||
e.data.response = client.response;
|
||||
e.source.postMessage(e.data, e.origin);
|
||||
}
|
||||
client.onerror = function() {
|
||||
e.data.state = "error";
|
||||
e.data.response = client.response;
|
||||
e.source.postMessage(e.data, e.origin);
|
||||
}
|
||||
client.send();
|
||||
});
|
||||
</script>
|
||||
|
||||
The remote window
|
||||
37
testing/web-platform/tests/cors/resources/status.py
Normal file
37
testing/web-platform/tests/cors/resources/status.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
def main(request, response):
|
||||
response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin") )
|
||||
response.headers.set("Access-Control-Expose-Headers", "X-Request-Method")
|
||||
|
||||
if request.method == 'OPTIONS':
|
||||
response.headers.set("Access-Control-Allow-Methods", "GET, CHICKEN, HEAD, POST, PUT")
|
||||
|
||||
if 'headers' in request.GET:
|
||||
response.headers.set("Access-Control-Allow-Headers", request.GET.first('headers'))
|
||||
|
||||
response.headers.set("X-Request-Method", request.method)
|
||||
|
||||
response.headers.set("X-A-C-Request-Method", request.headers.get("Access-Control-Request-Method", ""));
|
||||
|
||||
|
||||
#This should reasonably work for most response codes.
|
||||
try:
|
||||
code = int(request.GET.first("code", 200))
|
||||
except ValueError:
|
||||
code = 200
|
||||
|
||||
text = request.GET.first("text", "OMG")
|
||||
|
||||
if request.method == "OPTIONS" and "preflight" in request.GET:
|
||||
try:
|
||||
code = int(request.GET.first('preflight'))
|
||||
except KeyError, ValueError:
|
||||
pass
|
||||
|
||||
status = code, text
|
||||
|
||||
if "type" in request.GET:
|
||||
response.headers.set("Content-Type", request.GET.first('type'))
|
||||
|
||||
body = request.GET.first('content', "")
|
||||
|
||||
return status, [], body
|
||||
Loading…
Add table
Add a link
Reference in a new issue