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

Unified Diff: ppapi/tests/extensions/load_unload/background.js

Issue 1117023002: Keep event page alive when there's some Pepper plugin on it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove DCHECK. Created 5 years, 7 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 | « ppapi/tests/extensions/extensions.gyp ('k') | ppapi/tests/extensions/load_unload/ext_icon.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/extensions/load_unload/background.js
diff --git a/ppapi/tests/extensions/load_unload/background.js b/ppapi/tests/extensions/load_unload/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..a77dcd0103d28183b2930ab934ab830e89976da7
--- /dev/null
+++ b/ppapi/tests/extensions/load_unload/background.js
@@ -0,0 +1,36 @@
+// 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.
+
+var nacl = null;
+
+function loadNaClModule() {
+ nacl = document.createElement('embed');
+ nacl.addEventListener('load', onNaClModuleLoaded, true);
+ nacl.type = 'application/x-nacl';
+ nacl.width = 0;
+ nacl.height = 0;
+ nacl.src = 'ppapi_tests_extensions_load_unload.nmf';
+ document.body.appendChild(nacl);
+
+ // Request the offsetTop property to force a relayout. As of Apr 10, 2014
+ // this is needed if the module is being loaded in a background page (see
+ // crbug.com/350445).
+ nacl.offsetTop;
+}
+
+function detachNaClModule() {
+ document.body.removeChild(nacl);
+ nacl = null;
+}
+
+function onNaClModuleLoaded() {
+ chrome.test.sendMessage("nacl_module_loaded");
+}
+
+chrome.browserAction.onClicked.addListener(function(tab) {
+ if (!nacl)
+ loadNaClModule();
+ else
+ detachNaClModule();
+});
« no previous file with comments | « ppapi/tests/extensions/extensions.gyp ('k') | ppapi/tests/extensions/load_unload/ext_icon.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698