tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

iaspet.js (962B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Bug 1713701 - Shim Integral Ad Science iaspet.js
      9 *
     10 * Some sites use iaspet to place content, often together with Google Publisher
     11 * Tags. This shim prevents breakage when the script is blocked.
     12 */
     13 
     14 if (!window.__iasPET?.VERSION) {
     15  let queue = window?.__iasPET?.queue;
     16  if (!Array.isArray(queue)) {
     17    queue = [];
     18  }
     19 
     20  const response = JSON.stringify({
     21    brandSafety: {},
     22    slots: {},
     23  });
     24 
     25  function run(cmd) {
     26    try {
     27      cmd?.dataHandler?.(response);
     28    } catch (_) {}
     29  }
     30 
     31  queue.push = run;
     32 
     33  window.__iasPET = {
     34    VERSION: "1.16.18",
     35    queue,
     36    sessionId: "",
     37    setTargetingForAppNexus() {},
     38    setTargetingForGPT() {},
     39    start() {},
     40  };
     41 
     42  while (queue.length) {
     43    run(queue.shift());
     44  }
     45 }