New issue
Advanced search Search tips

Issue 839117 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocked on:
issue 839389

Blocking:
issue 837406


Participants' hotlists:
Hotlist-Bindings-IDLCompiler


Sign in to add a comment

Exposed extended attribute not working correctly for partial interface.

Project Member Reported by odejesush@chromium.org, May 2 2018

Issue description

Chrome Version: 68.0.3418.0 (Developer Build) (64-bit)
OS: Linux

What steps will reproduce the problem?
(1) Add an Exposed attribute to a partial interface for an interface in exposed to Workers to expose the partial interface to a subset (specifically DedicatedWorker and SharedWorker)
(2) Running the webexposed tests causes the global-interface-listing tests to fail for the exposed set that is not listed in the extended attribute (specifically ServiceWorker).

The relevant change is the following: https://chromium-review.googlesource.com/c/chromium/src/+/1024724/10

In this change, I created a WorkerNavigator partial interface in worker_navigator_usb.idl that has the extended attribute Exposed=(DedicatedWorker,SharedWorker). On my machine, the test for global-interface-listing-service-worker.html fails because the new usb attribute is listed under the WorkerNavigator for that context.

The Linux and Mac trybots for patchset 10 also fail on the global-interface-listing-service-worker.html test.

What is the expected result?
The partial interface should not appear in the global interface listing 
for the contexts in which it is not exposed. In my particular example, the WorkerNavigator for a service worker should not be affected.

What happens instead?
The partial interface appears in the global interface listing for the contexts in which it is not exposed. In my particular example, the WorkerNavigator for a service worker is affected by the partial interface.


 
Blocking: 837406

Comment 2 by peria@chromium.org, May 3 2018

Blockedon: 839389
Cc: yukishiino@chromium.org

Comment 4 by peria@chromium.org, May 25 2018

Labels: Hotlist-Bindings-IDLCompiler
I found another case for the Exposed attribute not working correctly.

It seems that using different runtime flags for the exposed contexts in the Exposed extended attribute does not prevent the other contexts from being exposed when one of the flags is activated. For example, if I do Exposed(DedicatedWorker Flag1, SharedWorker Flag2) with Flag1 being "experimental" status and Flag2 being "test" status, then the global interface listing tests in virtual/exposed for shared worker and service worker are affected.

I made a change to split the original WebUSBOnDedicatedAndSharedWorker flag into WebUSBOnDedicatedWorker and WebUSBOnSharedWorker. These two flags are used in the Exposed attribute for the WebUSB IDL files. Additionally, the WebUSBOnDedicatedWorker was set to "experimental" while WebUSBOnSharedWorker remained on "test". This caused the usb attribute in WorkerNavigator to be exposed to the virtual/stable/webexposed/global-interface-listing-shared-worker.html and the virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker.html tests. This shouldn't happen, since the WebUSBOnDedicatedWorker flag is attached to the DedicatedWorker context only.

This is the change where this bug occurs:
https://chromium-review.googlesource.com/c/chromium/src/+/1098031

Comment 6 by peria@chromium.org, Jun 20 2018

Let me clarify and simplify these cases.

For the case in #0, an attribute "usb" is defined as following in IDL,

[Exposed=(DedicatedWorker, SharedWorker)]
partial interface WorkerNavigator {
  [RuntimeEnabled=WebUSBOnDedicatedOrSharedWorker] attribute USB usb;
};

but it is visible also in ServiceWorker, while it should not.


And the second case in #5 is, the IDL description is updated as

[Exposed(DedicatedWorker WebUSBOnDedicatedWorker, SharedWorker WebUSBOnSharedWorker)]
partial interface WorkerNavigator {
  attribute USB usb;
};

and then it becomes visible regardless runtime enabled flags.

Comment 7 by peria@chromium.org, Jun 20 2018

Labels: -OS-Linux -OS-Mac
The both cases in #6 happens with current IDL compiler.

First one is because we install "usb" in V8WorkerNavigator, without considering a global object.
The second one is because, adding to the first reason, we do not assume having multiple runtime_enabled_flags on an object.

We need to change the design of IDL compiler to work for these issues... :(
I see thank you. I also tried splitting into two WorkerNavigator partial interfaces for each context with the runtime flag in the Exposed attribute, and using the RuntimeEnabled on the attribute instead. I did these just to see what would happen, but it still does the same thing. WorkerNavigator.usb is exposed to Shared Workers in virtual/stable/webexposed and Service Workers in virtual/stable/http/tests/serviceworker/webexposed. So yes, it seems to be the case still. 

These are what I tried today:
---
[Exposed(DedicatedWorker WebUSBOnDedicatedWorker)]
partial interface WorkerNavigator {
  attribute USB usb;
};

[Exposed(SharedWorker WebUSBOnShareddWorker)]
partial interface WorkerNavigator {
  attribute USB usb;
};
---
[Exposed=DedicatedWorker]
partial interface WorkerNavigator {
  [RuntimeEnabled=WebUSBOnDedicatedWorker] attribute USB usb;
};

[Exposed=SharedWorker]
partial interface WorkerNavigator {
  [RuntimeEnabled=WebUSBOnSharedWorker] attribute USB usb;
};
---

Sign in to add a comment