Skip to content

Commit

Permalink
Bug 1527717 - Check the registry for 'URL Protocol' when checking if …
Browse files Browse the repository at this point in the history
…a protocol handler exists. r=jmathies a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D19775

--HG--
extra : source : e3a71ebe4064261d62f1e36fc9915471663905c0
extra : intermediate-source : bb9e3868a7bf0e1eeca0209d9943732ffb855958
  • Loading branch information
Robert Strong committed Feb 15, 2019
1 parent 10ca2d2 commit 4495394
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions uriloader/exthandler/win/nsOSHelperAppService.cpp
Expand Up @@ -83,6 +83,29 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(
AL_EFFECTIVE, &pResult);
if (SUCCEEDED(hr)) {
CoTaskMemFree(pResult);
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
if (!regKey) {
return NS_ERROR_NOT_AVAILABLE;
}

nsresult rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
nsDependentString(scheme.get()),
nsIWindowsRegKey::ACCESS_QUERY_VALUE);
if (NS_FAILED(rv)) {
// Open will fail if the registry key path doesn't exist.
return NS_OK;
}

bool hasValue;
rv = regKey->HasValue(NS_LITERAL_STRING("URL Protocol"), &hasValue);
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
if (!hasValue) {
return NS_OK;
}

*aHandlerExists = true;
}
}
Expand Down

0 comments on commit 4495394

Please sign in to comment.