forked from mirrors/gecko-dev
Bug 1852223 - [bidi] Handle intercepted requests in the authRequired phase r=webdriver-reviewers,Sasha
Depends on D194608 Differential Revision: https://phabricator.services.mozilla.com/D191236
This commit is contained in:
parent
24d7107212
commit
6ea3e18f18
1 changed files with 25 additions and 6 deletions
|
|
@ -490,11 +490,13 @@ class NetworkModule extends Module {
|
||||||
contextId,
|
contextId,
|
||||||
isNavigationRequest,
|
isNavigationRequest,
|
||||||
redirectCount,
|
redirectCount,
|
||||||
|
requestChannel,
|
||||||
requestData,
|
requestData,
|
||||||
responseData,
|
responseData,
|
||||||
timestamp,
|
timestamp,
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
|
let isBlocked = false;
|
||||||
try {
|
try {
|
||||||
const browsingContext = lazy.TabManager.getBrowsingContextById(contextId);
|
const browsingContext = lazy.TabManager.getBrowsingContextById(contextId);
|
||||||
if (!browsingContext) {
|
if (!browsingContext) {
|
||||||
|
|
@ -547,11 +549,28 @@ class NetworkModule extends Module {
|
||||||
authRequiredEvent,
|
authRequiredEvent,
|
||||||
this.#getContextInfo(browsingContext)
|
this.#getContextInfo(browsingContext)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (authRequiredEvent.isBlocked) {
|
||||||
|
isBlocked = true;
|
||||||
|
|
||||||
|
// requestChannel.suspend() is not needed here because the request is
|
||||||
|
// already blocked on the authentication prompt notification until
|
||||||
|
// one of the authCallbacks is called.
|
||||||
|
this.#blockedRequests.set(authRequiredEvent.request.request, {
|
||||||
|
request: requestChannel,
|
||||||
|
phase: InterceptPhase.AuthRequired,
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Once we implement network.continueWithAuth, we should create a
|
||||||
|
// promise here which will wait until the request is resumed and removes
|
||||||
|
// the request from the blockedRequests. See Bug 1826196.
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// Bug 1852223: Until we handle intercepted requests in the authRequired
|
if (!isBlocked) {
|
||||||
// phase, we should always forward the auth prompt notification so that it
|
// If the request was not blocked, forward the auth prompt notification
|
||||||
// can be handled by the browser.
|
// to the next consumer.
|
||||||
authCallbacks.forwardAuthPrompt();
|
authCallbacks.forwardAuthPrompt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -712,9 +731,9 @@ class NetworkModule extends Module {
|
||||||
phase: InterceptPhase.ResponseStarted,
|
phase: InterceptPhase.ResponseStarted,
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Once we implement network.continueRequest, we should create a
|
// TODO: Once we implement network.continueResponse, we should create a
|
||||||
// promise here which will wait until the request is resumed and removes
|
// promise here which will wait until the request is resumed and removes
|
||||||
// the request from the blockedRequests. See Bug 1850680.
|
// the request from the blockedRequests. See Bug 1853887.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue