Bug 1760009 - Don't strip the URL query parameters if there is no triggering principal. r=smaug
In the case where the triggering principal doesn't exist, calling nsDocShellLoadState::MaybeStripTrackerQueryStrings() will crash. It's becuase we will access the triggering principal in the function. The patch makes the function to return early if the triggering prinicpal doesn't exist. In this case, we cannot decide if we need to strip the URL because the information from the triggering principal is lacking. Therefore, we can only return and don't strip the URL. Also, this can avoid crashing Firefox. Differential Revision: https://phabricator.services.mozilla.com/D141594
This commit is contained in:
@@ -581,6 +581,12 @@ void nsDocShellLoadState::MaybeStripTrackerQueryStrings(
|
||||
BrowsingContext* aContext, nsIURI* aCurrentUnstrippedURI) {
|
||||
MOZ_ASSERT(aContext);
|
||||
|
||||
// Return early if the triggering principal doesn't exist. This could happen
|
||||
// when loading a URL by using a browsing context in the Browser Toolbox.
|
||||
if (!TriggeringPrincipal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We don't need to strip for sub frames because the query string has been
|
||||
// stripped in the top-level content. Also, we don't apply stripping if it
|
||||
// is triggered by addons.
|
||||
|
||||
Reference in New Issue
Block a user