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

Issue 594008 link

Starred by 3 users

Issue metadata

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

Blocked on:
issue 611632


Participants' hotlists:
Hotlist-Bindings-IDLCompiler


Sign in to add a comment

Named getter on Document doesn't work properly on return value of DOMParser.prototype.parseFromString

Reported by bzbar...@mit.edu, Mar 11 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:47.0) Gecko/20100101 Firefox/47.0

Example URL:
See testcase

Steps to reproduce the problem:
1. Load this HTML

<script>
  var parser = new DOMParser(); 
  var str = '<img name="name" />'; 
  console.log(parser.parseFromString(str, 'text/html').name);
</script>

What is the expected behavior?
Should log the image.

What went wrong?
Logs undefined.

Does it occur on multiple sites: N/A

Is it a problem with a plugin? N/A 

Did this work before? N/A 

Does this work in other browsers? Yes 

Chrome version: 50.0.2661.18 (Official Build) dev (64-bit)  Channel: n/a
OS Version: OS X 10.10
Flash Version: Shockwave Flash 20.0 r0

This works correctly in Firefox and Safari.  Haven't tested IE.
 
Cc: rnimmagadda@chromium.org
Labels: Needs-Feedback
@bzbarsky: Created a .html file with the code provided in the description and the output is a Blank Page.

Screen-shot is attached.

Please provide us the sample.html file to repro this issue from our end also.

Thank you.
sample (1).html
150 bytes View Download

Comment 2 by bzbar...@mit.edu, Mar 11 2016

You should look at the console output, not the page itself.

Comment 3 by rsesek@chromium.org, Mar 14 2016

Components: Blink>JavaScript
Labels: -Needs-Feedback -OS-Mac OS-All

Comment 4 Deleted

Able to reproduce the issue on Windows 7, Ubuntu 14.04 and Mac OS 10.11.3 using chrome stable M49-49.0.2623.87. Observed the log in the console displayed as undefined.

This is a non-regression issue seem from M35-35.0.1851.0, Hence marking it as untriaged.
Components: -Blink>JavaScript Blink>DOM

Comment 7 by tkent@chromium.org, Mar 25 2016

Labels: -M-51 Hotlist-Interop
Status: Available (was: Untriaged)
Summary: Named getter on Document doesn't work properly on return value of DOMParser.prototype.parseFromString (was: Named getter doesn't work properly on return value of DOMParser.prototype.parseFromString)
Cc: haraken@chromium.org jochen@chromium.org verwa...@chromium.org
Components: Blink>Bindings
This is because we synthesize the accessors on the Document through the Window:

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp?sq=package:chromium&dr=C&rcl=1466464582&l=523

which we only do if the Document has a frame:

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/html/HTMLDocument.cpp?sq=package:chromium&dr=C&rcl=1466464582&l=173

Safari is actually using an interceptor here:
https://github.com/WebKit/webkit/blob/421fe0035ef1cbf77d877981b1dc15505ae8ce65/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp#L95

I don't know if we can use an interceptor on Document without slowing everything down like createElement. jochen@, verwaest@ ?

Can we do what we did for .style like this?

https://cs.chromium.org/chromium/src/out/Debug/gen/blink/bindings/core/v8/V8CSSStyleDeclaration.cpp?q=V8CSSStyleDeclaration.cpp&sq=package:chromium&l=348

    v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(CSSStyleDeclarationV8Internal::namedPropertyGetterCallback, CSSStyleDeclarationV8Internal::namedPropertySetterCallback, CSSStyleDeclarationV8Internal::namedPropertyQueryCallback, 0, CSSStyleDeclarationV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlags::kNonMasking)));
    instanceTemplate->SetHandler(namedPropertyHandlerConfig);

Cc: yukishiino@chromium.org peria@chromium.org
I think Toon has a plan to cache named properties on V8 side so that V8 doesn't need to call the interceptor every time. Once it's done, we can just add an interceptor to Document.


Just FYI, peria@ once fixed this issue at https://crrev.com/1837823003 , but it got reverted due to a performance regression.  As haraken@ wrote, once the performance issue will be solved, we can land a basically same fix, I think.
Owner: peria@chromium.org
Status: Assigned (was: Available)

Comment 12 by peria@chromium.org, Jun 22 2016

Yes, I'd like to land the CL in #10 again, if we can avoid the performance regression with Toon's plan in #9.
Blocking: 611632
Blockedon: 611632
Blocking: -611632
Components: -Blink>DOM
Blockedon: 839389

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

Blockedon: -839389
Labels: Hotlist-Bindings-IDLCompiler

Sign in to add a comment