Closed Bug 36240 Opened 25 years ago Closed 23 years ago

Implement nsHTMLObjectElement::GetContentDocument()

Categories

(Core Graveyard :: Plug-ins, defect, P3)

defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: jst, Assigned: peterlubczynski-bugs)

References

Details

Attachments

(1 file)

The Level 2 DOM defines a contentDocument attribute on the HTMLObjectElement interface, this should be implemented in mozilla if possible. Currently the method always returns a null contentDocument but if the plugin contains a DOM document that is accessible to the scripting environment then that should be returned. I don't know enough about plugins to say if this is at all possible, if it's not then I guess this is an invalid bug.
Status: NEW → ASSIGNED
Target Milestone: --- → M19
This bug has been marked "future" because the original netscape engineer working on this is over-burdened. If you feel this is an error, that you or another known resource will be working on this bug,or if it blocks your work in some way -- please attach your concern to the bug for reconsideration.
Target Milestone: M19 → Future
Does this bug also apply to IFRAMEs? DOM2 similarly defines a contentDocument attribute on the HTMLIframeElement interface, and this also seems to return null. Perhaps this is a DOM2 rather than a plug-in problem?
Apologies. Retracting previous comment. contentDocument property of IFRAME does work; I had the script after the <iframe src=...>, but I suspect it was executing before the src of the IFRAME had loaded. When the script is called later, it works fine.
This probably has to do with [Bug 678] text/html and text/plain OBJECTs don't work. Should nsHTMLObjectElement::GetContentDocument() return the handel to the document for OBJECT tag embedded text/html cases?
nsHTMLObjectElement::GetContentDocument() should return a reference to the document object inside the object plugin, or whatever, not a pointer to the document in which the object tag was found.
*** Bug 96570 has been marked as a duplicate of this bug. ***
One note, this bug prevents developers from accessing the embedded document's DOM through Javascript. The only alternative is using an IFRAME (which does have GetContentDocument() implemented), which is bad because it's deprecated, it's a frame, etc, etc. It also makes it pretty pointless that Moz supports text/html in an OBJECT but developer's can't get access to it. This would probably be good to have implemented so Moz doesn't make developers use deprecated HTML. I'd like to see this in for 1.0; I've already been bitten by it.
Assignee: av → peterlubczynski
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Target Milestone: Future → mozilla0.9.6
Target Milestone: mozilla0.9.6 → mozilla1.0
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 (you can query for this string to delete spam or retrieve the list of bugs I've moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Well, just stupid yank-and-paste, but seems to work :-))) (I was able to get url of content document from javascript). Could anyone review this?
Comment on attachment 70489 [details] [diff] [review] nsHTMLObjectElement::GetContentDocument() impl sounds great and clean, but do you really need all the blank lines in there? :-) Also, are you sure all those includes are really needed? r=fabian anyway
Attachment #70489 - Flags: review+
Yes, I need all includes I added - just to make the code to compile :-)
Keywords: patch, review
Nice Denis! jonnny, can you sr=?
Target Milestone: mozilla1.0.1 → mozilla0.9.9
Comment on attachment 70489 [details] [diff] [review] nsHTMLObjectElement::GetContentDocument() impl >+ presShell->GetSubShellFor(this, getter_AddRefs(tmp)); >+ NS_ENSURE_TRUE(tmp, NS_OK); >+ >+ nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(tmp); >+ NS_ENSURE_TRUE(webNav, NS_OK); >+ Um, presShell->GetSubShellFor() will return the sub presshell if there is one, and the presshell does *not* implement nsIWebNavigation, so this won't work. Also, don't use NS_ENSURE_* in places that can fail for valid reasons, like after the GetSubShellFor() call, it will assert in debug builds, but there's no reason to assert there.
Attachment #70489 - Flags: needs-work+
> Um, presShell->GetSubShellFor() will return the sub presshell if there is one, > and the presshell does *not* implement nsIWebNavigation, so this won't work. But it worked when I tested it... And it's works for nsHTMLIFrameElement.
Comment on attachment 70489 [details] [diff] [review] nsHTMLObjectElement::GetContentDocument() impl Oh, oops, my bad. Sorry, should've looked closer at the presshell code. Yes, the code looks fine, except for the overly eager use of NS_ENSURE_*, replace the ones of those that could end up asserting with if (...) return NS_...; and you'll have sr=jst
Attachment #70489 - Flags: needs-work+ → superreview+
patch in trunk, marking FIXED
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Keywords: review
Resolution: --- → FIXED
http://web.vee.net/mozilla/object.html nsHTMLObjectElement::GetContentDocument() returns object "HTMLDocument" and not 'null'. used 0221 trunk builds on all plfs.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: