From 8c05a1711951f3cc9179eec2c086b0e88d42e5f0 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Fri, 19 Jul 2019 15:54:34 +0200 Subject: Make vAPI definitely global for non-background pages too --- js/vapi-client.js | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'js/vapi-client.js') diff --git a/js/vapi-client.js b/js/vapi-client.js index 8ef7805..e45cc4d 100644 --- a/js/vapi-client.js +++ b/js/vapi-client.js @@ -26,34 +26,19 @@ 'use strict'; (function (self) { - // https://bugs.chromium.org/p/project-zero/issues/detail?id=1225&desc=6#c10 - // eMatrix: does this apply to us? - // In the meantime, let's remove the useless `eMatrix' property from vAPI - if (self.vAPI === undefined) { - self.vAPI = {}; - } - - let vAPI = self.vAPI; // This is also used when vapi-core is not available - vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) + Math.random().toString(36).slice(2); - vAPI.setTimeout = vAPI.setTimeout || function (callback, delay) { - return setTimeout(function () { - callback(); - }, delay); - }; - vAPI.shutdown = (function () { - var jobs = []; + let jobs = []; - var add = function (job) { + let add = function (job) { jobs.push(job); }; - var exec = function () { + let exec = function () { //console.debug('Shutting down...'); - var job; + let job; while ((job = jobs.pop())) { job(); } -- cgit v1.2.3