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

Test [[CanBlock]] in various agents #5569

Merged
merged 2 commits into from
Apr 26, 2017
Merged

Test [[CanBlock]] in various agents #5569

merged 2 commits into from
Apr 26, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Apr 14, 2017

Follows whatwg/html#2521. This downgrades the resources submodule due to #5568 which prevents these tests (and many, many other tests in WPT) from working.

FYI @binji @mtrofin on the Blink side, @lars-t-hansen on the Gecko side. Failures:

Worklets are not tested at this time due to spec uncertainty.


This change is Reviewable

@domenic domenic requested a review from annevk April 14, 2017 21:43
@wpt-pr-bot
Copy link
Collaborator

Notifying @jdm, @jgraham, @zcorpan, and @zqzhang. (Learn how reviewing works.)

@ghost
Copy link

ghost commented Apr 14, 2017

View the complete job log.

Lint

Passed

@ghost
Copy link

ghost commented Apr 14, 2017

View the complete job log.

Firefox (nightly channel)

Testing web-platform-tests at revision c83536c
Using browser at version BuildID 20170425101537; SourceStamp a30dc237c3a600a5231f2974fc2b85dfb5513414
Starting 10 test iterations
All results were stable

All results

4 tests ran
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html
Subtest Results Messages
OK
[[CanBlock]] in a DedicatedWorkerGlobalScope PASS {}
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html
Subtest Results Messages
OK
Service worker test setup PASS
[[CanBlock]] in a ServiceWorkerGlobalScope PASS {}
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html
Subtest Results Messages
OK
[[CanBlock]] in a SharedWorkerGlobalScope FAIL waiting is not allowed on this thread
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html
Subtest Results Messages
OK
[[CanBlock]] in a similar-origin window agent PASS

@ghost
Copy link

ghost commented Apr 14, 2017

View the complete job log.

Chrome (unstable channel)

Testing web-platform-tests at revision c83536c
Using browser at version 59.0.3071.25 dev
Starting 10 test iterations
All results were stable

All results

4 tests ran
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-dedicatedworker.html
Subtest Results Messages
OK
[[CanBlock]] in a DedicatedWorkerGlobalScope FAIL SharedArrayBuffer is not defined
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-serviceworker.https.html
Subtest Results Messages
OK
Service worker test setup PASS
[[CanBlock]] in a ServiceWorkerGlobalScope FAIL SharedArrayBuffer is not defined
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-sharedworker.html
Subtest Results Messages
OK
[[CanBlock]] in a SharedWorkerGlobalScope FAIL SharedArrayBuffer is not defined
/html/webappapis/scripting/processing-model-2/integration-with-the-javascript-agent-formalism/canblock-window.html
Subtest Results Messages
OK
[[CanBlock]] in a similar-origin window agent FAIL Uncaught ReferenceError: SharedArrayBuffer is not defined

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay in general, but I wish we could annotate these tests somehow for removal if we ever get proper test262 integration going.

Also, should the .js resources be in a resources directory? It's never clear to me what the convention is there, if anything.

const ta = new Int32Array(sab);

// Test passes if this doesn't throw
Atomics.wait(ta, 0, 0, 10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we assert the return value to be "ok"?

@domenic
Copy link
Member Author

domenic commented Apr 17, 2017

@binji @lars-t-hansen can you help get this test passing? It seems that in a dedicated worker, in both Chrome and Firefox, the following code gives "timed-out" instead of "ok":

"use strict";
importScripts("/resources/testharness.js");

test(() => {
  const sab = new SharedArrayBuffer(16);
  const ta = new Int32Array(sab);

  assert_equals(Atomics.wait(ta, 0, 0, 10), "ok");
}, `[[CanBlock]] in a ${self.constructor.name}`);

done();

Presumably this is me not understanding something about SABs/Atomics.wait.

However this test passes in Chrome in shared workers, somehow.

@syg
Copy link
Contributor

syg commented Apr 18, 2017

@domenic Atomics.wait would return "ok" if it's explicitly woken by Atomics.wake. Is there something that's waking it?

@domenic
Copy link
Member Author

domenic commented Apr 18, 2017

Oh, I thought it would return "ok" if the value successfully became the target value (which it already is). So "timed-out" is correct? Any suggestions for a better test?

Is it a Chrome bug that it returns "ok" in shared workers?

@syg
Copy link
Contributor

syg commented Apr 18, 2017

@domenic "timed-out" is fine here, I think, if the point is that it doesn't throw. BTW if the TA value isn't equal to the supplied value, you get "not-equal".

@binji
Copy link
Contributor

binji commented Apr 18, 2017

Hm, I'm not sure why this test would return "ok" in any context, it should either timeout or throw, as syg mentioned.

@lars-t-hansen
Copy link
Contributor

What @syg said. Additionally, observe that [[CanBlock]] is tested early so (a) a timeout of 0 is fine here, and you should still get "timed-out"; or (b) leaving off the timeout while first setting ta[0]=1 so that you get "not-equal" is also a valid test of [[CanBlock]].

@domenic
Copy link
Member Author

domenic commented Apr 19, 2017

Thanks for the help all. I just updated the test to require "timed-out". Chrome seems to be passing now; I'm not sure what was going on there locally, but maybe I had an old version of the test open or something and was being caught out by shared workers being... shared... between tabs.

annevk added a commit to whatwg/html that referenced this pull request Apr 25, 2017
Define the infrastructure for SharedArrayBuffer. This also clarifies
along which boundaries a browser implementation can use processes and
threads.

Tests: web-platform-tests/wpt#5569.

Follow-up to define similar-origin window agents upon a less shaky
foundation is #2528. Because of that, similar-origin window agents
are the best place to store state that would formerly go on unit of
related similar-origin browsing contexts.

tc39/ecma262#882 is follow-up to define
agents in more detail; in particular make their implicit realms slot
explicit. w3c/css-houdini-drafts#224 is
follow-up to define worklet ownership better which is needed to
define how they relate to agent (sub)clusters.

Fixes part of #2260. Fixes #851. Fixes
w3c/ServiceWorker#1115. Fixes most of
w3c/css-houdini-drafts#380 (no tests and no
nice grouping of multiple realms in a single agent as that is not
needed).
@annevk
Copy link
Member

annevk commented Apr 26, 2017

Since service workers require HTTPS I renamed the resource to include .https. I believe that's the correct thing to do.

domenic and others added 2 commits April 26, 2017 11:42
Follows whatwg/html#2521.

Worklets are not tested at this time as their API is still in flux.
annevk added a commit to whatwg/html that referenced this pull request Apr 26, 2017
Define the infrastructure for SharedArrayBuffer. This also clarifies
along which boundaries a browser implementation can use processes and
threads.

Tests: web-platform-tests/wpt#5569.

Follow-up to define similar-origin window agents upon a less shaky
foundation is #2528. Because of that, similar-origin window agents
are the best place to store state that would formerly go on unit of
related similar-origin browsing contexts.

Follow-up for better agent shutdown notifications: #2581.

tc39/ecma262#882 is follow-up to define
agents in more detail; in particular make their implicit realms slot
explicit. w3c/css-houdini-drafts#224 is
follow-up to define worklet ownership better which is needed to
define how they relate to agent (sub)clusters.

Fixes part of #2260. Fixes #851. Fixes
w3c/ServiceWorker#1115. Fixes most of
w3c/css-houdini-drafts#380 (no tests and no
nice grouping of multiple realms in a single agent as that is not
needed).
@annevk
Copy link
Member

annevk commented Apr 26, 2017

I had to force push because I had to rebase to get past the failing Chrome bot that was disabled by a newer commit. I'll let someone else double check before landing.

See whatwg/html#2521 (comment) for the browser bug analysis. Led to one bug against Firefox.

@domenic domenic merged commit 9667929 into master Apr 26, 2017
@domenic domenic deleted the canblock-agents branch April 26, 2017 13:30
MXEBot pushed a commit to mirror/chromium that referenced this pull request Apr 29, 2017
Atomics.wait is a blocking call, and is only allowed on certain workers. See
the new web platform tests here:
web-platform-tests/wpt#5569

BUG=chromium:711809

Review-Url: https://codereview.chromium.org/2841003002
Cr-Commit-Position: refs/heads/master@{#468188}
inikulin pushed a commit to HTMLParseErrorWG/html that referenced this pull request May 9, 2017
Define the infrastructure for SharedArrayBuffer. This also clarifies
along which boundaries a browser implementation can use processes and
threads.

Tests: web-platform-tests/wpt#5569.

Follow-up to define similar-origin window agents upon a less shaky
foundation is whatwg#2528. Because of that, similar-origin window agents
are the best place to store state that would formerly go on unit of
related similar-origin browsing contexts.

Follow-up for better agent shutdown notifications: whatwg#2581.

tc39/ecma262#882 is follow-up to define
agents in more detail; in particular make their implicit realms slot
explicit. w3c/css-houdini-drafts#224 is
follow-up to define worklet ownership better which is needed to
define how they relate to agent (sub)clusters.

Fixes part of whatwg#2260. Fixes whatwg#851. Fixes
w3c/ServiceWorker#1115. Fixes most of
w3c/css-houdini-drafts#380 (no tests and no
nice grouping of multiple realms in a single agent as that is not
needed).
inikulin pushed a commit to HTMLParseErrorWG/html that referenced this pull request May 9, 2017
Define the infrastructure for SharedArrayBuffer. This also clarifies
along which boundaries a browser implementation can use processes and
threads.

Tests: web-platform-tests/wpt#5569.

Follow-up to define similar-origin window agents upon a less shaky
foundation is whatwg#2528. Because of that, similar-origin window agents
are the best place to store state that would formerly go on unit of
related similar-origin browsing contexts.

Follow-up for better agent shutdown notifications: whatwg#2581.

tc39/ecma262#882 is follow-up to define
agents in more detail; in particular make their implicit realms slot
explicit. w3c/css-houdini-drafts#224 is
follow-up to define worklet ownership better which is needed to
define how they relate to agent (sub)clusters.

Fixes part of whatwg#2260. Fixes whatwg#851. Fixes
w3c/ServiceWorker#1115. Fixes most of
w3c/css-houdini-drafts#380 (no tests and no
nice grouping of multiple realms in a single agent as that is not
needed).
alice pushed a commit to alice/html that referenced this pull request Jan 8, 2019
Define the infrastructure for SharedArrayBuffer. This also clarifies
along which boundaries a browser implementation can use processes and
threads.

Tests: web-platform-tests/wpt#5569.

Follow-up to define similar-origin window agents upon a less shaky
foundation is whatwg#2528. Because of that, similar-origin window agents
are the best place to store state that would formerly go on unit of
related similar-origin browsing contexts.

Follow-up for better agent shutdown notifications: whatwg#2581.

tc39/ecma262#882 is follow-up to define
agents in more detail; in particular make their implicit realms slot
explicit. w3c/css-houdini-drafts#224 is
follow-up to define worklet ownership better which is needed to
define how they relate to agent (sub)clusters.

Fixes part of whatwg#2260. Fixes whatwg#851. Fixes
w3c/ServiceWorker#1115. Fixes most of
w3c/css-houdini-drafts#380 (no tests and no
nice grouping of multiple realms in a single agent as that is not
needed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants