• bweinstein@apple.com's avatar
    REGRESSION (r66129): Loading full-frame .swf file crashes with flash blocker extension enabled · 15e6c2d7
    bweinstein@apple.com authored
    Reviewed by Brady Eidson.
    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
    * 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
    (WebCore::PluginDocument::setShouldLoadPluginManually): Set whether or not we should load the plugin
    * loader/SubframeLoader.cpp:
    (WebCore::SubframeLoader::loadPlugin): Check if we should load the plugin manually according to the plugin
    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
plugin-document-load-prevented-userscript-expected.txt 172 Bytes