Skip to content

Commit 553ecf8

Browse files
mikewestmoz-wptsync-bot
authored andcommitted
Bug 2002039 [wpt PR 56226] - [Origin API] Drop Location and WorkerLocation conversions., a=testonly
Automatic update from web-platform-tests [Origin API] Drop `Location` and `WorkerLocation` conversions. After discussion with Anne in [1], it makes sense to drop conversions from `Location` and `WorkerLocation` objects via `Origin.from()`. Those can meaningfully differ from the origin of the context to which they belong due to sandboxing, and we should encourage developers to use the right `Origin` representation going forward. [1]: whatwg/html#11846 (comment) Bug: 434131026 Change-Id: Ie8101ac9743767a32c109b83bdc82c9bb715d3b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7186344 Reviewed-by: Antonio Sartori <[email protected]> Commit-Queue: Mike West <[email protected]> Cr-Commit-Position: refs/heads/main@{#1549657} -- wpt-commits: a4373b8773f810610565b04c79a289da9150bde1 wpt-pr: 56226
1 parent 2830975 commit 553ecf8

File tree

2 files changed

+24
-40
lines changed

2 files changed

+24
-40
lines changed

testing/web-platform/tests/html/browsers/origin/tentative/api/origin-from-location.window.js

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,8 @@
22
// META: script=/common/get-host-info.sub.js
33

44
test(t => {
5-
const origin = Origin.from(window.location);
6-
assert_true(!!origin);
7-
assert_false(origin.opaque);
8-
assert_true(origin.isSameOrigin(Origin.from(get_host_info().ORIGIN)));
9-
}, `Origin.from(window.location) returns a tuple origin.`);
10-
11-
async_test(t => {
12-
const el = document.createElement('iframe');
13-
el.src = "/common/blank.html";
14-
el.onload = t.step_func_done(_ => {
15-
const origin = Origin.from(el.contentWindow.location);
16-
assert_true(!!origin);
17-
assert_false(origin.opaque);
18-
assert_true(origin.isSameOrigin(Origin.from(get_host_info().ORIGIN)));
19-
});
20-
document.body.appendChild(el);
21-
}, `Origin.from(Location) returns a tuple origin for same-origin frames.`);
5+
assert_throws_js(TypeError, _ => Origin.from(window.location));
6+
}, `Origin.from(window.location) throws.`);
227

238
async_test(t => {
249
const el = document.createElement('iframe');
@@ -28,26 +13,3 @@ async_test(t => {
2813
});
2914
document.body.appendChild(el);
3015
}, `Origin.from(Location) throws for cross-origin frames.`);
31-
32-
async_test(t => {
33-
const w = window.open("/html/browsers/windows/resources/post-to-opener.html");
34-
window.addEventListener("message", t.step_func(e => {
35-
if (e.source === w) {
36-
const origin = Origin.from(w.location);
37-
assert_true(!!origin);
38-
assert_false(origin.opaque);
39-
assert_true(origin.isSameOrigin(Origin.from(get_host_info().ORIGIN)));
40-
t.done();
41-
}
42-
}));
43-
}, `Origin.from(Location) returns a tuple origin for same-origin windows.`);
44-
45-
async_test(t => {
46-
const w = window.open(get_host_info().REMOTE_ORIGIN + "/html/browsers/windows/resources/post-to-opener.html");
47-
window.addEventListener("message", t.step_func(e => {
48-
if (e.source === w) {
49-
assert_throws_js(TypeError, _ => Origin.from(w.location));
50-
t.done();
51-
}
52-
}));
53-
}, `Origin.from(Location) throws for cross-origin windows.`);

testing/web-platform/tests/webnn/conformance_tests/tensor.https.any.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,28 @@ const testDispatchTensor = (testName) => {
13301330
mlContext, outputTensor,
13311331
new Float32Array(sizeOfShape(shape)).fill(1.0));
13321332
}, `${testName} / same constant multiple graphs`);
1333+
1334+
promise_test(async () => {
1335+
// Construct a simple graph: OUTPUT = IDENTITY(INPUT) to test whether the default
1336+
// tensor is initialized to zero.
1337+
const builder = new MLGraphBuilder(mlContext);
1338+
const inputOperand = builder.input('input', {dataType: 'int32', shape: [1024]});
1339+
const graph = await builder.build({'output': builder.identity(inputOperand)});
1340+
1341+
const inputTensor = await mlContext.createTensor({
1342+
dataType: inputOperand.dataType,
1343+
shape: inputOperand.shape
1344+
});
1345+
1346+
const outputTensor = await mlContext.createTensor({
1347+
dataType: inputOperand.dataType,
1348+
shape: inputOperand.shape,
1349+
readable: true
1350+
});
1351+
1352+
mlContext.dispatch(graph, {'input': inputTensor}, {'output': outputTensor});
1353+
await assert_tensor_data_equals(mlContext, outputTensor, new Uint32Array(1024));
1354+
}, `${testName} / default tensor uninitialized`);
13331355
};
13341356

13351357
/**

0 commit comments

Comments
 (0)