<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>99465</bug_id>
          
          <creation_ts>2012-10-16 08:19:49 -0700</creation_ts>
          <short_desc>testRunner.setCanOpenWindows and window.open hits an ASSERT in Mac DumpRenderTree</short_desc>
          <delta_ts>2012-10-17 10:34:06 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>OS X 10.8</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>743159</commentid>
    <comment_count>0</comment_count>
      <attachid>168950</attachid>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2012-10-16 08:19:49 -0700</bug_when>
    <thetext>Created attachment 168950
Layout test

Open the attached file with run-webkit-test.

All it does is:

&lt;script&gt;
testRunner.setCanOpenWindows();
var win = window.open();
&lt;/script&gt;

When run with Apple port of DRT I get the following stack trace:

ASSERTION FAILED: gTestRunner-&gt;waitToDump()
/Volumes/MacintoshHD2/src/WebKit/Tools/DumpRenderTree/mac/UIDelegate.mm(145) : -[UIDelegate webView:createWebViewWithRequest:]
1   0x10f2ca763 CallUIDelegate(WebView*, objc_selector*, objc_object*)
2   0x10f2bfdc4 WebChromeClient::createWindow(WebCore::Frame*, WebCore::FrameLoadRequest const&amp;, WebCore::WindowFeatures const&amp;, WebCore::NavigationAction const&amp;)
3   0x10f668fb8 WebCore::Chrome::createWindow(WebCore::Frame*, WebCore::FrameLoadRequest const&amp;, WebCore::WindowFeatures const&amp;, WebCore::NavigationAction const&amp;) const
4   0x10f920add WebCore::createWindow(WebCore::Frame*, WebCore::Frame*, WebCore::FrameLoadRequest const&amp;, WebCore::WindowFeatures const&amp;, bool&amp;)
5   0x10f87baac WebCore::DOMWindow::createWindow(WTF::String const&amp;, WTF::AtomicString const&amp;, WebCore::WindowFeatures const&amp;, WebCore::DOMWindow*, WebCore::Frame*, WebCore::Frame*, void (*)(WebCore::DOMWindow*, void*), void*)
6   0x10f87bfe0 WebCore::DOMWindow::open(WTF::String const&amp;, WTF::AtomicString const&amp;, WTF::String const&amp;, WebCore::DOMWindow*, WebCore::DOMWindow*)
7   0x10fbcdbda WebCore::JSDOMWindow::open(JSC::ExecState*)
8   0x10fbc177f WebCore::jsDOMWindowPrototypeFunctionOpen(JSC::ExecState*)
9   0x511b92e01265
10  0x10eeab2a1 JSC::Interpreter::execute(JSC::ProgramExecutable*, JSC::ExecState*, JSC::JSObject*)
11  0x10ee03360 JSC::evaluate(JSC::ExecState*, JSC::SourceCode const&amp;, JSC::JSValue, JSC::JSValue*)
12  0x110074081 WebCore::ScriptController::evaluateInWorld(WebCore::ScriptSourceCode const&amp;, WebCore::DOMWrapperWorld*)
13  0x1100741f9 WebCore::ScriptController::evaluate(WebCore::ScriptSourceCode const&amp;)
14  0x11007d0f2 WebCore::ScriptElement::executeScript(WebCore::ScriptSourceCode const&amp;)
15  0x11007be9c WebCore::ScriptElement::prepareScript(WTF::TextPosition const&amp;, WebCore::ScriptElement::LegacyTypeSupport)
16  0x10f9e8acb WebCore::HTMLScriptRunner::runScript(WebCore::Element*, WTF::TextPosition const&amp;)
17  0x10f9e8930 WebCore::HTMLScriptRunner::execute(WTF::PassRefPtr&lt;WebCore::Element&gt;, WTF::TextPosition const&amp;)
18  0x10f99b124 WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder()
19  0x10f99b1a8 WebCore::HTMLDocumentParser::canTakeNextToken(WebCore::HTMLDocumentParser::SynchronousMode, WebCore::PumpSession&amp;)
20  0x10f99aeac WebCore::HTMLDocumentParser::pumpTokenizer(WebCore::HTMLDocumentParser::SynchronousMode)
21  0x10f99b52d WebCore::HTMLDocumentParser::append(WebCore::SegmentedString const&amp;)
22  0x10f761697 WebCore::DecodedDataDocumentParser::flush(WebCore::DocumentWriter*)
23  0x10f79e0ae WebCore::DocumentWriter::end()
24  0x10f791a53 WebCore::DocumentLoader::finishedLoading()
25  0x10fe554c0 WebCore::MainResourceLoader::didFinishLoading(double)
26  0x7fff932a0f58 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke_0
27  0x7fff932a0e9c -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]
28  0x7fff932a0d98 -[NSURLConnectionInternal _withActiveConnectionAndDelegate:]
29  0x7fff96308f01 ___delegate_didFinishLoading_block_invoke_0
30  0x7fff962fb3ca ___withDelegateAsync_block_invoke_0
31  0x7fff9638b56a __block_global_1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>743586</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-16 14:48:04 -0700</bug_when>
    <thetext>This seems to be intentional - tests that use window.open() should also use waitUntilDone, because you have to wait for load.

We have a number of tests that use testRunner.setCanOpenWindows and pass.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>744228</commentid>
    <comment_count>2</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2012-10-17 07:23:35 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; This seems to be intentional - tests that use window.open() should also use waitUntilDone, because you have to wait for load.

That is not true. window.open is synchronous and forcing tests to be async is bad.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>744292</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-17 09:06:09 -0700</bug_when>
    <thetext>What exactly did you find untrue? You just seem to disagree.

Saying that window.open() is synchronous is not meaningful - every function call is. But actually loading anything into the opened window is not. We have a lot of tests where waitUntilDone was appropriate, so if you have one more test that doesn&apos;t need that, please post an explanation why you cannot follow the common model.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>744297</commentid>
    <comment_count>4</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2012-10-17 09:13:53 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; What exactly did you find untrue? You just seem to disagree.

The following works and the web depend on it.

var win = window.open();
win.document.body.whatever

The DOM in the newly opened window is available synchronously.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>744358</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-17 10:17:21 -0700</bug_when>
    <thetext>I just tested to confirm that win.document.body.innerHTML is empty in this scenario. Are you by any chance thinking about some special case, like a data or a javascript URL?

main.html:
----------
&lt;script&gt;
try {
  var w = window.open(&quot;w.html&quot;);
  alert(w.document.body.innerHTML);
  setTimeout(&quot;alert(w.document.body.innerHTML)&quot;, 100);
} catch (ex) {
  alert(&quot;Please disable your popup blocker, and/or local file security&quot;);
}
&lt;/script&gt;
----------

w.html:
----------
&lt;body&gt;Huh?&lt;/body&gt;
----------</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>744364</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2012-10-17 10:22:11 -0700</bug_when>
    <thetext>Or perhaps you are thinking about the case of an secondary window that you don&apos;t load into, and only document.write() to?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>744379</commentid>
    <comment_count>7</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2012-10-17 10:34:06 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; Or perhaps you are thinking about the case of an secondary window that you don&apos;t load into, and only document.write() to?

Yup. When you do window.open you synchronously get about:blank which has a body element (you didn&apos;t get an exception in your test). You can manipulate this using DOM and/or document.write to it.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>168950</attachid>
            <date>2012-10-16 08:19:49 -0700</date>
            <delta_ts>2012-10-16 08:19:49 -0700</delta_ts>
            <desc>Layout test</desc>
            <filename>test-runner-set-can-open-windows.html</filename>
            <type>text/html</type>
            <size>66</size>
            <attacher name="Erik Arvidsson">arv</attacher>
            
              <data encoding="base64">PHNjcmlwdD4KdGVzdFJ1bm5lci5zZXRDYW5PcGVuV2luZG93cygpOwp3aW5kb3cub3BlbigpOwo8
L3NjcmlwdD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>