Changeset 209939 in webkit
- Timestamp:
- Dec 16, 2016 2:29:19 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r209883 r209939 1072 1072 bindings/generic/RuntimeEnabledFeatures.cpp 1073 1073 1074 bindings/js/ArrayValue.cpp1075 1074 bindings/js/CachedModuleScript.cpp 1076 1075 bindings/js/CachedModuleScriptLoader.cpp -
trunk/Source/WebCore/ChangeLog
r209936 r209939 1 2016-12-16 Sam Weinig <sam@webkit.org> 2 3 [Bindings] Remove use of Dictionary/ArrayValue in CDMSessionClearKey 4 https://bugs.webkit.org/show_bug.cgi?id=165961 5 6 Reviewed by Darin Adler. 7 8 * CMakeLists.txt: 9 * WebCore.xcodeproj/project.pbxproj: 10 * bindings/js/JSBindingsAllInOne.cpp: 11 Remove ArrayValue.h/cpp 12 13 * bindings/js/ArrayValue.cpp: Removed. 14 * bindings/js/ArrayValue.h: Removed. 15 16 * bindings/js/Dictionary.cpp: 17 * bindings/js/Dictionary.h: 18 Remove support for ArrayValue. 19 20 * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: 21 (WebCore::CDMSessionClearKey::update): 22 Replace use of Dictionary/ArrayValue with direct JSObject functions. This 23 should really be replaced with a JSON parser that does not require round 24 tripping through JavaScript objects. 25 1 26 2016-12-13 Jer Noble <jer.noble@apple.com> 2 27 -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp
r209936 r209939 27 27 #include "LegacyCDMSessionClearKey.h" 28 28 29 #include "ArrayValue.h"30 #include "Dictionary.h"31 29 #include "JSMainThreadExecState.h" 32 30 #include "Logging.h" … … 100 98 101 99 do { 102 StringrawKeysString = String::fromUTF8(rawKeysData->data(), rawKeysData->length());100 auto rawKeysString = String::fromUTF8(rawKeysData->data(), rawKeysData->length()); 103 101 if (rawKeysString.isEmpty()) { 104 102 LOG(Media, "CDMSessionClearKey::update(%p) - failed: empty message", this); … … 106 104 } 107 105 108 VM& vm = clearKeyVM();106 auto& vm = clearKeyVM(); 109 107 JSLockHolder lock(vm); 110 108 auto scope = DECLARE_THROW_SCOPE(vm); 111 JSGlobalObject* globalObject = JSGlobalObject::create(vm, JSGlobalObject::createStructure(vm, jsNull())); 112 ExecState* exec = globalObject->globalExec(); 113 114 JSLockHolder locker(clearKeyVM()); 115 JSValue keysDataObject = JSONParse(exec, rawKeysString); 116 if (scope.exception() || !keysDataObject) { 109 auto* globalObject = JSGlobalObject::create(vm, JSGlobalObject::createStructure(vm, jsNull())); 110 auto& state = *globalObject->globalExec(); 111 112 auto keysDataValue = JSONParse(&state, rawKeysString); 113 if (scope.exception() || !keysDataValue.isObject()) { 117 114 LOG(Media, "CDMSessionClearKey::update(%p) - failed: invalid JSON", this); 118 115 break; 119 116 } 120 Dictionary keysDataDictionary(exec, keysDataObject); 121 ArrayValue keysArray; 122 size_t length; 123 if (!keysDataDictionary.get("keys", keysArray) || keysArray.isUndefinedOrNull() || !keysArray.length(length) || !length) { 117 118 auto keysArrayValue = asObject(keysDataValue)->get(&state, Identifier::fromString(&state, "keys")); 119 if (scope.exception() || !isJSArray(keysArrayValue)) { 124 120 LOG(Media, "CDMSessionClearKey::update(%p) - failed: keys array missing or empty", this); 125 121 break; 126 122 } 127 123 124 auto keysArray = asArray(keysArrayValue); 125 auto length = keysArray->length(); 126 if (!length) { 127 LOG(Media, "CDMSessionClearKey::update(%p) - failed: keys array missing or empty", this); 128 break; 129 } 130 128 131 bool foundValidKey = false; 129 for (size_t i = 0; i < length; ++i) { 130 Dictionary keyDictionary; 131 if (!keysArray.get(i, keyDictionary) || keyDictionary.isUndefinedOrNull()) { 132 for (unsigned i = 0; i < length; ++i) { 133 auto keyValue = keysArray->getIndex(&state, i); 134 135 if (scope.exception() || !keyValue.isObject()) { 132 136 LOG(Media, "CDMSessionClearKey::update(%p) - failed: null keyDictionary", this); 133 137 continue; 134 138 } 135 139 136 String algorithm; 137 if (!keyDictionary.get("alg", algorithm) || !equalLettersIgnoringASCIICase(algorithm, "a128kw")) { 140 auto keyObject = asObject(keyValue); 141 142 auto getStringProperty = [&scope, &state, &keyObject](const char* name) -> String { 143 auto value = keyObject->get(&state, Identifier::fromString(&state, name)); 144 if (scope.exception() || !value.isString()) 145 return { }; 146 147 auto string = asString(value)->value(&state); 148 if (scope.exception()) 149 return { }; 150 151 return string; 152 }; 153 154 auto algorithm = getStringProperty("alg"); 155 if (!equalLettersIgnoringASCIICase(algorithm, "a128kw")) { 138 156 LOG(Media, "CDMSessionClearKey::update(%p) - failed: algorithm unsupported", this); 139 157 continue; 140 158 } 141 159 142 String keyType;143 if (! keyDictionary.get("kty", keyType) || !equalLettersIgnoringASCIICase(keyType, "oct")) {160 auto keyType = getStringProperty("kty"); 161 if (!equalLettersIgnoringASCIICase(keyType, "oct")) { 144 162 LOG(Media, "CDMSessionClearKey::update(%p) - failed: keyType unsupported", this); 145 163 continue; 146 164 } 147 165 148 String keyId;149 if ( !keyDictionary.get("kid", keyId) ||keyId.isEmpty()) {166 auto keyId = getStringProperty("kid"); 167 if (keyId.isEmpty()) { 150 168 LOG(Media, "CDMSessionClearKey::update(%p) - failed: keyId missing or empty", this); 151 169 continue; 152 170 } 153 171 154 String rawKeyData;155 if ( !keyDictionary.get("k", rawKeyData) ||rawKeyData.isEmpty()) {172 auto rawKeyData = getStringProperty("k"); 173 if (rawKeyData.isEmpty()) { 156 174 LOG(Media, "CDMSessionClearKey::update(%p) - failed: key missing or empty", this); 157 175 continue; … … 159 177 160 178 Vector<uint8_t> keyData; 161 if (!base64Decode(rawKeyData, keyData) || 179 if (!base64Decode(rawKeyData, keyData) || keyData.isEmpty()) { 162 180 LOG(Media, "CDMSessionClearKey::update(%p) - failed: unable to base64 decode key", this); 163 181 continue; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r209936 r209939 1818 1818 49AF2D6914435D050016A784 /* DisplayRefreshMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 49AF2D6814435D050016A784 /* DisplayRefreshMonitor.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1819 1819 49AF2D6C14435D210016A784 /* DisplayRefreshMonitorMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49AF2D6B14435D210016A784 /* DisplayRefreshMonitorMac.cpp */; }; 1820 49B3760C15C6C6840059131D /* ArrayValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49B3760A15C6C6840059131D /* ArrayValue.cpp */; };1821 49B3760D15C6C6840059131D /* ArrayValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 49B3760B15C6C6840059131D /* ArrayValue.h */; };1822 1820 49C7B9931042D2D30009D447 /* JSWebGLBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */; }; 1823 1821 49C7B9941042D2D30009D447 /* JSWebGLBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */; }; … … 9016 9014 49AF2D6814435D050016A784 /* DisplayRefreshMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitor.h; sourceTree = "<group>"; }; 9017 9015 49AF2D6B14435D210016A784 /* DisplayRefreshMonitorMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayRefreshMonitorMac.cpp; sourceTree = "<group>"; }; 9018 49B3760A15C6C6840059131D /* ArrayValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ArrayValue.cpp; sourceTree = "<group>"; };9019 49B3760B15C6C6840059131D /* ArrayValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayValue.h; sourceTree = "<group>"; };9020 9016 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLBuffer.cpp; sourceTree = "<group>"; }; 9021 9017 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLBuffer.h; sourceTree = "<group>"; }; … … 21931 21927 BC4EDEF70C08F414007EDD49 /* Custom */, 21932 21928 14DFB33F0A7DF7630018F769 /* Derived Sources */, 21933 49B3760A15C6C6840059131D /* ArrayValue.cpp */,21934 49B3760B15C6C6840059131D /* ArrayValue.h */,21935 21929 2DFA488E1DB541C200362B99 /* BufferSource.h */, 21936 21930 E307DEC91D81E46E00141CAF /* CachedModuleScript.cpp */, … … 24865 24859 512DD8FC0D91E6AF000F89EE /* ArchiveResource.h in Headers */, 24866 24860 512DD8F80D91E6AF000F89EE /* ArchiveResourceCollection.h in Headers */, 24867 49B3760D15C6C6840059131D /* ArrayValue.h in Headers */,24868 24861 FD5686CA13AC180200B69C68 /* AsyncAudioDecoder.h in Headers */, 24869 24862 E1CDE9221501916900862CC5 /* AsyncFileStream.h in Headers */, … … 28753 28746 512DD8FB0D91E6AF000F89EE /* ArchiveResource.cpp in Sources */, 28754 28747 512DD8F70D91E6AF000F89EE /* ArchiveResourceCollection.cpp in Sources */, 28755 49B3760C15C6C6840059131D /* ArrayValue.cpp in Sources */,28756 28748 FD5686C913AC180200B69C68 /* AsyncAudioDecoder.cpp in Sources */, 28757 28749 E1CDE92015018ED000862CC5 /* AsyncFileStream.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/Dictionary.cpp
r209674 r209939 27 27 #include "Dictionary.h" 28 28 29 #include "ArrayValue.h"30 29 #include "JSDOMConvert.h" 31 30 … … 126 125 } 127 126 128 void Dictionary::convertValue(ExecState& state, JSValue value, ArrayValue& result)129 {130 if (value.isUndefinedOrNull())131 return;132 result = ArrayValue(&state, value);133 127 } 134 135 } -
trunk/Source/WebCore/bindings/js/Dictionary.h
r209674 r209939 43 43 namespace WebCore { 44 44 45 class ArrayValue;46 47 45 class Dictionary { 48 46 public: … … 86 84 static void convertValue(JSC::ExecState&, JSC::JSValue, Vector<String>& result); 87 85 static void convertValue(JSC::ExecState&, JSC::JSValue, Dictionary& result); 88 static void convertValue(JSC::ExecState&, JSC::JSValue, ArrayValue& result);89 86 90 87 JSC::ExecState* m_state { nullptr }; -
trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
r209864 r209939 26 26 // This all-in-one cpp file cuts down on template bloat to allow us to build our Windows release build. 27 27 28 #include "ArrayValue.cpp"29 28 #include "CachedModuleScript.cpp" 30 29 #include "CachedModuleScriptLoader.cpp"
Note: See TracChangeset
for help on using the changeset viewer.