New issue
Advanced search Search tips

Issue 667153 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature



Sign in to add a comment

Add support for CallWith=Document to IDL bindings generator

Project Member Reported by alancutter@chromium.org, Nov 21 2016

Issue description

In many places CallWith=ExecutionContext will only ever be passed a Document object. Currently the C++ callsites enforce it at debug runtime by casting with toDocument().

We should be able to enforce this as a constraint at IDL compile time with CallWith=Document. If the interface can be accessed from a non-document execution context the bindings generation should fail.
 
Cc: haraken@chromium.org
This seems at odds with bug 670618, which proposes moving in the opposite direction (getting rid of CallWith=ExecutionContext in favour of making callees get it from the ScriptState).
I think they are orthogonal.
CallWith=ExecutionContext is redundant with CallWith=ScriptState while CallWith=Document provides compile time safety. You can have CallWith=Document without CallWith=ExecutionContext.
I'd prefer having only [CallWith=ScriptState] and providing scriptState->document().

I would be okay with that compromise.

The trouble I previously had with ExecutionContext* was it was confusing for my reviewer why I could dereference and cast to Document& without any checks. Having scriptState.document() would make it more clear that this is sanctioned behaviour.
I'd actually like to discourage CallWith=ScriptState and make almost all callers use Document or ExecutionContext. It's important to being able to write reasonable SimTests and use the web platform internally with C++.

ex. Calling Element::animate() should be possible without a ScriptState for a SimTest, or for implementing a web platform feature internally like <marquee>.

ex.
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/animation/ElementAnimation.h?type=cs&l=54

This is only taking a ScriptState so it can can the ExecutionContext back, that shouldn't be needed.
On the other hand, we want to unify all information about script execution to ScriptState. From that perspective, it's nicer to always use ScriptState rather than using Document sometimes, ExecutionContext sometimes, ScriptState sometimes.

Would there be any way to mock ScriptState in SimTests? I think SimTests will anyway need to support some binding things to support more tests.


Project Member

Comment 7 by sheriffbot@chromium.org, Apr 11 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 8 by peria@chromium.org, Apr 12 2018

Status: WontFix (was: Untriaged)
This issue is left for >1 year, and seems to have no strong objection.  So let me close this.
Please reopen this, if you have any opinions on this.

Sign in to add a comment