tor-browser

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

matchPatterns.js (731B)


      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 /* global ExtensionAPI */
      8 
      9 this.matchPatterns = class extends ExtensionAPI {
     10  getAPI(context) {
     11    return {
     12      matchPatterns: {
     13        getMatcher(patterns) {
     14          const set = new MatchPatternSet(patterns);
     15          return Cu.cloneInto(
     16            {
     17              matches: url => {
     18                return set.matches(url);
     19              },
     20            },
     21            context.cloneScope,
     22            {
     23              cloneFunctions: true,
     24            }
     25          );
     26        },
     27      },
     28    };
     29  }
     30 };