summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 04:17:41 +0000
committertkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-05 04:17:41 +0000
commitc74c2af75d6cb364fe236efcee5fe08c1adefa83 (patch)
tree8735daea6e92407951c0e6d6a81b376210e33eb7
parent68528f773b9551c638d5b4b9cb7c02204da7443a (diff)
downloadchromium_src-c74c2af75d6cb364fe236efcee5fe08c1adefa83.zip
chromium_src-c74c2af75d6cb364fe236efcee5fe08c1adefa83.tar.gz
chromium_src-c74c2af75d6cb364fe236efcee5fe08c1adefa83.tar.bz2
Make sure plugin load.
We're going to make plugin loading asynchronous to fix severe problems. Some plugin-related tests assumes plugins are loaded synchronously, and such tests will fail. Accessing any JavaScript properties of a plugin element causes synchronous plugin loading. This CL adds some JavaScript property accesses to make the tests pass. BUG=322348 Review URL: https://codereview.chromium.org/95743002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238885 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/resources/extensions/web_view.js5
-rw-r--r--content/renderer/browser_plugin/browser_plugin_browsertest.cc3
-rw-r--r--content/test/data/npapi/plugin_url_request_referrer_test.html6
3 files changed, 12 insertions, 2 deletions
diff --git a/chrome/renderer/resources/extensions/web_view.js b/chrome/renderer/resources/extensions/web_view.js
index 6df0ae2..0d373ec 100644
--- a/chrome/renderer/resources/extensions/web_view.js
+++ b/chrome/renderer/resources/extensions/web_view.js
@@ -934,6 +934,11 @@ function registerBrowserPluginElement() {
internal.handleBrowserPluginAttributeMutation_(name, newValue);
};
+ proto.enteredViewCallback = function() {
+ // Load the plugin immediately.
+ var unused = this.nonExistentAttribute;
+ };
+
WebViewInternal.BrowserPlugin =
DocumentNatives.RegisterElement('browser-plugin', {extends: 'object',
prototype: proto});
diff --git a/content/renderer/browser_plugin/browser_plugin_browsertest.cc b/content/renderer/browser_plugin/browser_plugin_browsertest.cc
index 03f4cb8..36ee92c 100644
--- a/content/renderer/browser_plugin/browser_plugin_browsertest.cc
+++ b/content/renderer/browser_plugin/browser_plugin_browsertest.cc
@@ -23,7 +23,8 @@
namespace {
const char kHTMLForBrowserPluginObject[] =
"<object id='browserplugin' width='640px' height='480px'"
- " src='foo' type='%s'>";
+ " src='foo' type='%s'></object>"
+ "<script>document.querySelector('object').nonExistentAttribute;</script>";
const char kHTMLForBrowserPluginWithAllAttributes[] =
"<object id='browserplugin' width='640' height='480' type='%s'"
diff --git a/content/test/data/npapi/plugin_url_request_referrer_test.html b/content/test/data/npapi/plugin_url_request_referrer_test.html
index e5589e6..87e51fc 100644
--- a/content/test/data/npapi/plugin_url_request_referrer_test.html
+++ b/content/test/data/npapi/plugin_url_request_referrer_test.html
@@ -21,6 +21,10 @@ requests issued by plugins.
id="1"
mode="np_embed"
src="http://mock.http/dummy_plugin_referrer"
->
+></embed>
+<script>
+// Load the plugin immediately.
+document.querySelector('embed').nonExistentAttribute;
+</script>
</body>
</html>