michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: (function () { // bug 673569 workaround :( michael@0: michael@0: const ALLOW_BG_CAPTURES_MSG = "BrowserNewTabPreloader:allowBackgroundCaptures"; michael@0: michael@0: addMessageListener(ALLOW_BG_CAPTURES_MSG, function onMsg(msg) { michael@0: removeMessageListener(ALLOW_BG_CAPTURES_MSG, onMsg); michael@0: michael@0: if (content.document.readyState == "complete") { michael@0: setAllowBackgroundCaptures(); michael@0: return; michael@0: } michael@0: michael@0: // This is the case when preloading is disabled. michael@0: addEventListener("load", function onLoad(event) { michael@0: if (event.target == content.document) { michael@0: removeEventListener("load", onLoad, true); michael@0: setAllowBackgroundCaptures(); michael@0: } michael@0: }, true); michael@0: }); michael@0: michael@0: function setAllowBackgroundCaptures() { michael@0: content.document.documentElement.setAttribute("allow-background-captures", michael@0: "true"); michael@0: } michael@0: michael@0: })();