Bug 1575352 - Remove dynamic linking of urlmon for MinGW. r=aklotz
authorToshihito Kikuchi <tkikuchi@mozilla.com>
Tue, 27 Aug 2019 22:19:38 +0000
changeset 554055 137971f64c25356ca3a3a6e37fa879e301a4528f
parent 554054 9f0e21a3a418ec27f94b53f326b2e288e8fc730e
child 554056 b9dbcc4fdabfde2fbbfb60127d690329ccbc1496
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1575352
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1575352 - Remove dynamic linking of urlmon for MinGW. r=aklotz 4eca0f08c43b73dc1dd908fad58bdfd7f6973119 introduced dynamic linking of urlmon for MinGW as a workaround. Now that MinGW was updated, we can remove that workaround. Differential Revision: https://phabricator.services.mozilla.com/D43281
widget/windows/UrlmonHeaderOnlyUtils.h
widget/windows/tests/TestUriValidation.cpp
--- a/widget/windows/UrlmonHeaderOnlyUtils.h
+++ b/widget/windows/UrlmonHeaderOnlyUtils.h
@@ -34,41 +34,26 @@ namespace mozilla {
  * As we need to get a full uri including a fragment, this function does 2).
  */
 inline LauncherResult<_bstr_t> UrlmonValidateUri(const wchar_t* aUri) {
   LauncherResult<UniqueAbsolutePidl> pidlResult = ShellParseDisplayName(aUri);
   if (pidlResult.isErr()) {
     return LAUNCHER_ERROR_FROM_RESULT(pidlResult);
   }
 
-#ifndef __MINGW32__
-  const auto createUri = CreateUri;
-#else
-  HMODULE urlmonDll = GetModuleHandleW(L"urlmon");
-  if (!urlmonDll) {
-    return LAUNCHER_ERROR_FROM_LAST();
-  }
-
-  const auto createUri = reinterpret_cast<decltype(CreateUri)*>(
-      GetProcAddress(urlmonDll, "CreateUri"));
-  if (!createUri) {
-    return LAUNCHER_ERROR_FROM_LAST();
-  }
-#endif
-
   // The value of |flags| is the same value as used in ieframe!_EnsureIUri in
   // Win7, which is called behind SHParseDisplayName.  In Win10, on the other
   // hand, an flag 0x03000000 is also passed to CreateUri, but we don't
   // specify it because it's undocumented and unknown.
   constexpr DWORD flags =
       Uri_CREATE_NO_DECODE_EXTRA_INFO | Uri_CREATE_CANONICALIZE |
       Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_PRE_PROCESS_HTML_URI |
       Uri_CREATE_IE_SETTINGS;
   RefPtr<IUri> uri;
-  HRESULT hr = createUri(aUri, flags, 0, getter_AddRefs(uri));
+  HRESULT hr = CreateUri(aUri, flags, 0, getter_AddRefs(uri));
   if (FAILED(hr)) {
     return LAUNCHER_ERROR_FROM_HRESULT(hr);
   }
 
   _bstr_t bstrUri;
 
   hr = uri->GetAbsoluteUri(bstrUri.GetAddress());
   if (FAILED(hr)) {
--- a/widget/windows/tests/TestUriValidation.cpp
+++ b/widget/windows/tests/TestUriValidation.cpp
@@ -45,37 +45,22 @@ static LauncherResult<_bstr_t> ShellVali
   if (FAILED(hr)) {
     return LAUNCHER_ERROR_FROM_HRESULT(hr);
   }
 
   return bstrUri;
 }
 
 static LauncherResult<_bstr_t> GetFragment(const wchar_t* aUri) {
-#ifndef __MINGW32__
-  const auto createUri = CreateUri;
-#else
-  HMODULE urlmonDll = GetModuleHandleW(L"urlmon");
-  if (!urlmonDll) {
-    return LAUNCHER_ERROR_FROM_LAST();
-  }
-
-  const auto createUri = reinterpret_cast<decltype(CreateUri)*>(
-      GetProcAddress(urlmonDll, "CreateUri"));
-  if (!createUri) {
-    return LAUNCHER_ERROR_FROM_LAST();
-  }
-#endif
-
   constexpr DWORD flags =
       Uri_CREATE_NO_DECODE_EXTRA_INFO | Uri_CREATE_CANONICALIZE |
       Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_PRE_PROCESS_HTML_URI |
       Uri_CREATE_IE_SETTINGS;
   RefPtr<IUri> uri;
-  HRESULT hr = createUri(aUri, flags, 0, getter_AddRefs(uri));
+  HRESULT hr = CreateUri(aUri, flags, 0, getter_AddRefs(uri));
   if (FAILED(hr)) {
     return LAUNCHER_ERROR_FROM_HRESULT(hr);
   }
 
   _bstr_t bstrFragment;
   hr = uri->GetFragment(bstrFragment.GetAddress());
   if (FAILED(hr)) {
     return LAUNCHER_ERROR_FROM_HRESULT(hr);