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
Support distinguishing service/shared/dedicated workers in .any.js tests #11928
Comments
Example of the four different global scopes currently supported: The worker ones are backed by http://w3c-test.org/IndexedDB/idlharness.any.worker.js. In the output: self.GLOBAL = {
isWindow: function() { return true; },
isWorker: function() { return false; },
}; This is actually documented in https://web-platform-tests.org/writing-tests/testharness.html. If we could expand this to have Technically, that's not entirely straightforward since the same .any.worker.js is used for all three kinds of workers. Options:
|
@lukebjerring, would this be used to make the correct assertions about what interface objects etc. are exposed in each global scope? Does idlharness.js currently just get it wrong? |
idlharness already uses self instanceof checks, so it's not farfetched that we continue that pattern. However, it seems inconsistent to have an isWorker function prepended in one case and a computation function elsewhere. Why do we have the isWorker function at all? We could compute that too. |
It was added in w3c/wpt-tools#88, maybe @Ms2ger or @jgraham know why? |
I added it as an easy way to distinguish the cases that couldn't be affected by browser bugs. I'm not sure that's still a valid concern, though. I'd generally prefer a solution that didn't involve more generated files. |
I wouldn't be surprised if someone forgot to expose the WorkerGlobalScope interface object somewhere at some point, so that makes sense. What we could do instead is to add tests under /infrastructure/, with one global per test, that asserts that the |
One other thing to note is that you always need to check Anyway, I'm fine whichever way, as long as the tests keep working :) |
Seems like the verdict here is that further additions to self.GLOBAL isn't desirable. |
An example use-case for this feature would be any IDL that spans several combinations of subsets of window/sharedworker/serviceworker/dedicatedworker, e.g. push-api has
PushManager
(Window, Worker) andPushEvent
(ServiceWorker).Currently, distinction is only possible with something like
or
NB: Somewhat related to #11529
The text was updated successfully, but these errors were encountered: