- Revision
- 209326
- Author
- [email protected]
- Date
- 2016-12-05 11:02:17 -0800 (Mon, 05 Dec 2016)
Log Message
REGRESSION(r208985): SafariForWebKitDevelopment Symbol Not Found looking for method with WTF::Optional
https://bugs.webkit.org/show_bug.cgi?id=165351
Reviewed by Yusuke Suzuki.
Source/_javascript_Core:
Some versions of Safari expect:
Inspector::BackendDispatcher::reportProtocolError(WTF::Optional<long>, Inspector::BackendDispatcher::CommonErrorCode, WTF::String const&)
Which we had updated to use std::optional. Expose a version with the original
Symbol for these Safaris. This stub will just call through to the new version.
* inspector/InspectorBackendDispatcher.cpp:
(Inspector::BackendDispatcher::reportProtocolError):
* inspector/InspectorBackendDispatcher.h:
Source/WTF:
Include a slimmed down version of WTF::Optional which older versions
of Safari still depend on for a _javascript_Core exported symbol.
To prevent misuse name it WTF::DeprecatedOptional and use it only in
the one instance it is needed.
* WTF.xcodeproj/project.pbxproj:
* wtf/DeprecatedOptional.h: Added.
(WTF::Optional::operator bool):
(WTF::Optional::value):
(WTF::Optional::asPtr):
Modified Paths
Added Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (209325 => 209326)
--- trunk/Source/_javascript_Core/ChangeLog 2016-12-05 18:19:25 UTC (rev 209325)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-12-05 19:02:17 UTC (rev 209326)
@@ -1,3 +1,21 @@
+2016-12-05 Joseph Pecoraro <[email protected]>
+
+ REGRESSION(r208985): SafariForWebKitDevelopment Symbol Not Found looking for method with WTF::Optional
+ https://bugs.webkit.org/show_bug.cgi?id=165351
+
+ Reviewed by Yusuke Suzuki.
+
+ Some versions of Safari expect:
+
+ Inspector::BackendDispatcher::reportProtocolError(WTF::Optional<long>, Inspector::BackendDispatcher::CommonErrorCode, WTF::String const&)
+
+ Which we had updated to use std::optional. Expose a version with the original
+ Symbol for these Safaris. This stub will just call through to the new version.
+
+ * inspector/InspectorBackendDispatcher.cpp:
+ (Inspector::BackendDispatcher::reportProtocolError):
+ * inspector/InspectorBackendDispatcher.h:
+
2016-12-05 Konstantin Tokarev <[email protected]>
Add __STDC_FORMAT_MACROS before inttypes.h is included
Modified: trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp (209325 => 209326)
--- trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp 2016-12-05 18:19:25 UTC (rev 209325)
+++ trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.cpp 2016-12-05 19:02:17 UTC (rev 209326)
@@ -265,6 +265,16 @@
m_protocolErrors.append(std::tuple<CommonErrorCode, String>(errorCode, errorMessage));
}
+#if PLATFORM(MAC)
+void BackendDispatcher::reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage)
+{
+ if (relatedRequestId)
+ reportProtocolError(relatedRequestId.value(), errorCode, errorMessage);
+ else
+ reportProtocolError(std::nullopt, errorCode, errorMessage);
+}
+#endif
+
template<typename T>
T BackendDispatcher::getPropertyValue(InspectorObject* object, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(InspectorValue&, T&)> asMethod, const char* typeName)
{
Modified: trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.h (209325 => 209326)
--- trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.h 2016-12-05 18:19:25 UTC (rev 209325)
+++ trunk/Source/_javascript_Core/inspector/InspectorBackendDispatcher.h 2016-12-05 19:02:17 UTC (rev 209326)
@@ -28,6 +28,7 @@
#include "InspectorFrontendRouter.h"
#include "InspectorProtocolTypes.h"
+#include <wtf/DeprecatedOptional.h>
#include <wtf/Optional.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -104,6 +105,11 @@
private:
BackendDispatcher(Ref<FrontendRouter>&&);
+#if PLATFORM(MAC)
+ // This is necessary for some versions of Safari. Remove it when those versions of Safari are no longer supported.
+ void reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode, const String& errorMessage);
+#endif
+
Ref<FrontendRouter> m_frontendRouter;
HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;
Modified: trunk/Source/WTF/ChangeLog (209325 => 209326)
--- trunk/Source/WTF/ChangeLog 2016-12-05 18:19:25 UTC (rev 209325)
+++ trunk/Source/WTF/ChangeLog 2016-12-05 19:02:17 UTC (rev 209326)
@@ -1,3 +1,21 @@
+2016-12-05 Joseph Pecoraro <[email protected]>
+
+ REGRESSION(r208985): SafariForWebKitDevelopment Symbol Not Found looking for method with WTF::Optional
+ https://bugs.webkit.org/show_bug.cgi?id=165351
+
+ Reviewed by Yusuke Suzuki.
+
+ Include a slimmed down version of WTF::Optional which older versions
+ of Safari still depend on for a _javascript_Core exported symbol.
+ To prevent misuse name it WTF::DeprecatedOptional and use it only in
+ the one instance it is needed.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/DeprecatedOptional.h: Added.
+ (WTF::Optional::operator bool):
+ (WTF::Optional::value):
+ (WTF::Optional::asPtr):
+
2016-12-05 Konstantin Tokarev <[email protected]>
Add __STDC_FORMAT_MACROS before inttypes.h is included
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (209325 => 209326)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2016-12-05 18:19:25 UTC (rev 209325)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2016-12-05 19:02:17 UTC (rev 209326)
@@ -161,6 +161,7 @@
9BD8F40B176C2B470002D865 /* AtomicStringTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD8F40A176C2AD80002D865 /* AtomicStringTable.h */; };
A5098B001C169E0700087797 /* SandboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A5098AFF1C169E0700087797 /* SandboxSPI.h */; };
A5098B021C16A4F900087797 /* SecuritySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A5098B011C16A4F900087797 /* SecuritySPI.h */; };
+ A561F3101DF2642100FF675D /* DeprecatedOptional.h in Headers */ = {isa = PBXBuildFile; fileRef = A561F30F1DF2642100FF675D /* DeprecatedOptional.h */; };
A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F2182433A900A82E69 /* StringMac.mm */; };
A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F41824348000A82E69 /* StringImplMac.mm */; };
A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */; };
@@ -528,6 +529,7 @@
9C67C542589348E285B49699 /* IndexedContainerIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedContainerIterator.h; sourceTree = "<group>"; };
A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; };
A5098B011C16A4F900087797 /* SecuritySPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecuritySPI.h; sourceTree = "<group>"; };
+ A561F30F1DF2642100FF675D /* DeprecatedOptional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedOptional.h; sourceTree = "<group>"; };
A5BA15F2182433A900A82E69 /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringMac.mm; path = mac/StringMac.mm; sourceTree = "<group>"; };
A5BA15F41824348000A82E69 /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringImplMac.mm; path = mac/StringImplMac.mm; sourceTree = "<group>"; };
A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicStringImplCF.cpp; path = cf/AtomicStringImplCF.cpp; sourceTree = "<group>"; };
@@ -914,6 +916,7 @@
A8A4727B151A825A004123FF /* DecimalNumber.cpp */,
A8A4727C151A825A004123FF /* DecimalNumber.h */,
0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */,
+ A561F30F1DF2642100FF675D /* DeprecatedOptional.h */,
A8A4727E151A825A004123FF /* Deque.h */,
A8A4727F151A825A004123FF /* DisallowCType.h */,
0F4570421BE5B58F0062A629 /* Dominators.h */,
@@ -1431,6 +1434,7 @@
A8A47417151A825B004123FF /* RedBlackTree.h in Headers */,
26299B6E17A9E5B800ADEBE5 /* Ref.h in Headers */,
A8A47418151A825B004123FF /* RefCounted.h in Headers */,
+ A561F3101DF2642100FF675D /* DeprecatedOptional.h in Headers */,
A8A47419151A825B004123FF /* RefCountedArray.h in Headers */,
A8A4741B151A825B004123FF /* RefCountedLeakCounter.h in Headers */,
86F46F611A2840EE00CCBF22 /* RefCounter.h in Headers */,
Added: trunk/Source/WTF/wtf/DeprecatedOptional.h (0 => 209326)
--- trunk/Source/WTF/wtf/DeprecatedOptional.h (rev 0)
+++ trunk/Source/WTF/wtf/DeprecatedOptional.h 2016-12-05 19:02:17 UTC (rev 209326)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// This file contains a deprecated version of WTF::Optional which a released
+// version of Safari uses. Once Safari stops using this, we can remove this.
+// New code should use std::optional.
+
+#pragma once
+
+#include <type_traits>
+
+namespace WTF {
+
+template<typename T>
+class Optional {
+public:
+ explicit operator bool() const { return m_isEngaged; }
+ T& value() { return *asPtr(); }
+
+private:
+ T* asPtr() { return reinterpret_cast<T*>(&m_value); }
+
+ bool m_isEngaged;
+ typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type m_value;
+};
+
+template<typename T> using DeprecatedOptional = WTF::Optional<T>;
+
+} // namespace WTF