1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/newtab/preloaderContent.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,31 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +(function () { // bug 673569 workaround :( 1.9 + 1.10 +const ALLOW_BG_CAPTURES_MSG = "BrowserNewTabPreloader:allowBackgroundCaptures"; 1.11 + 1.12 +addMessageListener(ALLOW_BG_CAPTURES_MSG, function onMsg(msg) { 1.13 + removeMessageListener(ALLOW_BG_CAPTURES_MSG, onMsg); 1.14 + 1.15 + if (content.document.readyState == "complete") { 1.16 + setAllowBackgroundCaptures(); 1.17 + return; 1.18 + } 1.19 + 1.20 + // This is the case when preloading is disabled. 1.21 + addEventListener("load", function onLoad(event) { 1.22 + if (event.target == content.document) { 1.23 + removeEventListener("load", onLoad, true); 1.24 + setAllowBackgroundCaptures(); 1.25 + } 1.26 + }, true); 1.27 +}); 1.28 + 1.29 +function setAllowBackgroundCaptures() { 1.30 + content.document.documentElement.setAttribute("allow-background-captures", 1.31 + "true"); 1.32 +} 1.33 + 1.34 +})();