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 24808 - [imports]: document.write() in imports should do nothing.
Summary: [imports]: document.write() in imports should do nothing.
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on: 24623
Blocks: 20683 24042
  Show dependency treegraph
 
Reported: 2014-02-25 18:47 UTC by Morrita Hajime
Modified: 2014-05-14 00:17 UTC (History)
7 users (show)

See Also:


Attachments

Description Morrita Hajime 2014-02-25 18:47:13 UTC
Spinned out from Bug 24042.
Comment 1 Ian 'Hixie' Hickson 2014-02-25 18:50:34 UTC
Per the discussion in bug 24623, I think this is unnecessary, unless we're trying to explicitly kill document.write() for purity reasons (in which case I'm happy to get behind this, if we're clear that we're not doing this for technical reasons).
Comment 2 Olli Pettay 2014-02-25 19:23:44 UTC
FYI, I'd be happy to start killing document.write (well, document.open)
And one way to do it is to not expose new features to it.
Comment 3 Dimitri Glazkov 2014-02-25 19:26:10 UTC
(In reply to Olli Pettay from comment #2)
> FYI, I'd be happy to start killing document.write (well, document.open)
> And one way to do it is to not expose new features to it.

Sounds good to me.
Comment 4 Morrita Hajime 2014-02-25 19:30:35 UTC
Basically this change makes imports more like external scripts where document.write() is voided. So it aligns the kill-document-write path.
Comment 5 Morrita Hajime 2014-04-15 18:14:08 UTC
https://github.com/w3c/webcomponents/commit/6786e3c576334bbdd0254c4258c43e5199d9b6f2

I was confused but there are two cases to consider.

One is document.write() against the master document. As Hixie mentioned, it just blows the document away. So we don't have do anything.

Another is document.write() for imports themselves. IIRC, it works for now. But once we address Bug 24042 and UA delays script execution timing more aggressively, the situation will change and document.write() won't work anymore.

I don't have any immediate plan to address Bug 24042 as it needs more consideration and ES6 <module> or <script defer> might resolve the underlying problem for free. I however want to remove obstacles to attack it in the first place.

So I disabled these document APIs for imports. It's a safety net, and I think this is what Olli suggests.
Comment 6 Boris Zbarsky 2014-04-15 18:20:03 UTC
Please do not monkeypatch other specs.  Talk to the html spec editor about getting this case handled.
Comment 7 Morrita Hajime 2014-04-15 19:52:25 UTC
(In reply to Boris Zbarsky from comment #6)
> Please do not monkeypatch other specs.  Talk to the html spec editor about
> getting this case handled.

We're thinking about making HTML Imports part of WHATWG HTML once the churn is settled. We want to do that exactly because the large part of the spec is a set of monkey patches.
Comment 8 Ian 'Hixie' Hickson 2014-05-13 21:59:24 UTC
This is resolved now, no? Calling document.write() on an import doc throws, and calling it on a master document just works as already specified, nothing new.
Comment 9 Morrita Hajime 2014-05-14 00:17:23 UTC
(In reply to Ian 'Hixie' Hickson from comment #8)
> This is resolved now, no? Calling document.write() on an import doc throws,
> and calling it on a master document just works as already specified, nothing
> new.
You're right. This was reopened to request removing monkey-patching.
As it is merged to HTML, this will no longer an issue. closing.