<?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>122766</bug_id>
          
          <creation_ts>2013-10-14 11:17:35 -0700</creation_ts>
          <short_desc>Safari: Do not track feature will always create a script controller for all iframes</short_desc>
          <delta_ts>2013-10-14 14:13:37 -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>Page Loading</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexandru Chiculita">achicu</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>joepeck</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>939552</commentid>
    <comment_count>0</comment_count>
    <who name="Alexandru Chiculita">achicu</who>
    <bug_when>2013-10-14 11:17:35 -0700</bug_when>
    <thetext>While debugging a test in the inspector-protocol I found that the script controller is always created in Safari. The test runner is not creating the script controller, so it has different behavior. A little bit of debugging showed the following stack. It seems like the do not track feature in Safari will always force the creation of the script controller.

I guess that avoiding the script controller as long as you don&apos;t have any scripts is a good optimization. At least applications that need no scripting and just use webkit to show up HTML/CSS content can avoid a little bit of memory overhead.

I&apos;ve logged another bug in the new web inspector: https://bugs.webkit.org/show_bug.cgi?id=122764. The web inspector happens to use this side effect to show the iframes in the console &amp; resource panel. Without this extension the iframes with no &quot;script&quot; tags will not show up in the WebInspector at all.

#0  WebCore::PageRuntimeAgent::notifyContextCreated (this=0x110409810, frameId=@0x7fff5fbfd288, scriptState=0x10abbefb0, securityOrigin=0x0, isPageContext=true) at /Users/achicu/code/webkit/Source/WebCore/inspector/PageRuntimeAgent.cpp:183
#1  0x000000010506ef79 in WebCore::PageRuntimeAgent::didCreateMainWorldContext (this=0x110409810, frame=0x110446a10) at /Users/achicu/code/webkit/Source/WebCore/inspector/PageRuntimeAgent.cpp:124
#2  0x000000010492aadd in WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl (instrumentingAgents=0x110407ac0, frame=0x110446a10, world=@0x11010ef80) at /Users/achicu/code/webkit/Source/WebCore/inspector/InspectorInstrumentation.cpp:155
#3  0x000000010455c06c in WebCore::InspectorInstrumentation::didClearWindowObjectInWorld (frame=0x110446a10, world=@0x11010ef80) at InspectorInstrumentation.h:517
#4  0x0000000104556d38 in WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld (this=0x110446aa8, world=@0x11010ef80) at /Users/achicu/code/webkit/Source/WebCore/loader/FrameLoader.cpp:3273
#5  0x0000000105434004 in WebCore::ScriptController::initScript (this=0x11043e5f0, world=@0x11010ef80) at /Users/achicu/code/webkit/Source/WebCore/bindings/js/ScriptController.cpp:229
#6  0x0000000101179fbf in WebCore::ScriptController::windowShell (this=0x11043e5f0, world=@0x11010ef80) at ScriptController.h:83
#7  0x0000000101172bad in WebCore::ScriptController::globalObject (this=0x11043e5f0, world=@0x11010ef80) at ScriptController.h:92
#8  0x000000010133e726 in WebKit::WebFrame::jsContextForWorld (this=0x1104561f0, world=0x1001b5810) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp:468
#9  0x00000001015611d2 in WKBundleFrameGetJavaScriptContextForWorld (frameRef=0x1104561f0, worldRef=0x1001b5810) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:105
#10 0x0000000112863c95 in Safari::BrowserBundlePageController::injectDoNotTrackDOMPropertyInStandardWorld ()
#11 0x000000011286ee37 in Safari::BrowserBundlePageLoaderClient::globalObjectIsAvailableForFrame ()
#12 0x00000001128e4fe2 in Safari::WK::globalObjectIsAvailableForFrame ()
#13 0x00000001010d504a in WebKit::InjectedBundlePageLoaderClient::globalObjectIsAvailableForFrame (this=0x111000308, page=0x111000000, frame=0x1104561f0, world=@0x11010ef80) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:298
#14 0x0000000101349cb9 in WebKit::WebFrameLoaderClient::dispatchGlobalObjectAvailable (this=0x110468030, world=@0x11010ef80) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1458
#15 0x000000010454b49b in WebCore::FrameLoader::dispatchGlobalObjectAvailableInAllWorlds (this=0x110446aa8) at /Users/achicu/code/webkit/Source/WebCore/loader/FrameLoader.cpp:3281
#16 0x000000010454b04e in WebCore::FrameLoader::receivedFirstData (this=0x110446aa8) at /Users/achicu/code/webkit/Source/WebCore/loader/FrameLoader.cpp:625
#17 0x0000000104300998 in WebCore::DocumentLoader::commitData (this=0x1110c5200, bytes=0x100509f30 &quot;&lt;html&gt;\n &lt;!--  &lt;script&gt;console.log(\&quot;test\&quot;)&lt;/script&gt; --&gt;\n\n&lt;body&gt;\n\t&lt;!-- Delay the onload event using a slow image --&gt;\n\t&lt;!-- &lt;img src=\&quot;http://localhost:8000/history/resources/slow-image.php\&quot; /&gt; --&gt;\n&lt;/body&quot;..., length=210) at /Users/achicu/code/webkit/Source/WebCore/loader/DocumentLoader.cpp:788
#18 0x0000000101347230 in WebKit::WebFrameLoaderClient::committedLoad (this=0x110468030, loader=0x1110c5200, data=0x100509f30 &quot;&lt;html&gt;\n &lt;!--  &lt;script&gt;console.log(\&quot;test\&quot;)&lt;/script&gt; --&gt;\n\n&lt;body&gt;\n\t&lt;!-- Delay the onload event using a slow image --&gt;\n\t&lt;!-- &lt;img src=\&quot;http://localhost:8000/history/resources/slow-image.php\&quot; /&gt; --&gt;\n&lt;/body&quot;..., length=210) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:856
#19 0x00000001043028b0 in WebCore::DocumentLoader::commitLoad (this=0x1110c5200, data=0x100509f30 &quot;&lt;html&gt;\n &lt;!--  &lt;script&gt;console.log(\&quot;test\&quot;)&lt;/script&gt; --&gt;\n\n&lt;body&gt;\n\t&lt;!-- Delay the onload event using a slow image --&gt;\n\t&lt;!-- &lt;img src=\&quot;http://localhost:8000/history/resources/slow-image.php\&quot; /&gt; --&gt;\n&lt;/body&quot;..., length=210) at /Users/achicu/code/webkit/Source/WebCore/loader/DocumentLoader.cpp:745
#20 0x0000000104302e8b in WebCore::DocumentLoader::dataReceived (this=0x1110c5200, resource=0x1005aa2b0, data=0x100509f30 &quot;&lt;html&gt;\n &lt;!--  &lt;script&gt;console.log(\&quot;test\&quot;)&lt;/script&gt; --&gt;\n\n&lt;body&gt;\n\t&lt;!-- Delay the onload event using a slow image --&gt;\n\t&lt;!-- &lt;img src=\&quot;http://localhost:8000/history/resources/slow-image.php\&quot; /&gt; --&gt;\n&lt;/body&quot;..., length=210) at /Users/achicu/code/webkit/Source/WebCore/loader/DocumentLoader.cpp:861
#21 0x0000000103f8f268 in WebCore::CachedRawResource::didAddClient (this=0x1005aa2b0, c=0x1110c5200) at /Users/achicu/code/webkit/Source/WebCore/loader/cache/CachedRawResource.cpp:137
#22 0x0000000103f97244 in WebCore::CachedResource::CachedResourceCallback::timerFired (this=0x1104571a0) at /Users/achicu/code/webkit/Source/WebCore/loader/cache/CachedResource.cpp:922
#23 0x0000000103f98a03 in WebCore::Timer&lt;WebCore::CachedResource::CachedResourceCallback&gt;::fired (this=0x1104571b0) at Timer.h:114
#24 0x0000000105750733 in WebCore::ThreadTimers::sharedTimerFiredInternal (this=0x11041d990) at /Users/achicu/code/webkit/Source/WebCore/platform/ThreadTimers.cpp:129
#25 0x0000000105750449 in WebCore::ThreadTimers::sharedTimerFired () at /Users/achicu/code/webkit/Source/WebCore/platform/ThreadTimers.cpp:105
#26 0x00000001054ea113 in WebCore::timerFired () at /Users/achicu/code/webkit/Source/WebCore/platform/mac/SharedTimerMac.mm:133
#27 0x00007fff894db804 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ ()
#28 0x00007fff894db31d in __CFRunLoopDoTimer ()
#29 0x00007fff894c0ad9 in __CFRunLoopRun ()
#30 0x00007fff894c00e2 in CFRunLoopRunSpecific ()
#31 0x00007fff8919eeb4 in RunCurrentEventLoopInMode ()
#32 0x00007fff8919ec52 in ReceiveNextEventCommon ()
#33 0x00007fff8919eae3 in BlockUntilNextEventMatchingListInMode ()
#34 0x00007fff82f63533 in _DPSNextEvent ()
#35 0x00007fff82f62df2 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#36 0x00007fff82f5a1a3 in -[NSApplication run] ()
#37 0x00000001012d7fef in WebKit::WebContentProcessMainDelegate::startRunLoop (this=0x7fff5fbff5d0) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm:171
#38 0x00000001012d702f in WebKit::ChildProcessMain&lt;WebKit::WebProcess, WebKit::WebContentProcessMainDelegate&gt; (argc=6, argv=0x7fff5fbff6f0) at ChildProcessEntryPoint.h:93
#39 0x00000001012d6d7b in WebContentProcessMain (argc=6, argv=0x7fff5fbff6f0) at /Users/achicu/code/webkit/Source/WebKit2/WebProcess/EntryPoint/mac/LegacyProcess/WebContentProcessMain.mm:183
#40 0x0000000100000d1d in WebKit::BootstrapMain (argc=6, argv=0x7fff5fbff6f0) at /Users/achicu/code/webkit/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm:76
#41 0x0000000100000b92 in main (argc=6, argv=0x7fff5fbff6f0) at /Users/achicu/code/webkit/Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessMain.mm:83</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>939554</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2013-10-14 11:19:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/15222457&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>939633</commentid>
    <comment_count>2</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2013-10-14 14:13:37 -0700</bug_when>
    <thetext>Safari has a few features that execute scripts like AutoFill and apparently do-not-track. Thanks for the feedback, but this isn&apos;t something we would fix in WebKit. So marking this as invalid.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>