Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into sri-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
metromoxie committed Jun 17, 2015
2 parents e04aa8d + b287bcf commit 2717ed0
Show file tree
Hide file tree
Showing 2,372 changed files with 98,339 additions and 20,261 deletions.
Expand Up @@ -18,12 +18,13 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// 2 arguments, the dest origin is 0,0
// The source canvas will copied to the 0,0 position of the destination canvas
destCtx.drawImage(sourceImg, 0, 0);

sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// 2 arguments, the dest origin is 0,0
// The source canvas will copied to the 0,0 position of the destination canvas
destCtx.drawImage(sourceImg, 0, 0);
}
</script>
23 changes: 12 additions & 11 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html
Expand Up @@ -18,16 +18,17 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// The destination rectangle is larger than the destination canvas.
// When the destination rectangle is outside the destination image (the scratch bitmap),
// the pixels that land outside the scratch bitmap are discarded,
// as if the destination was an infinite canvas
// whose rendering was clipped to the dimensions of the scratch bitmap.
destCtx.drawImage(sourceImg, 0, 0, 512, 512, 0, 0, 256, 256);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// The destination rectangle is larger than the destination canvas.
// When the destination rectangle is outside the destination image (the scratch bitmap),
// the pixels that land outside the scratch bitmap are discarded,
// as if the destination was an infinite canvas
// whose rendering was clipped to the dimensions of the scratch bitmap.
destCtx.drawImage(sourceImg, 0, 0, 512, 512, 0, 0, 256, 256);
}
</script>
Expand Up @@ -18,14 +18,15 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// The source rectangle is larger than the source canvas
// The source area is clipped to fit the source image
// and the destination are is clipped in the same proportion
destCtx.drawImage(sourceImg, 0, 0, 2048, 2048, 0, 0, 800, 800);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// The source rectangle is larger than the source canvas
// The source area is clipped to fit the source image
// and the destination are is clipped in the same proportion
destCtx.drawImage(sourceImg, 0, 0, 2048, 2048, 0, 0, 800, 800);
}
</script>
Expand Up @@ -18,14 +18,15 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// Negative coordinates of the source rectangle
// The source area is clipped to fit the source image
// and the destination area is clipped in the same proportion
destCtx.drawImage(sourceImg, -25, -25, 50, 50, 0, 0, 50, 50);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// Negative coordinates of the source rectangle
// The source area is clipped to fit the source image
// and the destination area is clipped in the same proportion
destCtx.drawImage(sourceImg, -25, -25, 50, 50, 0, 0, 50, 50);
}
</script>
Expand Up @@ -18,13 +18,14 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// 2 arguments, the dest origin is not 0,0
// The source image will copied to the 25, 25 position of the destination canvas
destCtx.drawImage(sourceImg, 25, 25);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// 2 arguments, the dest origin is not 0,0
// The source image will copied to the 25, 25 position of the destination canvas
destCtx.drawImage(sourceImg, 25, 25);
}
</script>
19 changes: 10 additions & 9 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html
Expand Up @@ -18,13 +18,14 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// 4 arguments, the source origin is not 0,0, the dest size is provided
// The source canvas will copied to the 50, 50 position of the destination canvas and
// on an area of 50x50 pixels
destCtx.drawImage(sourceImg, 50, 50, 50, 50);

sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// 4 arguments, the source origin is not 0,0, the dest size is provided
// The source canvas will copied to the 50, 50 position of the destination canvas and
// on an area of 50x50 pixels
destCtx.drawImage(sourceImg, 50, 50, 50, 50);
}
</script>
21 changes: 11 additions & 10 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html
Expand Up @@ -18,14 +18,15 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// 4 arguments, the dest origin is not 0,0 and the dest size is provided but
// does not match the size of the source. The image will be distorted
// The source canvas will copied to the 50,50 position of the destination canvas
// and it will be shrunk to a and area of 16x16
destCtx.drawImage(sourceImg, 50, 50, 16, 16);

sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// 4 arguments, the dest origin is not 0,0 and the dest size is provided but
// does not match the size of the source. The image will be distorted
// The source canvas will copied to the 50,50 position of the destination canvas
// and it will be shrunk to a and area of 16x16
destCtx.drawImage(sourceImg, 50, 50, 16, 16);
}
</script>
19 changes: 10 additions & 9 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html
Expand Up @@ -18,13 +18,14 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// The source canvas will copied to the 50,50 position of the destination canvas
// over an area of 64x32 pixels
// The copied image will be distorted along the x axis
destCtx.drawImage(sourceImg, 50, 50, 64, 32);

sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;
// The source canvas will copied to the 50,50 position of the destination canvas
// over an area of 64x32 pixels
// The copied image will be distorted along the x axis
destCtx.drawImage(sourceImg, 50, 50, 64, 32);
}
</script>
19 changes: 10 additions & 9 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html
Expand Up @@ -18,14 +18,15 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// 8 arguments, both destination and source origins are 0, 0
// An area of 32x32 pixels of the source image will be copied to
// an area of 32x32 pixels of the destination canvas
destCtx.drawImage(sourceImg, 0, 0, 32, 32, 0, 0, 32, 32);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// 8 arguments, both destination and source origins are 0, 0
// An area of 32x32 pixels of the source image will be copied to
// an area of 32x32 pixels of the destination canvas
destCtx.drawImage(sourceImg, 0, 0, 32, 32, 0, 0, 32, 32);
}
</script>
19 changes: 10 additions & 9 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html
Expand Up @@ -18,14 +18,15 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// 8 arguments the destination origin is not 0,0
// An area of 32x32 pixels of the source image will be copied to
// an area of 32x32 pixels of the destination canvas in the position 32,32
destCtx.drawImage(sourceImg, 0, 0, 32, 32, 32, 32, 32, 32);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// 8 arguments the destination origin is not 0,0
// An area of 32x32 pixels of the source image will be copied to
// an area of 32x32 pixels of the destination canvas in the position 32,32
destCtx.drawImage(sourceImg, 0, 0, 32, 32, 32, 32, 32, 32);
}
</script>
19 changes: 10 additions & 9 deletions 2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html
Expand Up @@ -18,14 +18,15 @@
sourceImg.width = sourceWidth;
sourceImg.height = sourceHeight;

var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// The source rectangle overflows the source image
// The source area is clipped to fit the source image
// and the destination are is clipped in the same proportion
destCtx.drawImage(sourceImg, 32, 32, 32, 32, 0, 0, 32, 32);
sourceImg.onload = function() {
var destCtx = destCanvas.getContext('2d');
destCtx.fillStyle = "#FF0000";
destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
destCtx.imageSmoothingEnabled = smoothingEnabled;

// The source rectangle overflows the source image
// The source area is clipped to fit the source image
// and the destination are is clipped in the same proportion
destCtx.drawImage(sourceImg, 32, 32, 32, 32, 0, 0, 32, 32);
}
</script>
25 changes: 18 additions & 7 deletions README.md
Expand Up @@ -172,18 +172,29 @@ The way to contribute is just as usual:
* Commit locally and push that to your repo.
* Send in a pull request based on the above.

A lint is available to test for common mistakes in testcases. It can
be run with:
Lint tool
---------

We have a lint tool for catching common mistakes in test files. You
can run it manually by starting the `lint` executable from the root of
your local web-platform-tests working directory like this:

```
./lint
```

in the root of the checkout. It is also run for every submitted pull
request, and branches with lint errors will not get merged. In the
unusual case that the lint is reporting an error for something that is
essential to your test, there is a whitelist at
`tools/lint/lint.whitelist` that may be updated.
The lint tool is also run automatically for every submitted pull
request, and reviewers will not merge branches with tests that have
lint errors, so you must fix any errors the lint tool reports. For
details on doing that, see the [lint-tool documentation][lint-tool].

But in the unusual case of error reports for things essential to a
certain test or that for other exceptional reasons shouldn't prevent
a merge of a test, update and commit the `lint.whitelist` file in the
web-platform-tests root directory to suppress the error reports. For
details on doing that, see the [lint-tool documentation][lint-tool].

[lint-tool]: https://github.com/w3c/web-platform-tests/blob/master/docs/lint-tool.md

Adding command-line scripts ("tools" subdirs)
---------------------------------------------
Expand Down
8 changes: 7 additions & 1 deletion XMLHttpRequest/send-entity-body-get-head-async.htm
Expand Up @@ -23,7 +23,13 @@
client.upload.addEventListener('loadstart', logEvt)
client.addEventListener('loadend', function(){
test.step(function(){
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
if (method === "HEAD") {
// Fetch 4.4.3 --- Set Content-Length to 0 if method is HEAD and
// request's body is null.
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
} else {
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
}
assert_equals(client.getResponseHeader("x-request-method"), method)
assert_equals(client.responseText, "")
assert_array_equals(events, [])
Expand Down
9 changes: 8 additions & 1 deletion XMLHttpRequest/send-entity-body-get-head.htm
Expand Up @@ -22,7 +22,14 @@
client.upload.addEventListener('progress', logEvt)
client.upload.addEventListener('loadend', logEvt)
client.upload.addEventListener('loadstart', logEvt)
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")

if (method === "HEAD") {
// Fetch 4.4.3 --- Set Content-Length to 0 if method is HEAD and
// request's body is null.
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
} else {
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
}
assert_equals(client.getResponseHeader("x-request-method"), method)
assert_equals(client.responseText, "")
assert_array_equals(events, [])
Expand Down
1 change: 0 additions & 1 deletion XMLHttpRequest/send-usp.worker.js
@@ -1,5 +1,4 @@
importScripts("/resources/testharness.js");
importScripts("/resources/testharnessreport.js");
importScripts("send-usp.js");
run_test();
done();
1 change: 1 addition & 0 deletions ambient-light/idlharness.html
Expand Up @@ -15,6 +15,7 @@
<div id="log"></div>

<pre id="untested_idl">
[PrimaryGlobal]
interface Window {
};

Expand Down
3 changes: 2 additions & 1 deletion animation-timing/idlharness.html
Expand Up @@ -7,14 +7,15 @@
<link rel="help" href="http://www.w3.org/TR/animation-timing/#definitions"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/webidl2/lib/webidl2.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<h1>idlharness test</h1>
<p>This test validates the WebIDL included in the Timing control for script-based animations specification.</p>

<pre id='untested_idl' style='display:none'>
[PrimaryGlobal]
interface Window {
};
</pre>
Expand Down
5 changes: 4 additions & 1 deletion config.default.json
@@ -1,8 +1,11 @@
{"host": "web-platform.test",
"doc_root": null,
"ws_doc_root": null,
"external_host": null,
"ports":{"http":[8000, "auto"],
"https":[8443],
"ws":["auto"]},
"ws":["auto"],
"wss":["auto"]},
"check_subdomains": true,
"log_level":"debug",
"bind_hostname": true,
Expand Down
3 changes: 3 additions & 0 deletions content-security-policy/generic/fail-0_1.js
@@ -0,0 +1,3 @@
(function () {
scriptsrc1.step(function() { assert_unreached('Unsafe inline script ran.') });
})();

0 comments on commit 2717ed0

Please sign in to comment.