mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Bug 1251229 P1 Strip fragment from request URL when creating FetchEvent. r=ehsan
This commit is contained in:
parent
183fc6e22a
commit
1169129154
2 changed files with 15 additions and 1 deletions
|
|
@ -141,6 +141,12 @@ public:
|
||||||
, mUnsafeRequest(false)
|
, mUnsafeRequest(false)
|
||||||
, mUseURLCredentials(false)
|
, mUseURLCredentials(false)
|
||||||
{
|
{
|
||||||
|
// Normally we strip the fragment from the URL in Request::Constructor.
|
||||||
|
// If internal code is directly constructing this object they must
|
||||||
|
// strip the fragment first. Since these should be well formed URLs we
|
||||||
|
// can use a simple check for a fragment here. The full parser is
|
||||||
|
// difficult to use off the main thread.
|
||||||
|
MOZ_ASSERT(mURL.Find(NS_LITERAL_CSTRING("#")) == kNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<InternalRequest> Clone();
|
already_AddRefed<InternalRequest> Clone();
|
||||||
|
|
|
||||||
|
|
@ -1044,7 +1044,15 @@ public:
|
||||||
rv = mInterceptedChannel->GetSecureUpgradedChannelURI(getter_AddRefs(uri));
|
rv = mInterceptedChannel->GetSecureUpgradedChannelURI(getter_AddRefs(uri));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = uri->GetSpec(mSpec);
|
// Normally we rely on the Request constructor to strip the fragment, but
|
||||||
|
// when creating the FetchEvent we bypass the constructor. So strip the
|
||||||
|
// fragment manually here instead. We can't do it later when we create
|
||||||
|
// the Request because that code executes off the main thread.
|
||||||
|
nsCOMPtr<nsIURI> uriNoFragment;
|
||||||
|
rv = uri->CloneIgnoringRef(getter_AddRefs(uriNoFragment));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
rv = uriNoFragment->GetSpec(mSpec);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
uint32_t loadFlags;
|
uint32_t loadFlags;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue