This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17828 - Specify behavior for embedded content elements that have no browsing context
Summary: Specify behavior for embedded content elements that have no browsing context
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-18 06:57 UTC by contributor
Modified: 2012-12-10 04:46 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2012-07-18 06:57:31 UTC
This was was cloned from bug 16155 as part of operation convergence.
Originally filed: 2012-02-28 23:28:00 +0000
Original reporter: Dimitri Glazkov <dglazkov@chromium.org>

================================================================================
 #0   Dimitri Glazkov                                 2012-02-28 23:28:38 +0000 
--------------------------------------------------------------------------------
Gecko, WebKit, and IE all implement the same behavior for IMG, AUDIO, and VIDEO elements that have no associated browsing context: they don't fetch resources, since there is not document URL to resolve against.

We should add this to the spec. Perhaps a step in http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#resolve-a-url?
================================================================================
 #1   Boris Zbarsky                                   2012-03-01 15:10:11 +0000 
--------------------------------------------------------------------------------
There is absolutely a document url; I don't see how there could not be.  There is always a document url.

I believe we should simply define all of these elements to not do any fetches while their ownerDocument has no defaultView.
================================================================================
 #2   Dimitri Glazkov                                 2012-03-01 17:23:18 +0000 
--------------------------------------------------------------------------------
(In reply to comment #1)
> There is absolutely a document url; I don't see how there could not be.  There
> is always a document url.

Maybe this just need to be fleshed out in the DOM4 spec, but as of now, the URL is not set for document when creating it using DOMImplementation.createHTMLDocument:

http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domimplementation-createhtmldocument

WebKit in this case provides an empty URL (which seems in line with the spec):

http://jsfiddle.net/dglazkov/9pESJ/1/

Gecko returns "about:blank".

IE9 returns the main document URL.

> 
> I believe we should simply define all of these elements to not do any fetches
> while their ownerDocument has no defaultView.

Sure, that sounds good too.
================================================================================
 #3   Boris Zbarsky                                   2012-03-01 17:40:12 +0000 
--------------------------------------------------------------------------------
> as of now, the URL is not set for document when creating it using
> DOMImplementation.createHTMLDocument:

There is an existing open bug on that, last I checked.
================================================================================
 #4   Dimitri Glazkov                                 2012-03-01 18:27:52 +0000 
--------------------------------------------------------------------------------
Nifty. I can't seem to find it :( Maybe it doesn't have an URL? ;)
================================================================================
 #5   Boris Zbarsky                                   2012-03-01 18:37:33 +0000 
--------------------------------------------------------------------------------
Looks like it's not longer open.  https://www.w3.org/Bugs/Public/show_bug.cgi?id=13045

And DOMCore clearly says:

  Unless explicitly given when a document is created its encoding is utf-8, its
  content type is "application/xml", and its URL is "about:blank". 

right at http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-document-url
================================================================================
 #6   Dimitri Glazkov                                 2012-03-01 18:46:45 +0000 
--------------------------------------------------------------------------------
Great. So the task as you formulated it is:

Update the spec to define that elements do not do any fetches
while their ownerDocument has no associated browsing context (that's the equivalent of defaultView being null, right?)
================================================================================
 #7   Boris Zbarsky                                   2012-03-01 18:56:49 +0000 
--------------------------------------------------------------------------------
It's not, actually.  

And neither one is equivalent to the document being the current document of the associated browsing context (if any), as far as I can tell.

Which one we want depends on the behavior we want for things like prerendered documents, unloaded documents, etc.
================================================================================
 #8   Dimitri Glazkov                                 2012-03-01 19:08:37 +0000 
--------------------------------------------------------------------------------
Interesting. You're drawing a distinction between whether the browsing context simply isn't associated with a given document (like when it's created using DOMImplementation), or the user agent decides to not to create browsing contexts (when prerendering, data mining, etc.) for a document.

Is this distinction anywhere in the spec?
================================================================================
 #9   Boris Zbarsky                                   2012-03-01 19:20:33 +0000 
--------------------------------------------------------------------------------
No, I'm making a distinction between documents which have no associated browsing context and documents which do have one but are not the current document in that browsing context.  That distinction is most certainly in the spec.
================================================================================
Comment 1 Ian 'Hixie' Hickson 2012-09-26 18:47:20 UTC
The spec already does this: the "fetch" algorithm relies on queued tasks for returning the data, but tasks are only processed when their document is active, and if it has no browsing context, a document can never be active.

I could be more specific, though, especially in the case of pages that have no browsing context at all (as opposed to those that just aren't active). Does anyone think that is really necessary? What behaviour would you want to have be different than what the spec requires now?
Comment 2 Dimitri Glazkov 2012-09-26 23:37:41 UTC
(In reply to comment #1)
> The spec already does this: the "fetch" algorithm relies on queued tasks for
> returning the data, but tasks are only processed when their document is active,
> and if it has no browsing context, a document can never be active.

Oh cool. That is definitely the bit that I was missing.
 
> I could be more specific, though, especially in the case of pages that have no
> browsing context at all (as opposed to those that just aren't active). Does
> anyone think that is really necessary? What behaviour would you want to have be
> different than what the spec requires now?

Maybe add informative content somewhere about the effect of creating a document without a browsing context?
Comment 3 Ian 'Hixie' Hickson 2012-12-10 04:46:06 UTC
Looks like I already fixed this for feedback on the WHATWG list.