mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1510569 - Use Maybe<T> directly in TabChild::PrepareProgressListenerData r=nika,Alex_Gaynor
Differential Revision: https://phabricator.services.mozilla.com/D24806 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
27a7e12ecc
commit
08dfb4b9c8
@ -3310,47 +3310,43 @@ NS_IMETHODIMP TabChild::OnSecurityChange(nsIWebProgress* aWebProgress,
|
||||
NS_IMETHODIMP TabChild::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
uint32_t aEvent) {
|
||||
WebProgressData webProgressData;
|
||||
Maybe<WebProgressData> webProgressData;
|
||||
RequestData requestData;
|
||||
nsresult rv = PrepareProgressListenerData(aWebProgress, aRequest,
|
||||
webProgressData, requestData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
Maybe<WebProgressData> maybeWebProgressData;
|
||||
if (aWebProgress) {
|
||||
maybeWebProgressData.emplace(webProgressData);
|
||||
}
|
||||
Unused << SendOnContentBlockingEvent(maybeWebProgressData, requestData,
|
||||
aEvent);
|
||||
Unused << SendOnContentBlockingEvent(webProgressData, requestData, aEvent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult TabChild::PrepareProgressListenerData(
|
||||
nsIWebProgress* aWebProgress, nsIRequest* aRequest,
|
||||
WebProgressData& aWebProgressData, RequestData& aRequestData) {
|
||||
Maybe<WebProgressData>& aWebProgressData, RequestData& aRequestData) {
|
||||
if (aWebProgress) {
|
||||
aWebProgressData.emplace();
|
||||
|
||||
bool isTopLevel = false;
|
||||
nsresult rv = aWebProgress->GetIsTopLevel(&isTopLevel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aWebProgressData.isTopLevel() = isTopLevel;
|
||||
aWebProgressData->isTopLevel() = isTopLevel;
|
||||
|
||||
bool isLoadingDocument = false;
|
||||
rv = aWebProgress->GetIsLoadingDocument(&isLoadingDocument);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aWebProgressData.isLoadingDocument() = isLoadingDocument;
|
||||
aWebProgressData->isLoadingDocument() = isLoadingDocument;
|
||||
|
||||
uint32_t loadType = 0;
|
||||
rv = aWebProgress->GetLoadType(&loadType);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aWebProgressData.loadType() = loadType;
|
||||
aWebProgressData->loadType() = loadType;
|
||||
|
||||
uint64_t DOMWindowID = 0;
|
||||
// The DOM Window ID getter here may throw if the inner or outer windows
|
||||
// aren't created yet or are destroyed at the time we're making this call
|
||||
// but that isn't fatal so ignore the exceptions here.
|
||||
Unused << aWebProgress->GetDOMWindowID(&DOMWindowID);
|
||||
aWebProgressData.DOMWindowID() = DOMWindowID;
|
||||
aWebProgressData->DOMWindowID() = DOMWindowID;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
|
||||
|
@ -792,7 +792,7 @@ class TabChild final : public TabChildBase,
|
||||
|
||||
nsresult PrepareProgressListenerData(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
WebProgressData& aWebProgressData,
|
||||
Maybe<WebProgressData>& aWebProgressData,
|
||||
RequestData& aRequestData);
|
||||
|
||||
class DelayedDeleteRunnable;
|
||||
|
@ -2215,17 +2215,16 @@ mozilla::ipc::IPCResult TabParent::RecvOnContentBlockingEvent(
|
||||
nsCOMPtr<nsIBrowser> browser =
|
||||
mFrameElement ? mFrameElement->AsBrowser() : nullptr;
|
||||
if (browser) {
|
||||
if (aWebProgressData.isNothing()) {
|
||||
if (aWebProgressData) {
|
||||
Unused << browser->CallWebProgressContentBlockingEventListeners(
|
||||
false, false, false, 0, 0, aRequestData.requestURI(),
|
||||
true, aWebProgressData->isTopLevel(),
|
||||
aWebProgressData->isLoadingDocument(), aWebProgressData->loadType(),
|
||||
aWebProgressData->DOMWindowID(), aRequestData.requestURI(),
|
||||
aRequestData.originalRequestURI(), aRequestData.matchedList(),
|
||||
aEvent);
|
||||
} else {
|
||||
Unused << browser->CallWebProgressContentBlockingEventListeners(
|
||||
true, aWebProgressData.ref().isTopLevel(),
|
||||
aWebProgressData.ref().isLoadingDocument(),
|
||||
aWebProgressData.ref().loadType(),
|
||||
aWebProgressData.ref().DOMWindowID(), aRequestData.requestURI(),
|
||||
false, false, false, 0, 0, aRequestData.requestURI(),
|
||||
aRequestData.originalRequestURI(), aRequestData.matchedList(),
|
||||
aEvent);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user