Unreviewed, rolling out r244558.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2019 00:29:55 +0000 (00:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 24 Apr 2019 00:29:55 +0000 (00:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197219

Causing crashes on iOS Sim Release and Debug (Requested by
ShawnRoberts on #webkit).

Reverted changeset:

"Remove DeprecatedOptional"
https://bugs.webkit.org/show_bug.cgi?id=197161
https://trac.webkit.org/changeset/244558

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244574 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp
Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/DeprecatedOptional.h [new file with mode: 0644]

index 0819699..c943aad 100644 (file)
@@ -1,3 +1,17 @@
+2019-04-23  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r244558.
+        https://bugs.webkit.org/show_bug.cgi?id=197219
+
+        Causing crashes on iOS Sim Release and Debug (Requested by
+        ShawnRoberts on #webkit).
+
+        Reverted changeset:
+
+        "Remove DeprecatedOptional"
+        https://bugs.webkit.org/show_bug.cgi?id=197161
+        https://trac.webkit.org/changeset/244558
+
 2019-04-23  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Uncaught Exception: null is not an object (evaluating 'this.ownerDocument.frameIdentifier')
index 038cb64..fdefd42 100644 (file)
@@ -270,6 +270,14 @@ void BackendDispatcher::reportProtocolError(Optional<long> relatedRequestId, Com
     m_protocolErrors.append(std::tuple<CommonErrorCode, String>(errorCode, errorMessage));
 }
 
+void BackendDispatcher::reportProtocolError(WTF::DeprecatedOptional<long> relatedRequestId, CommonErrorCode errorCode, const String& errorMessage)
+{
+    if (relatedRequestId)
+        reportProtocolError(relatedRequestId.value(), errorCode, errorMessage);
+    else
+        reportProtocolError(WTF::nullopt, errorCode, errorMessage);
+}
+
 template<typename T>
 T BackendDispatcher::getPropertyValue(JSON::Object* object, const String& name, bool* out_optionalValueFound, T defaultValue, std::function<bool(JSON::Value&, T&)> asMethod, const char* typeName)
 {
index 95d9d81..3452e93 100644 (file)
@@ -29,6 +29,7 @@
 #include "InspectorFrontendRouter.h"
 #include "InspectorProtocolTypes.h"
 #include <functional>
+#include <wtf/DeprecatedOptional.h>
 #include <wtf/Optional.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -109,6 +110,9 @@ public:
 private:
     BackendDispatcher(Ref<FrontendRouter>&&);
 
+    // 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);
+
     Ref<FrontendRouter> m_frontendRouter;
     HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;
 
index 813081e..b840964 100644 (file)
@@ -1,3 +1,17 @@
+2019-04-23  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r244558.
+        https://bugs.webkit.org/show_bug.cgi?id=197219
+
+        Causing crashes on iOS Sim Release and Debug (Requested by
+        ShawnRoberts on #webkit).
+
+        Reverted changeset:
+
+        "Remove DeprecatedOptional"
+        https://bugs.webkit.org/show_bug.cgi?id=197161
+        https://trac.webkit.org/changeset/244558
+
 2019-04-23  Alex Christensen  <achristensen@webkit.org>
 
         Remove DeprecatedOptional
index 89c91b0..6c0d951 100644 (file)
                A3EE5C3F21FFACA200FABD61 /* SchedulePairMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SchedulePairMac.mm; 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 /* StringCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringCocoa.mm; sourceTree = "<group>"; };
                A5BA15F41824348000A82E69 /* StringImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StringImplCocoa.mm; sourceTree = "<group>"; };
                A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicStringImplCF.cpp; sourceTree = "<group>"; };
                                A8A4727A151A825A004123FF /* DateMath.h */,
                                996B17841EBA441C007E10EB /* DebugUtilities.h */,
                                0F2B66A417B6B4F700A7AE3F /* DeferrableRefCounted.h */,
+                               A561F30F1DF2642100FF675D /* DeprecatedOptional.h */,
                                A8A4727E151A825A004123FF /* Deque.h */,
                                A9A4727F151A825A004123FF /* DisallowCType.h */,
                                0F4570421BE5B58F0062A629 /* Dominators.h */,
                                A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
                                0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */,
                                A331D95B21F24992009F02AA /* FileSystem.cpp in Sources */,
+                               FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */,
                                A331D95D21F249E4009F02AA /* FileSystemCF.cpp in Sources */,
                                A331D95F21F249F6009F02AA /* FileSystemCocoa.mm in Sources */,
                                A331D96121F24A0A009F02AA /* FileSystemMac.mm in Sources */,
                                51F1752B1F3D486000C74950 /* PersistentCoders.cpp in Sources */,
                                51F1752C1F3D486000C74950 /* PersistentDecoder.cpp in Sources */,
                                51F1752D1F3D486000C74950 /* PersistentEncoder.cpp in Sources */,
-                               FE1E2C42224187C600F6B729 /* PlatformRegisters.cpp in Sources */,
                                0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */,
                                7AF023B52061E17000A8EFD6 /* ProcessPrivilege.cpp in Sources */,
-                               FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */,
                                143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
                                A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */,
                                A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
                                1C181C8F1D307AB800F5FA16 /* UTextProvider.cpp in Sources */,
                                1C181C911D307AB800F5FA16 /* UTextProviderLatin1.cpp in Sources */,
                                1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */,
+                               FE1E2C3B2240C06600F6B729 /* PtrTag.cpp in Sources */,
                                A8A47469151A825B004123FF /* UTF8Conversion.cpp in Sources */,
                                7AFEC6B11EB22B5900DADE36 /* UUID.cpp in Sources */,
                                0F66B2921DC97BAB004A1D3F /* WallTime.cpp in Sources */,
index 6ccacc8..3c3f251 100644 (file)
@@ -47,6 +47,7 @@ set(WTF_PUBLIC_HEADERS
     DateMath.h
     DebugUtilities.h
     DeferrableRefCounted.h
+    DeprecatedOptional.h
     Deque.h
     DisallowCType.h
     Dominators.h
diff --git a/Source/WTF/wtf/DeprecatedOptional.h b/Source/WTF/wtf/DeprecatedOptional.h
new file mode 100644 (file)
index 0000000..9b1558d
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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 std::optional which a released
+// version of Safari uses. Once Safari stops using this, we can remove this.
+// New code should use WTF::Optional.
+
+#pragma once
+
+#include <type_traits>
+#include <wtf/Optional.h>
+
+namespace std {
+
+template <class T>
+class optional : private WTF::OptionalBase<T> {
+public:
+    explicit constexpr operator bool() const __NOEXCEPT { return WTF::OptionalBase<T>::init_; }
+    constexpr T const& value() const& { return WTF::OptionalBase<T>::storage_.value_; }
+};
+
+}
+
+namespace WTF {
+
+template<typename T> using DeprecatedOptional = std::optional<T>;
+
+} // namespace WTF