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

Side by Side 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: Fix test. 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var nacl = null;
6
7 function loadNaClModule() {
8 nacl = document.createElement('embed');
9 nacl.addEventListener('load', onNaClModuleLoaded, true);
10 nacl.type = 'application/x-nacl';
11 nacl.width = 0;
12 nacl.height = 0;
13 nacl.src = 'ppapi_tests_extensions_load_unload.nmf';
14 document.body.appendChild(nacl);
15
16 // Request the offsetTop property to force a relayout. As of Apr 10, 2014
17 // this is needed if the module is being loaded in a background page (see
18 // crbug.com/350445).
19 nacl.offsetTop;
20 }
21
22 function detachNaClModule() {
23 document.body.removeChild(nacl);
24 }
bartfab (slow) 2015/05/18 09:57:41 Nit: Reset |nacl| back to |null|.
emaxx 2015/05/18 15:06:30 Done.
25
26 function onNaClModuleLoaded() {
27 chrome.test.sendMessage("nacl_module_loaded");
28 }
29
30 chrome.browserAction.onClicked.addListener(function(tab) {
31 if (!nacl)
32 loadNaClModule();
33 else
34 detachNaClModule();
35 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698