diff --git a/toolkit/components/antitracking/AntiTrackingCommon.cpp b/toolkit/components/antitracking/AntiTrackingCommon.cpp index 6cdb94137afa..b1b3d967ef92 100644 --- a/toolkit/components/antitracking/AntiTrackingCommon.cpp +++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp @@ -220,10 +220,7 @@ int32_t CookiesBehavior(nsILoadInfo* aLoadInfo, // WebExtensions 3rd party URI always get BEHAVIOR_ACCEPT as cookieBehavior, // this is semantically equivalent to the principal having a AddonPolicy(). - bool is3rdPartyMozExt = false; - if (NS_SUCCEEDED( - a3rdPartyURI->SchemeIs("moz-extension", &is3rdPartyMozExt)) && - is3rdPartyMozExt) { + if (a3rdPartyURI->SchemeIs("moz-extension")) { return nsICookieService::BEHAVIOR_ACCEPT; } diff --git a/toolkit/components/antitracking/StorageAccess.cpp b/toolkit/components/antitracking/StorageAccess.cpp index a9f6c89088d2..e4b19e8937dc 100644 --- a/toolkit/components/antitracking/StorageAccess.cpp +++ b/toolkit/components/antitracking/StorageAccess.cpp @@ -138,12 +138,8 @@ static StorageAccess InternalStorageAllowedCheck( if (!uri) { Unused << aPrincipal->GetURI(getter_AddRefs(uri)); } - if (uri) { - bool isAbout = false; - MOZ_ALWAYS_SUCCEEDS(uri->SchemeIs("about", &isAbout)); - if (isAbout) { - return access; - } + if (uri && uri->SchemeIs("about")) { + return access; } if (!StorageDisabledByAntiTracking(aWindow, aChannel, aPrincipal, aURI, diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index dc1f0ac9ddee..6f1efe388054 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -1919,10 +1919,7 @@ nsNavBookmarks::OnPageChanged(nsIURI* aURI, uint32_t aChangedAttribute, changeData.bookmark.type = TYPE_BOOKMARK; // Favicons may be set to either pure URIs or to folder URIs - bool isPlaceURI; - rv = aURI->SchemeIs("place", &isPlaceURI); - NS_ENSURE_SUCCESS(rv, rv); - if (isPlaceURI) { + if (aURI->SchemeIs("place")) { nsNavHistory* history = nsNavHistory::GetHistoryService(); NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY); diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index 173d4ce55e98..0e19a54a8664 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -177,9 +177,7 @@ nsresult nsUrlClassifierStreamUpdater::FetchUpdate( // Set the appropriate content type for file/data URIs, for unit testing // purposes. // This is only used for testing and should be deleted. - bool match; - if ((NS_SUCCEEDED(aUpdateUrl->SchemeIs("file", &match)) && match) || - (NS_SUCCEEDED(aUpdateUrl->SchemeIs("data", &match)) && match)) { + if (aUpdateUrl->SchemeIs("file") || aUpdateUrl->SchemeIs("data")) { mChannel->SetContentType( NS_LITERAL_CSTRING("application/vnd.google.safebrowsing-update")); } else { diff --git a/toolkit/components/windowwatcher/nsWindowWatcher.cpp b/toolkit/components/windowwatcher/nsWindowWatcher.cpp index 6e6b88db6a80..f6292f56f037 100644 --- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp +++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp @@ -617,7 +617,7 @@ nsresult nsWindowWatcher::OpenWindowInternal( if (NS_FAILED(rv)) { return rv; } - uriToLoad->SchemeIs("chrome", &uriToLoadIsChrome); + uriToLoadIsChrome = uriToLoad->SchemeIs("chrome"); } bool nameSpecified = false; diff --git a/toolkit/mozapps/extensions/AddonContentPolicy.cpp b/toolkit/mozapps/extensions/AddonContentPolicy.cpp index 705073cfde75..004c5ead134e 100644 --- a/toolkit/mozapps/extensions/AddonContentPolicy.cpp +++ b/toolkit/mozapps/extensions/AddonContentPolicy.cpp @@ -111,11 +111,8 @@ AddonContentPolicy::ShouldLoad(nsIURI* aContentLocation, nsILoadInfo* aLoadInfo, // Only apply this policy to requests from documents loaded from // moz-extension URLs, or to resources being loaded from moz-extension URLs. - bool equals; - if (!((NS_SUCCEEDED(aContentLocation->SchemeIs("moz-extension", &equals)) && - equals) || - (NS_SUCCEEDED(requestOrigin->SchemeIs("moz-extension", &equals)) && - equals))) { + if (!(aContentLocation->SchemeIs("moz-extension") || + requestOrigin->SchemeIs("moz-extension"))) { return NS_OK; } diff --git a/toolkit/mozapps/extensions/AddonManagerWebAPI.cpp b/toolkit/mozapps/extensions/AddonManagerWebAPI.cpp index 9c721ac315ca..8b44fdd29876 100644 --- a/toolkit/mozapps/extensions/AddonManagerWebAPI.cpp +++ b/toolkit/mozapps/extensions/AddonManagerWebAPI.cpp @@ -55,9 +55,7 @@ bool AddonManagerWebAPI::IsValidSite(nsIURI* uri) { return false; } - bool isSecure; - nsresult rv = uri->SchemeIs("https", &isSecure); - if (NS_FAILED(rv) || !isSecure) { + if (!uri->SchemeIs("https")) { if (!(xpc::IsInAutomation() && Preferences::GetBool("extensions.webapi.testing.http", false))) { return false; @@ -65,7 +63,7 @@ bool AddonManagerWebAPI::IsValidSite(nsIURI* uri) { } nsAutoCString host; - rv = uri->GetHost(host); + nsresult rv = uri->GetHost(host); if (NS_FAILED(rv)) { return false; } diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp index f099193e630d..b28435919122 100644 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp @@ -175,10 +175,9 @@ static nsresult GetProxyFromEnvironment(const nsACString& aScheme, // Is there a way to specify "socks://" or something in these environment // variables? I can't find any documentation. - bool isHTTP; - rv = proxyURI->SchemeIs("http", &isHTTP); - NS_ENSURE_SUCCESS(rv, rv); - if (!isHTTP) return NS_ERROR_UNKNOWN_PROTOCOL; + if (!proxyURI->SchemeIs("http")) { + return NS_ERROR_UNKNOWN_PROTOCOL; + } nsAutoCString proxyHost; rv = proxyURI->GetHost(proxyHost); diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 7138fd94b8ac..bf8d5f5407a8 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1001,18 +1001,13 @@ nsXULAppInfo::GetServerURL(nsIURL** aServerURL) { NS_IMETHODIMP nsXULAppInfo::SetServerURL(nsIURL* aServerURL) { - bool schemeOk; - // only allow https or http URLs - nsresult rv = aServerURL->SchemeIs("https", &schemeOk); - NS_ENSURE_SUCCESS(rv, rv); - if (!schemeOk) { - rv = aServerURL->SchemeIs("http", &schemeOk); - NS_ENSURE_SUCCESS(rv, rv); - - if (!schemeOk) return NS_ERROR_INVALID_ARG; + // Only allow https or http URLs + if (!aServerURL->SchemeIs("http") && !aServerURL->SchemeIs("https")) { + return NS_ERROR_INVALID_ARG; } + nsAutoCString spec; - rv = aServerURL->GetSpec(spec); + nsresult rv = aServerURL->GetSpec(spec); NS_ENSURE_SUCCESS(rv, rv); return CrashReporter::SetServerURL(spec);