import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,104 @@
# Copyright (c) 2016 W3C
# Released under the W3C Test Suite License: see LICENSE.txt
# This tool creates .html test files for the WPT harness from corresponding .test
# files that it finds in the tree for this test collection.
import re
import time
import json
import fnmatch
import os
import shutil
import sys
import argparse
TESTTREE = '..'
DEFDIR = '../definitions'
MANUAL_TEMPLATE = 'template_manual'
JS_TEMPLATE = 'template_js'
parser = argparse.ArgumentParser()
parser.add_argument('--examples', action="store_const", const=1)
args = parser.parse_args()
# pull in the template
manualTemplate = open(MANUAL_TEMPLATE, "r").read()
autoTemplate = open(JS_TEMPLATE, "r").read()
defList = []
defnames = ""
# find all of the definitions
for curdir, subdirList, fileList in os.walk(DEFDIR, topdown=True):
for file in fnmatch.filter(fileList, "*.json"):
theFile = os.path.join(curdir, file)
try:
testJSON = json.load(open(theFile, "r"))
except ValueError as e:
print "parse of " + theFile + " failed: " + e[0]
else:
theFile = re.sub("\.\./", "", theFile)
defList.append(theFile)
if (len(defList)):
defNames = '"' + '",\n "'.join(defList) + '"'
# iterate over the folders looking for .test files
for curdir, subdirList, fileList in os.walk(TESTTREE, topdown=True):
# skip the definitions directory
subdirList[:] = [d for d in subdirList if d != "definitions"]
# skip the examples directory
if args.examples != 1:
subdirList[:] = [d for d in subdirList if d != "examples"]
for file in fnmatch.filter(fileList, "*.test"):
# for each .test file, create a corresponding .html file using the appropriate
# template
theFile = os.path.join(curdir, file)
try:
testJSON = json.load(open(theFile, "r"))
except ValueError as e:
print "parse of " + theFile + " failed: " + e[0]
else:
try:
testType = testJSON['testType']
except:
testType = "manual"
templateFile = manualTemplate
suffix = "-manual.html"
if testType == "automated":
templateFile = autoTemplate
suffix = ".html"
rfile = re.sub("\.\./", "", file)
# interesting pattern is {{TESTFILE}}
tcopy = re.sub("{{TESTFILE}}", rfile, templateFile)
tcopy = re.sub("{{SCHEMADEFS}}", defNames, tcopy)
try:
title = testJSON['name']
except:
title = file
tcopy = re.sub("{{TESTTITLE}}", title, tcopy)
# target file is basename of theFile + '-manual.html'
target = re.sub("\.test",suffix, theFile)
try:
out = open(target, "w")
out.write(tcopy)
out.close()
except:
print("Failed to create "+target)
else:
print("Created " + target)

View file

@ -0,0 +1,7 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno1",
"type": "Annotation",
"body": "http://example.org/post1",
"target": "http://example.com/page1"
}

View file

@ -0,0 +1,19 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno10",
"type": "Annotation",
"body": {
"type": "Choice",
"items": [
{
"id": "http://example.org/note1",
"language": "en"
},
{
"id": "http://example.org/note2",
"language": "fr"
}
]
},
"target": "http://example.org/website1"
}

View file

@ -0,0 +1,18 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno11",
"type": "Annotation",
"motivation": "commenting",
"body": {
"type": "TextualBody",
"value": "These pages together provide evidence of the conspiracy"
},
"target": {
"type": "Composite",
"items": [
"http://example.com/page1",
"http://example.org/page6",
"http://example.net/page4"
]
}
}

View file

@ -0,0 +1,19 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno12",
"type": "Annotation",
"motivation": "tagging",
"body": {
"type": "TextualBody",
"value": "important"
},
"target": {
"type": "List",
"items": [
"http://example.com/book/page1",
"http://example.com/book/page2",
"http://example.com/book/page3",
"http://example.com/book/page4"
]
}
}

View file

@ -0,0 +1,16 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno13",
"type": "Annotation",
"motivation": "classifying",
"body": "http://example.org/vocab/art/portrait",
"target": {
"type": "Independents",
"items": [
"http://example.com/image1",
"http://example.net/image2",
"http://example.com/image4",
"http://example.org/image9"
]
}
}

View file

@ -0,0 +1,16 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno14",
"type": "Annotation",
"creator": "http://example.org/user1",
"created": "2015-01-28T12:00:00Z",
"modified": "2015-01-29T09:00:00Z",
"generator": "http://example.org/client1",
"generated": "2015-02-04T12:00:00Z",
"body": {
"id": "http://example.net/review1",
"creator": "http://example.net/user2",
"created": "2014-06-02T17:00:00Z"
},
"target": "http://example.com/restaurant1"
}

View file

@ -0,0 +1,20 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno15",
"type": "Annotation",
"creator": {
"id": "http://example.org/user1",
"type": "Person",
"name": "My Pseudonym",
"nickname": "pseudo",
"email_sha1": "58bad08927902ff9307b621c54716dcc5083e339"
},
"generator": {
"id": "http://example.org/client1",
"type": "Software",
"name": "Code v2.1",
"homepage": "http://example.org/client1/homepage1"
},
"body": "http://example.net/review1",
"target": "http://example.com/restaurant1"
}

View file

@ -0,0 +1,12 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno16",
"type": "Annotation",
"audience": {
"id": "http://example.edu/roles/teacher",
"type": "schema:EducationalAudience",
"schema:educationalRole": "teacher"
},
"body": "http://example.net/classnotes1",
"target": "http://example.com/textbook1"
}

View file

@ -0,0 +1,12 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno17",
"type": "Annotation",
"motivation": "commenting",
"body": "http://example.net/comment1",
"target": {
"id": "http://example.com/video1",
"type": "Video",
"accessibility": "captions"
}
}

View file

@ -0,0 +1,19 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno18",
"type": "Annotation",
"motivation": "bookmarking",
"body": [
{
"type": "TextualBody",
"value": "readme",
"purpose": "tagging"
},
{
"type": "TextualBody",
"value": "A good description of the topic that bears further investigation",
"purpose": "describing"
}
],
"target": "http://example.com/page1"
}

View file

@ -0,0 +1,11 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno19",
"type": "Annotation",
"rights": "https://creativecommons.org/publicdomain/zero/1.0/",
"body": {
"id": "http://example.net/review1",
"rights": "http://creativecommons.org/licenses/by-nc/4.0/"
},
"target": "http://example.com/product1"
}

View file

@ -0,0 +1,17 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno2",
"type": "Annotation",
"body": {
"id": "http://example.org/analysis1.mp3",
"format": "audio/mpeg",
"language": "fr"
},
"target": {
"id": "http://example.gov/patent1.pdf",
"format": "application/pdf",
"language": ["en", "ar"],
"textDirection": "ltr",
"processingLanguage": "en"
}
}

View file

@ -0,0 +1,12 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno20",
"type": "Annotation",
"canonical": "urn:uuid:dbfb1861-0ecf-41ad-be94-a584e5c4f1df",
"via": "http://other.example.org/anno1",
"body": {
"id": "http://example.net/review1",
"rights": "http://creativecommons.org/licenses/by/4.0/"
},
"target": "http://example.com/product1"
}

View file

@ -0,0 +1,13 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno3",
"type": "Annotation",
"body": {
"id": "http://example.org/video1",
"type": "Video"
},
"target": {
"id": "http://example.org/website1",
"type": "Text"
}
}

View file

@ -0,0 +1,11 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno4",
"type": "Annotation",
"body": "http://example.org/description1",
"target": {
"id": "http://example.com/image1#xywh=100,100,300,300",
"type": "Image",
"format": "image/jpeg"
}
}

View file

@ -0,0 +1,12 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno5",
"type":"Annotation",
"body": {
"type" : "TextualBody",
"value" : "<p>j'adore !</p>",
"format" : "text/html",
"language" : "fr"
},
"target": "http://example.org/photo1"
}

View file

@ -0,0 +1,7 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno6",
"type":"Annotation",
"bodyValue": "Comment text",
"target": "http://example.org/target1"
}

View file

@ -0,0 +1,11 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno7",
"type":"Annotation",
"body": {
"type": "TextualBody",
"value": "Comment text",
"format": "text/plain"
},
"target": "http://example.org/target1"
}

View file

@ -0,0 +1,6 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno8",
"type": "Annotation",
"target": "http://example.org/ebook1"
}

View file

@ -0,0 +1,16 @@
{
"@context": "http://www.w3.org/ns/anno.jsonld",
"id": "http://example.org/anno9",
"type": "Annotation",
"body": [
"http://example.org/description1",
{
"type": "TextualBody",
"value": "tag1"
}
],
"target": [
"http://example.org/image1",
"http://example.org/image2"
]
}

View file

@ -0,0 +1,37 @@
<!doctype html>
<html>
<head>
<title>{{TESTTITLE}}</title>
<link rel="stylesheet" href="/resources/testharness.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/annotation-model/scripts/ajv.min.js"></script>
<script src="/annotation-model/scripts/JSONtest.js"></script>
<script>
setup( { explicit_done: true } );
var theDefinitions=[
{{SCHEMADEFS}}
];
var theTestFile="{{TESTFILE}}";
var runningTest = new JSONtest( {
"schemaDefs" : theDefinitions,
"testFile" : theTestFile
} ) ;
var c;
runningTest.Promise.then(function(test) {
test.runTests(test.Assertions, test.Test.content);
done();
});
</script>
</head>
<body>
<div id="testDescription"></div>
<p>The following assertions are being evaluated:</p>
<div id="assertion"></div>
</body>
</html>

View file

@ -0,0 +1,43 @@
<!doctype html>
<html>
<head>
<title>{{TESTTITLE}}</title>
<link rel="stylesheet" href="/resources/testharness.css">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/annotation-model/scripts/ajv.min.js"></script>
<script src="/annotation-model/scripts/showdown.min.js"></script>
<script src="/annotation-model/scripts/JSONtest.js"></script>
<script>
setup({explicit_timeout: true, explicit_done: true });
var theDefinitions=[
{{SCHEMADEFS}}
];
var theTestFile="{{TESTFILE}}";
var runningTest = new JSONtest( {
"testInput" : "annotation-input",
"runTest" : "annotation-run",
"closeWindow" : "annotation-close",
"schemaDefs" : theDefinitions,
"testFile" : theTestFile
} ) ;
</script>
</head>
<body>
<p>Fill the textarea below with JSON output from your annotation client
implementation that supports the following criteria:</p>
<div id="testDescription"></div>
<form name="annotation" id="annotation">
<textarea name="annotation-input" id="annotation-input" style="width: 90%; height: 10em" ></textarea>
<p><input type="button" id="annotation-run" name="Loading..." value="Loading...">
<input style="display: none" type="button" id="annotation-close"
name="Close" value="Close"></p>
</form>
<p>Specifically, the following assertions will be evaluated:</p>
<div id="assertion"></div>
</body>
</html>

View file

@ -0,0 +1,10 @@
Tree to Test the Tests
======================
This folder is meant to contain a collection of .jsonld files that mirror the
structure of the top level folders and subfolders with .test files. A script
(@@@TODO@@@) will walk this tree, taking each folder and running it through the
corresponding .test file to ensure that the test is working as expected. An
argument to that script will report on any .jsonld files that do not have a
corresponding .test file, and vice versa.