• bweinstein@apple.com's avatar
    REGRESSION (r66129): Loading full-frame .swf file crashes with flash blocker extension enabled · 15e6c2d7
    bweinstein@apple.com authored
    <https://bugs.webkit.org/show_bug.cgi?id=46773>
    <rdar://problem/8390975>
            
    Reviewed by Brady Eidson.
    
    WebCore: 
    
    After r66129, start scripts were run on plugin documents, and cancelling the load of a plugin
    document could cause Safari to crash.
            
    If a plugin load on an initial document is cancelled, we cancel the main resource load (where the
    main resource is the plugin), and if the load is restarted and allowed, we don't go through the manual
    loading path like we do on the initial load of a plugin in a plugin document.
    
    Tests: plugins/plugin-document-load-prevented-userscript.html
           plugins/plugin-document-willSendRequest-null.html
    
    * html/HTMLEmbedElement.cpp:
    (WebCore::HTMLEmbedElement::updateWidget): If the plugin load was cancelled, and this is in a
        plugin document, call a function on PluginDocument that cancels the main resource load, and
        sets a plugin document flag.
    * html/PluginDocument.cpp:
    (WebCore::PluginDocumentParser::appendBytes): Null check the widget's renderer, because it could be
        null if the load was cancelled.
    (WebCore::PluginDocument::PluginDocument): Initialize the new variable.
    (WebCore::PluginDocument::cancelManualPluginLoad): Cancel the main resource load of the plugin document
        (which is a plugin in the case of a plugin document).
    * html/PluginDocument.h:
    (WebCore::PluginDocument::shouldLoadPluginManually): Returns whether or not we should load the plugin
        manually.
    (WebCore::PluginDocument::setShouldLoadPluginManually): Set whether or not we should load the plugin
        manually.
    (WebCore::toPluginDocument):
    * loader/SubframeLoader.cpp:
    (WebCore::SubframeLoader::loadPlugin): Check if we should load the plugin manually according to the plugin
        document.
    
    LayoutTests: 
    
    Add tests testing how plugin documents behave when the loading of their plugins are cancelled.
    
    * plugins/plugin-document-load-prevented-userscript-expected.txt: Added.
    * plugins/plugin-document-load-prevented-userscript.html: Added. Tests cancelling the load of a 
        plugin in a plugin document using beforeload and preventDefault.
    * plugins/plugin-document-willSendRequest-null-expected.txt: Added.
    * plugins/plugin-document-willSendRequest-null.html: Added. Tests cancelling the load of a plugin
        in a plugin document by having willSendRequest return null.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    15e6c2d7
plugin-document-load-prevented-userscript-expected.txt 172 Bytes