We are going to infer all RequestContext types from the corresponding
nsContentPolicyType. It no longer makes sense to store both of these on
InternalRequest. This has the extra benefit that we don't need to worry
about keeping them in sync any more.
As the documentation in InternalRequest.h in this patch shows, the
mapping between nsContentPolicyType and RequestContext is not complete
yet. Because the InternalRequest object needs to know the actual
nsContentPolicyType in order for FetchDriver to be able to use that
information, we can't just store the RequestContext. Therefore, this
patch adds both of these to InternalRequest. Once we get to a stage
where we have a complete mapping of these values, we can store only one
of them and compute the other from it. That requires addressing all of
the TODO comments in the InternalRequest.h documentation.
Note when the Fetch is coming from the main thread or a worker. Also
count Requests just passed through a Service Worker.
--HG--
extra : rebase_source : 5ab71144821a97f0ec1874d467da68f4fd171705
Use nsCrossSiteListenerProxy.h helpers to implement CORS support.
Several CORS fixes and lots of CORS tests.
Fixes:
Use empty string stream if response has no stream.
Parse Access-Control-Expose-Headers correctly.
Copy over remaining InternalRequest constructor attributes and set unsafe request flag.
Call FailWithNetworkError() in more cases.
Add non-simple Request headers to unsafeHeaders list for CORS check.
Do not AsyncOpen channel directly when CORS preflight is required.
Fix check for simple request method (was checking the opposite condition).
--HG--
extra : rebase_source : 4b08f6a5959e470394c88249b39464b3b7d20948
Add various [SameObject]/[NewObject] annotations.
Adds RequestCache enum.
Ensures that cors-with-forced-preflight is translated to cors in getter.
Reject cors-with-forced-preflight as a valid mode value in Request constructor.
--HG--
extra : rebase_source : 3a70d53965def8fe02deec307367b9fda3458935
Add various [SameObject]/[NewObject] annotations.
Adds RequestCache enum.
Ensures that cors-with-forced-preflight is translated to cors in getter.
Reject cors-with-forced-preflight as a valid mode value in Request constructor.
--HG--
extra : rebase_source : 0b621e13dc5cdbf740fb7d380f96f1380cd5a3eb
extra : amend_source : 7ced6d36ed7212271163c6aa1baacc7d5ca39647
This patch has the following big pieces:
HTTP support in FetchDriver, which requires the principal of the caller to be passed.
Managing worker lifetime when a fetch() call is in progress.
Managing worker lifetime when a Response body is being read.
Using nsIPipe to link network streams to Request/Response body streams.
Using nsIInputStreamPump to convert Request/Response body streams into respective types.
Folded:
Bug 1039846 - Fetch API: Use a pipe to immediately start writing HTTP body data to InternalResponse.
Bug 1039846 - Assert bodystream can be set only once
Bug 1039846 - Add feature when handling fetch responses on workers
Bug 1039846 - Try to retarget http fetch delivery off main thread.
Bug 1039846 - Safely consume body using nsIInputStreamPump on workers and main thread.
Bug 1039846 - Retarget body reading to stream transport service.
--HG--
extra : rebase_source : 809c4e799835ad6fd153b673cad70109d257ab6c