Don't dispatch 'beforeload' event inside FrameView::layout()
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2014 02:25:28 +0000 (02:25 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 May 2014 02:25:28 +0000 (02:25 +0000)
commitba0093f365059328c9b5fc52a7148dd67e1f7c6b
treee6038039b59b4e01a523187e3eb5a912717ca7a7
parent6eaa9780c2d6594d165def1f710b063e4ea7bdf5
Don't dispatch 'beforeload' event inside FrameView::layout()

https://bugs.webkit.org/show_bug.cgi?id=132621
<rdar://problem/15661470>

This merges Blink revision 162073 with minor renaming and style
changes. From that commit:

Executing JavaScript code inside FrameView::layout() is problematic.
e.g. an assertion failure tested in fast/events/beforeload-assertion.html.
We should avoid it.

This CL makes 'beforeload' event dispatching for plugins and iframes asynchronous,
except plugin access from JavaScript code (HTMLPlugInElement::
renderWidgetForJSBindings).

Reviewed by Brent Fulgham.

Source/WebCore:
Tests: fast/events/beforeload-assertion.html
       fast/events/beforeload-iframe-crash.html
       fast/events/beforeload-input-time-crash.html

* WebCore.exp.in:
* dom/Document.cpp:
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
* dom/Document.h:
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::renderWidgetForJSBindings):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::renderWidgetForJSBindings):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::renderWidgetForJSBindings):
* page/FrameView.cpp:
(WebCore::FrameView::FrameView):
(WebCore::FrameView::reset):
(WebCore::FrameView::updateEmbeddedObjectsTimerFired):
(WebCore::FrameView::flushAnyPendingPostLayoutTasks):
(WebCore::FrameView::performPostLayoutTasks):
* page/FrameView.h:
* testing/Internals.cpp:
(WebCore::Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:
* compositing/plugins/composited-plugin.html:
* compositing/plugins/no-backing-store.html:
* fast/dom/beforeload/flash-before-load.html:
* fast/events/beforeload-assertion-expected.txt: Added.
* fast/events/beforeload-assertion.html: Added.
* fast/events/beforeload-iframe-crash-expected.txt: Added.
* fast/events/beforeload-iframe-crash.html: Added.
* fast/events/beforeload-input-time-crash-expected.txt: Added.
* fast/events/beforeload-input-time-crash.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html:
* http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html:
* http/tests/security/contentSecurityPolicy/object-src-no-url-allowed.html:
* http/tests/security/contentSecurityPolicy/object-src-no-url-blocked.html:
* http/tests/security/contentSecurityPolicy/object-src-none-allowed.html:
* http/tests/security/contentSecurityPolicy/object-src-none-blocked.html:
* http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js:
(testImpl.iframe.onload):
(testImpl):
* http/tests/security/mixedContent/insecure-plugin-in-iframe.html:
* platform/mac/plugins/supports-carbon-event-model.html:
* plugins/get-user-agent-with-null-npp-from-npp-new.html:
* plugins/mouse-click-plugin-clears-selection.html:
* plugins/netscape-plugin-map-data-to-src.html:
* plugins/no-mime-with-valid-extension.html:
* plugins/plugin-initiate-popup-window.html:
* plugins/windowless_plugin_paint_test.html:
* resources/plugin.js: Added.
(runAfterPluginLoad):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
38 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/plugins/composited-plugin.html
LayoutTests/compositing/plugins/no-backing-store.html
LayoutTests/fast/dom/beforeload/flash-before-load.html
LayoutTests/fast/events/beforeload-assertion-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/beforeload-assertion.html [new file with mode: 0644]
LayoutTests/fast/events/beforeload-iframe-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/beforeload-iframe-crash.html [new file with mode: 0644]
LayoutTests/fast/events/beforeload-input-time-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/beforeload-input-time-crash.html [new file with mode: 0644]
LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-notype-data.html
LayoutTests/http/tests/security/contentSecurityPolicy/1.1/plugintypes-nourl-blocked.html
LayoutTests/http/tests/security/contentSecurityPolicy/object-src-no-url-allowed.html
LayoutTests/http/tests/security/contentSecurityPolicy/object-src-no-url-blocked.html
LayoutTests/http/tests/security/contentSecurityPolicy/object-src-none-allowed.html
LayoutTests/http/tests/security/contentSecurityPolicy/object-src-none-blocked.html
LayoutTests/http/tests/security/contentSecurityPolicy/resources/multiple-iframe-plugin-test.js
LayoutTests/http/tests/security/mixedContent/insecure-plugin-in-iframe.html
LayoutTests/platform/mac/plugins/supports-carbon-event-model.html
LayoutTests/plugins/get-user-agent-with-null-npp-from-npp-new.html
LayoutTests/plugins/mouse-click-plugin-clears-selection.html
LayoutTests/plugins/netscape-plugin-map-data-to-src.html
LayoutTests/plugins/no-mime-with-valid-extension.html
LayoutTests/plugins/plugin-initiate-popup-window.html
LayoutTests/plugins/windowless_plugin_paint_test.html
LayoutTests/resources/plugin.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl