New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 865441 link

Starred by 2 users

Issue metadata

Status: Available
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug


Participants' hotlists:
Hotlist-Bindings-IDLCompiler


Sign in to add a comment

Unexpected ExceptionState& parameter in `toStringMethod` disagrees with *.idl definition

Project Member Reported by kabusm@google.com, Jul 19

Issue description

As part of my work I modified the definition of href attribute in  third_party/blink/renderer/core/html/html_hyperlink_element_utils.idl.
Old version: [CEReactions] stringifier attribute USVString href;
New version: [CEReactions, RaisesException=Setter, CallWith=ScriptState] stringifier attribute URLString href;
I also modified appropriate href() and setHref() functions.
After the change, during the build, files: v8_html_anchor_element.cc and v8_html_area_element.cc need a href() version with signature: href(ScriptState*, ExceptionState&). Nevertheless, in the *.idl file I explicitly stated that only the setter (i.e. setHref()) should raise exceptions.
 
Cc: mkwst@chromium.org
Components: -Blink>DOM Blink>Bindings
Owner: ----
Putting this into the bindings team's queue.
Status: Available (was: Untriaged)
The attribute getter has the right signature, it's the toString() code that's buggy:

 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
+  ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kExecutionContext, "HTMLAnchorElement", "toString");
   CEReactionsScope ce_reactions_scope;
 
   HTMLAnchorElement* impl = V8HTMLAnchorElement::ToImpl(info.Holder());
 
-  V8SetReturnValueString(info, impl->href(), info.GetIsolate());
+  ScriptState* scriptState = ScriptState::ForRelevantRealm(info);
+
+  String result = impl->href(scriptState, exceptionState);
+  if (exceptionState.HadException()) {
+    return;
+  }
+  V8SetReturnValueString(info, result, info.GetIsolate());
 }

Summary: Unexpected ExceptionState& parameter in `toStringMethod` disagrees with *.idl definition (was: Unexpected ExceptionState& parameter in getter disagrees with *.idl definition)
To anyone willing to work on this: toString() is created via v8_interface.py and v8_methods.py, which don't have the logic for determining if RaisesException was passed a value like "Setter" in the IDL. That's done in v8_attributes.py.
Labels: Hotlist-Bindings-IDLCompiler
Owner: peria@chromium.org

Sign in to add a comment