Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3843)

Unified Diff: Source/platform/PluginScriptForbiddenScope.h

Issue 1170413003: Add a scoping object to help block scripting during plugin destruction. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rename static counter Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/platform/PluginScriptForbiddenScope.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/PluginScriptForbiddenScope.h
diff --git a/Source/platform/PluginScriptForbiddenScope.h b/Source/platform/PluginScriptForbiddenScope.h
new file mode 100644
index 0000000000000000000000000000000000000000..327b4feb9f61beb097ca9e4af88b655ba6117798
--- /dev/null
+++ b/Source/platform/PluginScriptForbiddenScope.h
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PluginScriptForbiddenScope_h
+#define PluginScriptForbiddenScope_h
+
+#include "platform/PlatformExport.h"
+
+namespace blink {
+
+// Similar to ScriptForbiddenScope, but more selective. This is intended to help
+// reduce the number of places where Flash can run a nested message loop as its
+// plugin element is being destroyed. One of the reasons that Flash runs this
+// nested message loop is to allow Flash content to synchronously script the
+// page when the plugin element is destroyed.
+//
+// This is problematic for many reasons: the DOM may not be in a consistent
+// state, since Blink is in the middle of detaching nodes, nested message loops
+// can cause normally impossible conditions to occur (https://crbug.com/367210),
+// etc.
+//
+// When this object is instantiated on the stack, it allows execution of event
+// handlers, etc but blocks attempts by plugins to call back into Blink to
+// execute script.
+//
+// Background:
+// For historical reasons, Flash has allowed synchronous scripting during
+// teardown of the plugin. This is generally problematic, but sites apparently
+// rely on this behavior. Over time, Blink has added restrictions on this
+// synchronous scripting: for example, past a certain point in Frame detach,
+// script execution by Flash is ignored: https://crbug.com/371084.
+//
+// Unfortunately, there are still ways for plugins to synchronously script
+// during Document detach: if an unload handler removes a Flash plugin element,
+// that will run the nested message loop, etc. This scoper is intended to block
+// those usages, with the eventual goal that Frame detach will never have to run
+// a nested message loop.
+class PLATFORM_EXPORT PluginScriptForbiddenScope {
+public:
+ PluginScriptForbiddenScope();
+ ~PluginScriptForbiddenScope();
+
+ static bool isForbidden();
+};
+
+} // namespace blink
+
+#endif // PluginScriptForbiddenScope_h
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | Source/platform/PluginScriptForbiddenScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698