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

Issue 601771 link

Starred by 8 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jul 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

contentWindow attribute is not available for SVG objects

Reported by sworddragon2@gmail.com, Apr 8 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

Steps to reproduce the problem:
1. Embed a SVG with an object tag.
2. Try to access the contentWindow attribute of this element (like document.getElementById('svg_object').contentWindow).

What is the expected behavior?
The window object of the SVG should be available.

What went wrong?
The window object of the SVG is undefined.

Did this work before? N/A 

Chrome version: 49.0.2623.110  Channel: stable
OS Version: 4.4.6
Flash Version: 21.0.0.197

For example Firefox does know this attribute on SVG's. The absence of this attribute makes it not possible to reliably establish safe cross-domain communication with postMessage.
 
Components: -Blink Blink>SVG
Labels: Needs-Bisect

Comment 2 by f...@opera.com, Apr 8 2016

Components: -Blink>SVG Blink>HTML>Object
Labels: -OS-Linux -Pri-2 OS-All Pri-3
Status: Available (was: Unconfirmed)
Not an SVG issue - that's might just be one of the cases where this property would be useful.

To quote HTMLObjectElement.idl:

// TODO(philipj): readonly attribute WindowProxy? contentWindow;

Spec: https://html.spec.whatwg.org/multipage/embedded-content.html#dom-object-contentwindow

I notice that the corresponding property for HTMLIFrameElement is hooked up.
Is it enough just to uncomment that line? AFAIK the glue code should be generated automatically.

If that's all we need to do, I'll be happy to take on this issue.
Labels: Te-NeedsFurtherTriage
I've attempted the fix described in comment 3.

While postMessage() seems to work, I couldn't access any JavaScript user-defined variables directly.

See the attached test.html and test.svg files --
* On Chromium 49, it says "missing contentWindow"
* On Firefox, it says "has contentWindow and attributes accessible"
* On Chromium with this patch, it says "has contentWindow but attributes not accessible"

I'm not sure what the correct behavior is here, so I'll leave the issue for now.
601771.patch
719 bytes Download
test.html
581 bytes View Download
test.svg
218 bytes Download

Comment 6 by f...@opera.com, Apr 17 2016

If you were loading them through file://, then I think that's the expected behavior. (Try http(s).)
Ah, it works now.

I'd tried loading the file through HTTP before, but I must have messed up the testing back then.

CL submitted: https://codereview.chromium.org/1889993004
Labels: -Needs-Bisect Needs-Feedback
@sworddragon2 -- Could you please verify on Latest Stable# 50.0.2661.94 and respond to the Comments# 5,6 & 7 and please provide the update which would help us triage the issue further.
Note: Removing Needs-Bisect label as of now.
Thanks in Advance.
I'm not sure what you expect me to verify (as the linked CL failed for now) and what I shall respond to for the comments 5-7 as they look already handled. Or do I miss something specific?

Comment 10 by tkent@chromium.org, Jun 10 2016

Labels: -Needs-Feedback -Te-NeedsFurtherTriage Hotlist-Interop
Status: Started (was: Available)
Owner: shanmug...@samsung.com
Project Member

Comment 13 by bugdroid1@chromium.org, Jun 22 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80

commit cc526ef25f0b6d2a819700ccbeac2b3acf6fab80
Author: shanmuga.m <shanmuga.m@samsung.com>
Date: Wed Jun 22 16:30:31 2016

Add contentWindow attribute for <object> elements

Firefox supporting contentWindow attribute for <object>
element.

BUG= 601771 

Review-Url: https://codereview.chromium.org/2077523002
Cr-Commit-Position: refs/heads/master@{#401302}

[add] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/fast/dom/HTMLObjectElement/HTMLObject-contentWindow-query.html
[add] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/fast/dom/HTMLObjectElement/resources/HTMLObject-contentWindow.svg
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/fast/dom/plugin-attributes-enumeration-expected.txt
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/imported/wpt/html/semantics/embedded-content/the-object-element/object-attributes-expected.txt
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/virtual/stable/webexposed/element-instance-property-listing-expected.txt
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/webexposed/element-instance-property-listing-expected.txt
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/cc526ef25f0b6d2a819700ccbeac2b3acf6fab80/third_party/WebKit/Source/core/html/HTMLObjectElement.idl

Comment 14 by tkent@chromium.org, Jul 28 2016

Status: Fixed (was: Started)

Comment 15 Deleted

Comment 16 by tkent@chromium.org, Aug 19 2016

 Issue 492804  has been merged into this issue.

Sign in to add a comment