Closed Bug 1446517 Opened 6 years ago Closed 6 years ago

move some webrequest auth tests to xpcshell

Categories

(WebExtensions :: Request Handling, enhancement)

58 Branch
enhancement
Not set
normal

Tracking

(firefox61 fixed)

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: mixedpuppy, Assigned: mixedpuppy)

Details

Attachments

(1 file)

      No description provided.
Please yes...
Comment on attachment 8959679 [details]
Bug 1446517 - move some webRequest auth tests to xpcshell,

https://reviewboard.mozilla.org/r/228508/#review234356

Thank you!

::: toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js:14
(Diff revision 1)
> -    xhr.open("GET", url);
> -    xhr.onload = resolve;
> -    xhr.onabort = reject;
> -    xhr.onerror = reject;
> -    xhr.send();
> -  });
> +const server = createHttpServer({hosts: HOSTS});
> +
> +const BASE_URL = "http://example.com";
> +
> +// Save seen realms for cache checking.
> +let realms = [];

Nit: This should probably be a `Set`

::: toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js:46
(Diff revision 1)
> -}
> +  }
>  
> -function getAuthHandler(result, blocking = true) {
> -  function background(result) {
> +  response.setHeader("Content-Type", "text/plain; charset=UTF-8", false);
> +  if (proxy_realm && !request.hasHeader("Proxy-Authorization")) {
> +    // We're not testing anything that requires checking the proxy auth user/password.
> +    response.setStatusLine("1.0", 407, "Proxy authentication required");

Nit: Template string, please.

::: toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js:127
(Diff revision 1)
> +        extension.awaitMessage("onBeforeRequest"),
> +        extension.awaitMessage("onCompleted"),
> +      ]);
> +    }),
> +  ]);
> +  // let body = await testXHR(requestUrl);

Remove?

::: toolkit/components/extensions/test/xpcshell/test_ext_webRequest_auth.js:135
(Diff revision 1)
> +  events = Promise.all([
> +    extension.awaitMessage("onBeforeRequest"),
> +    extension.awaitMessage("onCompleted"),
> +  ]);

No need for this dance. Just do both awaitMessages after you load the content page. Same above, really... and below.
Attachment #8959679 - Flags: review?(kmaglione+bmo) → review+
Pushed by mixedpuppy@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/982d2108e78d
move some webRequest auth tests to xpcshell, r=kmag
https://hg.mozilla.org/mozilla-central/rev/982d2108e78d
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Flags: qe-verify-
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: