Skip to content

Backported fix for bug 24622 does not compile with --enable-tests

Compiling commit c722d57604db58695140d95565a78433989fe9ca and later in our tor-browser repo with --enable-tests results in a busted build:

23:59.27 /var/tmp/dist/gcc/bin/g++ -o Unified_cpp_caps_tests_gtest0.o -c -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/system_wrappers -include /var/tmp/build/firefox-7a0a10b8ff98/config/gcc_hidden.h -DDEBUG=1 -DOS_POSIX=1 -DOS_LINUX=1 -DSTATIC_EXPORTABLE_JS_API -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -I/var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I/var/tmp/build/firefox-7a0a10b8ff98/ipc/chromium/src -I/var/tmp/build/firefox-7a0a10b8ff98/ipc/glue -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nspr -I/var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/mozilla-config.h -U_FORTIFY_SOURCE -fno-common -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wc++1z-compat -Wduplicated-cond -Wimplicit-fallthrough -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wformat -Wformat-security -Wformat-overflow=2 -fno-sized-deallocation -fsanitize=address -fsanitize=address -Dxmalloc=myxmalloc -U_FORTIFY_SOURCE -fno-common -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -Os -fno-omit-frame-pointer  -MD -MP -MF .deps/Unified_cpp_caps_tests_gtest0.o.pp   /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp
24:00.70 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsUtils.h:14:0,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupports.h:77,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISerializable.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h: In instantiation of 'nsCOMPtr<T>::~nsCOMPtr() [with T = nsIURI]':
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:25:20:   required from here
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsImpl.h:156:37: error: invalid static_cast from type 'nsIURI*' to type 'nsISupports*'
24:00.70    if (_p) NS_LogCOMPtrRelease((_c), static_cast<nsISupports*>(_p))
24:00.70                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:379:5: note: in expansion of macro 'NSCAP_LOG_RELEASE'
24:00.70      NSCAP_LOG_RELEASE(this, mRawPtr);
24:00.70      ^~~~~~~~~~~~~~~~~
24:00.70 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:23:0,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:91:41: error: invalid use of incomplete type 'class nsIURI'
24:00.70  #define NSCAP_RELEASE(this, ptr) (ptr)->Release()
24:00.70                                   ~~~~~~~^
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:381:7: note: in expansion of macro 'NSCAP_RELEASE'
24:00.70        NSCAP_RELEASE(this, mRawPtr);
24:00.70        ^~~~~~~~~~~~~
24:00.70 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10:0,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:45:7: note: forward declaration of 'class nsIURI'
24:00.70  class nsIURI; /* forward declaration */
24:00.70        ^~~~~~
24:00.70 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsUtils.h:14:0,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupports.h:77,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISerializable.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.70                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h: In instantiation of 'nsGetterAddRefs<T>::~nsGetterAddRefs() [with T = nsIURI]':
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:26:3:   required from here
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsImpl.h:153:47: error: invalid static_cast from type 'nsIURI*' to type 'nsISupports*'
24:00.70    if (_p != nullptr) NS_LogCOMPtrAddRef((_c), static_cast<nsISupports*>(_p))
24:00.70                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24:00.70 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:1144:5: note: in expansion of macro 'NSCAP_LOG_ASSIGNMENT'
24:00.70      NSCAP_LOG_ASSIGNMENT(reinterpret_cast<void*>(address_of(mTargetSmartPtr)),
24:00.70      ^~~~~~~~~~~~~~~~~~~~
24:00.74 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:23:0,
24:00.74                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10,
24:00.74                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.74                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.74                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.74 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h: In instantiation of 'void nsCOMPtr<T>::assert_validity() [with T = nsIURI]':
24:00.74 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:402:20:   required from 'nsCOMPtr<T>::nsCOMPtr() [with T = nsIURI]'
24:00.74 /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:25:20:   required from here
24:00.74 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:366:5: error: static assertion failed: nsCOMPtr only works for types with IIDs.  Either use RefPtr; add an IID to your type with NS_DECLARE_STATIC_IID_ACCESSOR/NS_DEFINE_STATIC_IID_ACCESSOR; or make the nsCOMPtr point to a base class with an IID.
24:00.74      static_assert(1 < sizeof(TestForIID<T>(nullptr)),
24:00.74      ^~~~~~~~~~~~~
24:00.78 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsUtils.h:14:0,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupports.h:77,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISerializable.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h: In instantiation of 'void nsCOMPtr<T>::assign_assuming_AddRef(T*) [with T = nsIURI]':
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:1099:25:   required from 'void** nsCOMPtr<T>::begin_assignment() [with T = nsIURI]'
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:725:50:   required from 'T** nsCOMPtr<T>::StartAssignment() [with T = nsIURI]'
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:1158:59:   required from 'nsGetterAddRefs<T>::operator T**() [with T = nsIURI]'
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:26:3:   required from here
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsImpl.h:153:47: error: invalid static_cast from type 'nsIURI*' to type 'nsISupports*'
24:00.78    if (_p != nullptr) NS_LogCOMPtrAddRef((_c), static_cast<nsISupports*>(_p))
24:00.78                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:354:5: note: in expansion of macro 'NSCAP_LOG_ASSIGNMENT'
24:00.78      NSCAP_LOG_ASSIGNMENT(this, aNewPtr);
24:00.78      ^~~~~~~~~~~~~~~~~~~~
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsISupportsImpl.h:156:37: error: invalid static_cast from type 'nsIURI*' to type 'nsISupports*'
24:00.78    if (_p) NS_LogCOMPtrRelease((_c), static_cast<nsISupports*>(_p))
24:00.78                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:355:5: note: in expansion of macro 'NSCAP_LOG_RELEASE'
24:00.78      NSCAP_LOG_RELEASE(this, oldPtr);
24:00.78      ^~~~~~~~~~~~~~~~~
24:00.78 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:23:0,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:91:41: error: invalid use of incomplete type 'class nsIURI'
24:00.78  #define NSCAP_RELEASE(this, ptr) (ptr)->Release()
24:00.78                                   ~~~~~~~^
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsCOMPtr.h:357:7: note: in expansion of macro 'NSCAP_RELEASE'
24:00.78        NSCAP_RELEASE(this, oldPtr);
24:00.78        ^~~~~~~~~~~~~
24:00.78 In file included from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsJSPrincipals.h:10:0,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/mozilla/BasePrincipal.h:10,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/caps/tests/gtest/TestOriginAttributes.cpp:5,
24:00.78                  from /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/caps/tests/gtest/Unified_cpp_caps_tests_gtest0.cpp:2:
24:00.78 /var/tmp/build/firefox-7a0a10b8ff98/obj-x86_64-pc-linux-gnu/dist/include/nsIPrincipal.h:45:7: note: forward declaration of 'class nsIURI'
24:00.78  class nsIURI; /* forward declaration */
24:00.78        ^~~~~~
24:00.85 make[4]: *** [Unified_cpp_caps_tests_gtest0.o] Error 1

Chances are high this is a test-only issue, but we should double-check that and either remove the test or (better) fix it up.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information