tor-browser

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

finalizeAd.tentative.https.sub.window.js (1417B)


      1 // META: script=/resources/testdriver.js
      2 // META: script=/resources/testdriver-vendor.js
      3 'use strict';
      4 
      5 const okayAuctionRequest = {
      6  seller: "https://{{host}}:{{ports[https][0]}}",
      7  decisionLogicURL: "https://{{host}}:{{ports[https][0]}}",
      8  perBuyerSignals: {"{{host}}": { randomParam: "value1" }},
      9  auctionSignals: "pubCode123",
     10  sellerSignals: { someKey: "sellerValue" }
     11 };
     12 
     13 test(() => {
     14  assert_not_equals(navigator.finalizeAd, undefined);
     15 }, "finalizeAd() should be supported on the navigator interface.");
     16 
     17 promise_test(async t => {
     18  const finalizePromise = navigator.finalizeAd({}, okayAuctionRequest);
     19 
     20  await promise_rejects_js(t, TypeError, finalizePromise);
     21 }, "finalizeAd() should reject an invalid Ads object.");
     22 
     23 promise_test(async t => {
     24  const auctionRequest = Object.assign({}, okayAuctionRequest);
     25  delete auctionRequest.decisionLogicURL;
     26 
     27  const finalizePromise = navigator.finalizeAd({}, auctionRequest);
     28 
     29  await promise_rejects_js(t, TypeError, finalizePromise);
     30 }, "finalizeAd() should reject a missing decisionLogicURL.");
     31 
     32 promise_test(async t => {
     33  const auctionRequest = Object.assign({}, okayAuctionRequest);
     34  auctionRequest.decisionLogicURL = "http://{{host}}:{{ports[https][0]}}";
     35 
     36  const finalizePromise = navigator.finalizeAd({}, auctionRequest);
     37 
     38  await promise_rejects_js(t, TypeError, finalizePromise);
     39 }, "finalizeAd() should reject a non-HTTPS decisionLogicURL.");