| Index: lib/content/snippets.js |
| =================================================================== |
| --- a/lib/content/snippets.js |
| +++ b/lib/content/snippets.js |
| @@ -856,25 +856,28 @@ |
| * Strips a query string parameter from <code>fetch()</code> calls. |
| * |
| * @param {string} name The name of the parameter. |
| * @param {?string} [urlPattern] An optional pattern that the URL must match. |
| */ |
| function stripFetchQueryParameter(name, urlPattern = null) |
| { |
| let fetch_ = window.fetch; |
| + if (typeof fetch_ != "function") |
| + return; |
| + |
| let urlRegExp = urlPattern ? toRegExp(urlPattern) : null; |
| window.fetch = function fetch(...args) |
| { |
| let [source] = args; |
| if (typeof source == "string" && |
| (!urlRegExp || urlRegExp.test(source))) |
| { |
| let url = new URL(source); |
| url.searchParams.delete(name); |
| args[0] = url.href; |
| } |
| return fetch_.apply(this, args); |
|
a.giammarchi
2019/02/21 10:26:58
cannot we just `return fetch_(...args)` after late
Manish Jethani
2019/02/21 10:35:04
I don't see why we should assume anything about th
|
| }; |
| } |
| -exports["strip-fetch-query-parameter"] = |
| - makeInjector(stripFetchQueryParameter); |
| +exports["strip-fetch-query-parameter"] = makeInjector(stripFetchQueryParameter, |
| + toRegExp, regexEscape); |