1. 21 Nov, 2013 3 commits
    • commit-queue@webkit.org's avatar
      Remove ENABLE_WORKERS · f0eff209
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=105784
      
      .:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * Source/autotools/SetupWebKitFeatures.m4:
      * Source/cmake/WebKitFeatures.cmake:
      * Source/cmakeconfig.h.cmake:
      
      Source/WebCore:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      Source/WebKit:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
      
      Source/WebKit/efl:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * ewk/ewk_settings.cpp:
      (ewk_settings_memory_cache_clear):
      
      Source/WebKit/win:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * WebWorkersPrivate.cpp:
      (WebWorkersPrivate::workerThreadCount):
      
      Source/WTF:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * wtf/FeatureDefines.h:
      * wtf/nix/FeatureDefinesNix.h:
      
      Tools:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * Scripts/webkitperl/FeatureList.pm:
      
      WebKitLibraries:
      
      Patch by Peter Molnar <pmolnar.u-szeged@partner.samsung.com> on 2013-11-21
      Reviewed by Darin Adler.
      
      * win/tools/vsprops/FeatureDefines.props:
      * win/tools/vsprops/FeatureDefinesCairo.props:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159679 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f0eff209
    • ap@apple.com's avatar
      Implement WebCrypto wrapKey · abd0bbca
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124738
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html
             crypto/subtle/aes-cbc-wrap-rsa.html
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::exportKey): Factored out the actual operation that can be chained with
      encryption for wrapKey.
      (WebCore::JSSubtleCrypto::exportKey):
      (WebCore::JSSubtleCrypto::wrapKey):
      (WebCore::JSSubtleCrypto::unwrapKey): Fixed a memory leak in failure code path.
      
      * crypto/SubtleCrypto.idl: Added wrapKey.
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-wrap-rsa-expected.txt: Added.
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable-expected.txt: Added.
      * crypto/subtle/aes-cbc-wrap-rsa-non-extractable.html: Added.
      * crypto/subtle/aes-cbc-wrap-rsa.html: Added.
      
      * crypto/subtle/aes-export-key-expected.txt:
      * crypto/subtle/hmac-export-key-expected.txt:
      There is no longer a console message, the error is in an exception.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      abd0bbca
    • ap@apple.com's avatar
      Implement WebCrypto unwrapKey · 19cf70fd
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124725
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-cbc-unwrap-failure.html
             crypto/subtle/aes-cbc-unwrap-rsa.html
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      * bindings/js/JSCryptoAlgorithmDictionary.h:
      Removed calls for wrap/unwrap parameter parsing, these are just the same as encrypt/decrypt.
      
      * bindings/js/JSCryptoOperationData.cpp:
      (WebCore::cryptoOperationDataFromJSValue):
      * bindings/js/JSCryptoOperationData.h:
      * crypto/CryptoKeySerialization.h:
      More Vector<char> elimination.
      
      * bindings/js/JSDOMPromise.cpp:
      * bindings/js/JSDOMPromise.h:
      Removed unneccessary copy constructor and assignment operator, they are no diffdrent
      than compiler generated ones.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::cryptoKeyUsagesFromJSValue): Minor style fixes.
      (WebCore::JSSubtleCrypto::encrypt): Ditto.
      (WebCore::JSSubtleCrypto::decrypt): Ditto.
      (WebCore::JSSubtleCrypto::sign): Ditto.
      (WebCore::JSSubtleCrypto::verify): Ditto.
      (WebCore::JSSubtleCrypto::generateKey): Ditto.
      (WebCore::importKey): Separated actual import operation and the parts that read
      arguments from ExecState, and call the promise. Logically, this should be outside
      of bindings code even, but JWK makes that quite challenging.
      (WebCore::JSSubtleCrypto::importKey): This only does the more mundane arguments
      and return parts now.
      (WebCore::JSSubtleCrypto::exportKey): Minor style fixes.
      (WebCore::JSSubtleCrypto::unwrapKey): Chain decrypt and import.
      
      * crypto/CryptoAlgorithm.cpp:
      (WebCore::CryptoAlgorithm::encryptForWrapKey):
      (WebCore::CryptoAlgorithm::decryptForUnwrapKey):
      * crypto/CryptoAlgorithm.h:
      There are algorithms that expose wrap/unwrap, but not encrypt/decrypt. These will
      override these new functions, and leave encrypt/decrypt to raise NOT_SUPPORTED_ERR.
      
      * crypto/SubtleCrypto.idl: Added unwrapKey.
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-unwrap-failure-expected.txt: Added.
      * crypto/subtle/aes-cbc-unwrap-failure.html: Added.
      * crypto/subtle/aes-cbc-unwrap-rsa-expected.txt: Added.
      * crypto/subtle/aes-cbc-unwrap-rsa.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      19cf70fd
  2. 20 Nov, 2013 3 commits
    • mark.lam@apple.com's avatar
      Build fix for last commit. · 79f7a8eb
      mark.lam@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124634.
      
      Not reviewed.
      
      No new tests.
      
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      79f7a8eb
    • mark.lam@apple.com's avatar
      Introducing VMEntryScope to update the VM stack limit. · 30721257
      mark.lam@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124634.
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore: 
      
      1. Introduced USE(SEPARATE_C_AND_JS_STACK) (defined in Platform.h).
         Currently, it is hardcoded to use separate C and JS stacks. Once we
         switch to using the C stack for JS frames, we'll need to fix this to
         only be enabled when ENABLE(LLINT_C_LOOP).
      
      2. Stack limits are now tracked in the VM.
      
         Logically, there are 2 stack limits:
         a. m_stackLimit for the native C stack, and
         b. m_jsStackLimit for the JS stack.
      
         If USE(SEPARATE_C_AND_JS_STACK), then the 2 limits are the same
         value, and are implemented as 2 fields in a union.
      
      3. The VM native stackLimit is set as follows:
         a. Initially, the VM sets it to the limit of the stack of the thread that
            instantiated the VM. This allows the parser and bytecode generator to
            run before we enter the VM to execute JS code.
      
         b. Upon entry into the VM to execute JS code (via one of the
            Interpreter::execute...() functions), we instantiate a VMEntryScope
            that sets the VM's stackLimit to the limit of the current thread's
            stack. The VMEntryScope will automatically restore the previous
            entryScope and stack limit upon destruction.
      
         If USE(SEPARATE_C_AND_JS_STACK), the JSStack's methods will set the VM's
         jsStackLimit whenever it grows or shrinks.
      
      4. The VM now provides a isSafeToRecurse() function that compares the
         current stack pointer against its native stackLimit. This subsumes and
         obsoletes the VMStackBounds class.
      
      5. The VMEntryScope class also subsumes DynamicGlobalObjectScope for
         tracking the JSGlobalObject that we last entered the VM with.
      
      6. Renamed dynamicGlobalObject() to vmEntryGlobalObject() since that is
         the value that the function retrieves.
      
      7. Changed JIT and LLINT code to do stack checks against the jsStackLimit
         in the VM class instead of the JSStack.
      
      * API/JSBase.cpp:
      (JSEvaluateScript):
      (JSCheckScriptSyntax):
      * API/JSContextRef.cpp:
      (JSGlobalContextRetain):
      (JSGlobalContextRelease):
      * CMakeLists.txt:
      * GNUmakefile.list.am:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * bytecompiler/BytecodeGenerator.cpp:
      (JSC::BytecodeGenerator::BytecodeGenerator):
      * bytecompiler/BytecodeGenerator.h:
      (JSC::BytecodeGenerator::emitNode):
      (JSC::BytecodeGenerator::emitNodeInConditionContext):
      * debugger/Debugger.cpp:
      (JSC::Debugger::detach):
      (JSC::Debugger::recompileAllJSFunctions):
      (JSC::Debugger::pauseIfNeeded):
      * debugger/DebuggerCallFrame.cpp:
      (JSC::DebuggerCallFrame::vmEntryGlobalObject):
      * debugger/DebuggerCallFrame.h:
      * dfg/DFGJITCompiler.cpp:
      (JSC::DFG::JITCompiler::compileFunction):
      * dfg/DFGOSREntry.cpp:
      * ftl/FTLLink.cpp:
      (JSC::FTL::link):
      * ftl/FTLOSREntry.cpp:
      * heap/Heap.cpp:
      (JSC::Heap::lastChanceToFinalize):
      (JSC::Heap::deleteAllCompiledCode):
      * interpreter/CachedCall.h:
      (JSC::CachedCall::CachedCall):
      * interpreter/CallFrame.cpp:
      (JSC::CallFrame::vmEntryGlobalObject):
      * interpreter/CallFrame.h:
      * interpreter/Interpreter.cpp:
      (JSC::unwindCallFrame):
      (JSC::Interpreter::unwind):
      (JSC::Interpreter::execute):
      (JSC::Interpreter::executeCall):
      (JSC::Interpreter::executeConstruct):
      (JSC::Interpreter::prepareForRepeatCall):
      (JSC::Interpreter::debug):
      * interpreter/JSStack.cpp:
      (JSC::JSStack::JSStack):
      (JSC::JSStack::growSlowCase):
      * interpreter/JSStack.h:
      * interpreter/JSStackInlines.h:
      (JSC::JSStack::shrink):
      (JSC::JSStack::grow):
      - Moved these inlined functions here from JSStack.h. It reduces some
        #include dependencies of JSSTack.h which had previously resulted
        in some EWS bots' unhappiness with this patch.
      (JSC::JSStack::updateStackLimit):
      * jit/JIT.cpp:
      (JSC::JIT::privateCompile):
      * jit/JITCall.cpp:
      (JSC::JIT::compileLoadVarargs):
      * jit/JITCall32_64.cpp:
      (JSC::JIT::compileLoadVarargs):
      * jit/JITOperations.cpp:
      * llint/LLIntSlowPaths.cpp:
      * llint/LowLevelInterpreter.asm:
      * parser/Parser.cpp:
      (JSC::::Parser):
      * parser/Parser.h:
      (JSC::Parser::canRecurse):
      * runtime/CommonSlowPaths.h:
      * runtime/Completion.cpp:
      (JSC::evaluate):
      * runtime/FunctionConstructor.cpp:
      (JSC::constructFunctionSkippingEvalEnabledCheck):
      * runtime/JSGlobalObject.cpp:
      * runtime/JSGlobalObject.h:
      * runtime/StringRecursionChecker.h:
      (JSC::StringRecursionChecker::performCheck):
      * runtime/VM.cpp:
      (JSC::VM::VM):
      (JSC::VM::releaseExecutableMemory):
      (JSC::VM::throwException):
      * runtime/VM.h:
      (JSC::VM::addressOfJSStackLimit):
      (JSC::VM::jsStackLimit):
      (JSC::VM::setJSStackLimit):
      (JSC::VM::stackLimit):
      (JSC::VM::setStackLimit):
      (JSC::VM::isSafeToRecurse):
      * runtime/VMEntryScope.cpp: Added.
      (JSC::VMEntryScope::VMEntryScope):
      (JSC::VMEntryScope::~VMEntryScope):
      (JSC::VMEntryScope::requiredCapacity):
      * runtime/VMEntryScope.h: Added.
      (JSC::VMEntryScope::globalObject):
      * runtime/VMStackBounds.h: Removed.
      
      Source/WebCore: 
      
      No new tests.
      
      Renamed dynamicGlobalObject() to vmEntryGlobalObject().
      Replaced uses of DynamicGlobalObjectScope with VMEntryScope.
      
      * ForwardingHeaders/runtime/VMEntryScope.h: Added.
      * WebCore.vcxproj/WebCore.vcxproj:
      * WebCore.vcxproj/WebCore.vcxproj.filters:
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      (WebCore::JSCryptoAlgorithmBuilder::add):
      * bindings/js/JSCustomXPathNSResolver.cpp:
      (WebCore::JSCustomXPathNSResolver::create):
      * bindings/js/JSDOMBinding.cpp:
      (WebCore::firstDOMWindow):
      * bindings/js/JSErrorHandler.cpp:
      (WebCore::JSErrorHandler::handleEvent):
      * bindings/js/JSEventListener.cpp:
      (WebCore::JSEventListener::handleEvent):
      * bindings/js/JavaScriptCallFrame.h:
      (WebCore::JavaScriptCallFrame::vmEntryGlobalObject):
      * bindings/js/PageScriptDebugServer.cpp:
      (WebCore::PageScriptDebugServer::recompileAllJSFunctions):
      * bindings/js/ScriptDebugServer.cpp:
      (WebCore::ScriptDebugServer::evaluateBreakpointAction):
      (WebCore::ScriptDebugServer::handlePause):
      * bindings/js/WorkerScriptDebugServer.cpp:
      (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
      * bindings/objc/WebScriptObject.mm:
      (WebCore::addExceptionToConsole):
      * bridge/c/c_utility.cpp:
      (JSC::Bindings::convertValueToNPVariant):
      * bridge/objc/objc_instance.mm:
      (ObjcInstance::moveGlobalExceptionToExecState):
      * bridge/objc/objc_runtime.mm:
      (JSC::Bindings::convertValueToObjcObject):
      * bridge/objc/objc_utility.mm:
      (JSC::Bindings::convertValueToObjcValue):
      
      Source/WebKit/mac: 
      
      * WebView/WebScriptDebugger.mm:
      (WebScriptDebugger::sourceParsed):
      
      Source/WTF: 
      
      * wtf/Platform.h:
      * wtf/StackBounds.h:
      (WTF::StackBounds::StackBounds):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159605 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      30721257
    • ap@apple.com's avatar
      Use std::function callbacks in CryptoAlgorithm instead of JS promises · c1767f0a
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124673
      
      Reviewed by Anders Carlsson.
      
      To implement key wrapping/unwrapping, we'll need to chain existing operations.
      It's much easier to do with C++ callbacks than with functions fulfilling JS
      promises directly.
      
      Also, this will decouple CryptoAlgorithm from JS, which is nice.
      
      SubtleCrypto IDL says that all functions return Promise<any>, but in reality,
      there is very little polymorphism, the only function whose return type depends
      on algorithm is generateKey (it can create a Key or a KeyPair).
      
      * bindings/js/JSDOMPromise.cpp:
      (WebCore::PromiseWrapper::PromiseWrapper):
      (WebCore::PromiseWrapper::operator=):
      * bindings/js/JSDOMPromise.h:
      Made it copyable, as each crypto function wraps the promise in success and failure
      functional objects now.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::encrypt):
      (WebCore::JSSubtleCrypto::decrypt):
      (WebCore::JSSubtleCrypto::sign):
      (WebCore::JSSubtleCrypto::verify):
      (WebCore::JSSubtleCrypto::digest):
      (WebCore::JSSubtleCrypto::generateKey):
      (WebCore::JSSubtleCrypto::importKey):
      (WebCore::JSSubtleCrypto::exportKey):
      * crypto/CryptoAlgorithm.cpp:
      (WebCore::CryptoAlgorithm::encrypt):
      (WebCore::CryptoAlgorithm::decrypt):
      (WebCore::CryptoAlgorithm::sign):
      (WebCore::CryptoAlgorithm::verify):
      (WebCore::CryptoAlgorithm::digest):
      (WebCore::CryptoAlgorithm::generateKey):
      (WebCore::CryptoAlgorithm::deriveKey):
      (WebCore::CryptoAlgorithm::deriveBits):
      (WebCore::CryptoAlgorithm::importKey):
      * crypto/CryptoAlgorithm.h:
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::generateKey):
      (WebCore::CryptoAlgorithmAES_CBC::importKey):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::generateKey):
      (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.h:
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
      * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
      (WebCore::CryptoAlgorithmSHA1::digest):
      * crypto/algorithms/CryptoAlgorithmSHA1.h:
      * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
      (WebCore::CryptoAlgorithmSHA224::digest):
      * crypto/algorithms/CryptoAlgorithmSHA224.h:
      * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
      (WebCore::CryptoAlgorithmSHA256::digest):
      * crypto/algorithms/CryptoAlgorithmSHA256.h:
      * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
      (WebCore::CryptoAlgorithmSHA384::digest):
      * crypto/algorithms/CryptoAlgorithmSHA384.h:
      * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
      (WebCore::CryptoAlgorithmSHA512::digest):
      * crypto/algorithms/CryptoAlgorithmSHA512.h:
      * crypto/keys/CryptoKeyRSA.h:
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::transformAES_CBC):
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      * crypto/mac/CryptoKeyRSAMac.cpp:
      (WebCore::CryptoKeyRSA::generatePair):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c1767f0a
  3. 18 Nov, 2013 2 commits
    • gyuyoung.kim@samsung.com's avatar
      Clean up static_cast<HTMLFoo*> usage · 38523d91
      gyuyoung.kim@samsung.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124480
      
      Reviewed by Tim Horton.
      
      Though there are toHTMLFoo(), some places are still using static_cast<>.
      Additionally, toHTMLBodyElement() is supported from now.
      
      No new tests, no behavior changes.
      
      * accessibility/AccessibilityNodeObject.cpp:
      (WebCore::AccessibilityNodeObject::isRequired):
      * accessibility/AccessibilityTable.cpp:
      (WebCore::AccessibilityTable::isDataTable):
      * bindings/js/JSHTMLFrameSetElementCustom.cpp:
      (WebCore::JSHTMLFrameSetElement::nameGetter):
      * bindings/js/JSPluginElementFunctions.cpp:
      (WebCore::pluginInstance):
      * dom/Document.cpp:
      (WebCore::Document::openSearchDescriptionURL):
      (WebCore::Document::iconURLs):
      * dom/DocumentStyleSheetCollection.cpp:
      (WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
      * editing/ReplaceSelectionCommand.cpp:
      (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
      * editing/ios/EditorIOS.mm:
      (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection):
      * html/HTMLBodyElement.h:
      * html/HTMLDocument.cpp:
      (WebCore::HTMLDocument::bgColor):
      (WebCore::HTMLDocument::setBgColor):
      (WebCore::HTMLDocument::fgColor):
      (WebCore::HTMLDocument::setFgColor):
      (WebCore::HTMLDocument::alinkColor):
      (WebCore::HTMLDocument::setAlinkColor):
      (WebCore::HTMLDocument::linkColor):
      (WebCore::HTMLDocument::setLinkColor):
      (WebCore::HTMLDocument::vlinkColor):
      (WebCore::HTMLDocument::setVlinkColor):
      * html/HTMLEmbedElement.cpp:
      (WebCore::HTMLEmbedElement::rendererIsNeeded):
      * html/HTMLFormControlElement.cpp:
      (WebCore::HTMLFormControlElement::updateAncestorDisabledState):
      (WebCore::HTMLFormControlElement::enclosingFormControlElement):
      * html/HTMLFormElement.cpp:
      (WebCore::submitElementFromEvent):
      * html/HTMLImageLoader.cpp:
      (WebCore::HTMLImageLoader::notifyFinished):
      * html/HTMLLegendElement.cpp:
      (WebCore::HTMLLegendElement::virtualForm):
      * html/RadioNodeList.cpp:
      (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
      * inspector/InspectorDOMAgent.cpp:
      (WebCore::InspectorDOMAgent::buildObjectForNode):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159416 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      38523d91
    • ap@apple.com's avatar
      Support exporting public RSASSA-PKCS1-v1_5 keys · a7a1d44a
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124475
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Test: crypto/subtle/rsa-export-key.html
      
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::buildJSONForRSAComponents):
      (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
      (WebCore::JSCryptoKeySerializationJWK::serialize):
      Added said support (this part works with private keys too).
      
      * crypto/keys/CryptoKeyRSA.h:
      * crypto/mac/CryptoKeyRSAMac.cpp:
      (WebCore::CryptoKeyRSA::getPublicKeyComponents): Moved the logic for getting a
      public key from private one here for reuse in keySizeInBits().
      (WebCore::CryptoKeyRSA::isRestrictedToHash):
      (WebCore::CryptoKeyRSA::keySizeInBits):
      (WebCore::CryptoKeyRSA::exportData):
      Exposed information necessary for JWK serialization.
      
      LayoutTests: 
      
      * crypto/subtle/rsa-export-key-expected.txt: Added.
      * crypto/subtle/rsa-export-key.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a7a1d44a
  4. 17 Nov, 2013 3 commits
    • ap@apple.com's avatar
      RSASSA-PKCS1-v1_5 JWK import doesn't check key size · 48c4fbd3
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124472
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Test: crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html
      
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): Added the checks.
      (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Check key size when
      importing.
      (WebCore::JSCryptoKeySerializationJWK::serialize): Updated a comment.
      
      * crypto/keys/CryptoKeySerializationRaw.cpp: (WebCore::CryptoKeySerializationRaw::serialize):
      Updated a comment.
      
      LayoutTests: 
      
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      48c4fbd3
    • ap@apple.com's avatar
      JWK crypto key export result is a DOM string instead of an array buffer · 106eb707
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124473
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::exportKey):
      Fix it.
      
      LayoutTests: 
      
      * crypto/subtle/aes-export-key.html:
      * crypto/subtle/hmac-export-key.html:
      
      * crypto/subtle/resources/common.js: (bytesToASCIIString): Added a function that
      converts an ArrayBuffer to a string, assuming it's all ASCII.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159392 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      106eb707
    • ap@apple.com's avatar
      Use uint8_t vectors for WebCrypto data · f37f9b40
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124466
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Using Vector<char> for crypto key data is somewhat non-idiomatic, and it gets simply
      dangerous for bignums, because signed arithmetic is not appropriate for bignum digits.
      
      * Modules/websockets/WebSocketHandshake.cpp:
      (WebCore::generateSecWebSocketKey):
      (WebCore::WebSocketHandshake::getExpectedWebSocketAccept):
      No longer need to cast data to char* here.
      
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * crypto/CryptoDigest.h:
      * crypto/CryptoKey.h:
      * crypto/keys/CryptoKeyAES.cpp:
      * crypto/keys/CryptoKeyAES.h:
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      * crypto/keys/CryptoKeyDataRSAComponents.cpp:
      * crypto/keys/CryptoKeyDataRSAComponents.h:
      * crypto/keys/CryptoKeyHMAC.cpp:
      * crypto/keys/CryptoKeyHMAC.h:
      * crypto/keys/CryptoKeyRSA.h:
      * crypto/keys/CryptoKeySerializationRaw.cpp:
      * crypto/keys/CryptoKeySerializationRaw.h:
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      * crypto/mac/CryptoDigestMac.cpp:
      * crypto/mac/CryptoKeyMac.cpp:
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
      Switched to Vector<uint8_t>.
      
      * crypto/mac/CryptoKeyRSAMac.cpp:
      (WebCore::getPublicKeyComponents): Extracted from buildAlgorithmDescription() and simplified.
      (WebCore::CryptoKeyRSA::create): Switched to Vector<uint8_t>.
      (WebCore::CryptoKeyRSA::buildAlgorithmDescription): No longer need to copy data just
      to change type from Vector<char> to Vector<unsigned char>.
      (WebCore::bigIntegerToUInt32): Ditto. No longer need to cast types when dealing with the bignum.
      (WebCore::CryptoKeyRSA::generatePair): Improved an error message a little.
      
      * fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::convertToDataURL):
      * inspector/DOMPatchSupport.cpp: (WebCore::DOMPatchSupport::createDigest):
      * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::archive):
      * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::CGImageToDataURL):
      No longer need to cast data to char* here.
      
      Source/WTF: 
      
      Binary data can be UTF-8, in which case "char*" is idiomatic, or it can be arbitrary
      binary data, in which case "uint8_t*" is more common.
      
      Changed encode functions that took "const char *" to "const void*", and decode
      functions that took "Vector<char>&" now take an adapter class.
      
      The adapter relies on Vector<char> and Vector<uint8_t> classes having an identical layout.
      
      * wtf/text/Base64.cpp:
      (WTF::base64Encode):
      (WTF::base64URLEncode):
      (WTF::base64DecodeInternal):
      (WTF::base64Decode):
      (WTF::base64URLDecode):
      * wtf/text/Base64.h:
      (WTF::SignedOrUnsignedCharVectorAdapter):
      (WTF::ConstSignedOrUnsignedCharVectorAdapter):
      (WTF::base64Encode):
      (WTF::base64URLEncode):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159390 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f37f9b40
  5. 16 Nov, 2013 2 commits
    • ap@apple.com's avatar
      WebCrypto no longer uses sequences of ArrayBuffers · b651c9a6
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124451
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Covered by existing tests.
      
      Changed all operations to take single CryptoOperationData objects.
      
      * bindings/js/JSCryptoOperationData.cpp:
      * bindings/js/JSCryptoOperationData.h:
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::encrypt):
      (WebCore::JSSubtleCrypto::decrypt):
      (WebCore::JSSubtleCrypto::sign):
      (WebCore::JSSubtleCrypto::verify):
      (WebCore::JSSubtleCrypto::digest):
      * crypto/CryptoAlgorithm.cpp:
      (WebCore::CryptoAlgorithm::encrypt):
      (WebCore::CryptoAlgorithm::decrypt):
      (WebCore::CryptoAlgorithm::sign):
      (WebCore::CryptoAlgorithm::verify):
      (WebCore::CryptoAlgorithm::digest):
      * crypto/CryptoAlgorithm.h:
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
      * crypto/algorithms/CryptoAlgorithmHMAC.h:
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
      * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
      (WebCore::CryptoAlgorithmSHA1::digest):
      * crypto/algorithms/CryptoAlgorithmSHA1.h:
      * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
      (WebCore::CryptoAlgorithmSHA224::digest):
      * crypto/algorithms/CryptoAlgorithmSHA224.h:
      * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
      (WebCore::CryptoAlgorithmSHA256::digest):
      * crypto/algorithms/CryptoAlgorithmSHA256.h:
      * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
      (WebCore::CryptoAlgorithmSHA384::digest):
      * crypto/algorithms/CryptoAlgorithmSHA384.h:
      * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
      (WebCore::CryptoAlgorithmSHA512::digest):
      * crypto/algorithms/CryptoAlgorithmSHA512.h:
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::transformAES_CBC):
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::calculateSignature):
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
      
      LayoutTests: 
      
      Updated tests accordingly.
      
      * crypto/subtle/aes-cbc-192-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-256-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt-expected.txt:
      * crypto/subtle/aes-cbc-encrypt-decrypt-with-padding.html:
      * crypto/subtle/aes-cbc-encrypt-decrypt.html:
      * crypto/subtle/aes-cbc-import-jwk.html:
      * crypto/subtle/aes-cbc-wrong-key-class-expected.txt:
      * crypto/subtle/aes-cbc-wrong-key-class.html:
      * crypto/subtle/argument-conversion-expected.txt:
      * crypto/subtle/argument-conversion.html:
      * crypto/subtle/hmac-import-jwk.html:
      * crypto/subtle/hmac-sign-verify-empty-key.html:
      * crypto/subtle/hmac-sign-verify.html:
      * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html:
      * crypto/subtle/sha-1-expected.txt:
      * crypto/subtle/sha-1.html:
      * crypto/subtle/sha-224-expected.txt:
      * crypto/subtle/sha-224.html:
      * crypto/subtle/sha-256-expected.txt:
      * crypto/subtle/sha-256.html:
      * crypto/subtle/sha-384-expected.txt:
      * crypto/subtle/sha-384.html:
      * crypto/subtle/sha-512-expected.txt:
      * crypto/subtle/sha-512.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b651c9a6
    • ap@apple.com's avatar
      Support exporting symmetric keys as JWK · ca827605
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124442
      
      Reviewed by Sam Weinig.
      
      Source/JavaScriptCore: 
      
      * runtime/JSONObject.h: Export JSONStringify.
      
      Source/WebCore: 
      
      Error handling is not consistent yet - some errors cause exceptions, and others
      result in rejected promises. This part of spec is incomplete, so I basically did
      what was most straightforward in each case.
      
      * bindings/js/JSCryptoKeySerializationJWK.h: 
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): Updated a comment with a better link.
      (WebCore::JSCryptoKeySerializationJWK::buildJSONForOctetSequence): A helper to building JWK.
      (WebCore::JSCryptoKeySerializationJWK::addToJSON): Ditto.
      (WebCore::JSCryptoKeySerializationJWK::addBoolToJSON): Ditto.
      (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON): Ditto. The code for
      mapping is my best guess, this all needs to be specified.
      (WebCore::JSCryptoKeySerializationJWK::addJWKUseToJSON): A helper to building JWK.
      (WebCore::JSCryptoKeySerializationJWK::serialize): Build a JSON string for the key.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::importKey): Updated a comment.
      (WebCore::JSSubtleCrypto::exportKey): Use CryptoKeySerialization (also for raw keys,
      for consistency).
      
      * crypto/CryptoKey.h:
      (WebCore::CryptoKey::algorithmIdentifier):
      (WebCore::CryptoKey::usagesBitmap):
      Exposed data needed for building JWK (it used to be only exposed in a form suitable
      for DOM accessors).
      
      * crypto/keys/CryptoKeyHMAC.h: Ditto, added an accessor for JWK.
      
      * crypto/keys/CryptoKeySerializationRaw.cpp: (WebCore::CryptoKeySerializationRaw::serialize):
      * crypto/keys/CryptoKeySerializationRaw.h:
      Moved from JSSubtleCryptoCustom.cpp for consistency.
      
      Source/WTF: 
      
      Base64URL encoding doesn't use '=' padding, and doesn't need any other options.
      Added this mode for encode, and removed policy arguments from exposed functions.
      
      * wtf/text/Base64.cpp:
      (WTF::base64EncodeInternal):
      (WTF::base64URLEncode):
      (WTF::base64URLDecode):
      * wtf/text/Base64.h:
      (WTF::base64URLEncode):
      
      LayoutTests: 
      
      * crypto/subtle/aes-export-key-expected.txt:
      * crypto/subtle/aes-export-key.html:
      * crypto/subtle/hmac-export-key-expected.txt:
      * crypto/subtle/hmac-export-key.html:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      ca827605
  6. 15 Nov, 2013 1 commit
    • commit-queue@webkit.org's avatar
      Modifying RTCIceCandidate object construction to match the spec · a1366a09
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=124369
      
      Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-11-15
      Reviewed by Eric Carlson.
      
      According to the spec the RTCIceCandidateInit parameter in RTCSessionDescription constructor is optional,
      which must not be nullable, and, if passed, must be a valid Dictionary. If the keys are not present, the string
      object that stores them in the RTCIceCandidate class, must be null in those cases. Also, if a key is present
      and its value is not valid an exception must be raised.
      
      Source/WebCore:
      
      Existing test was updated.
      
      * GNUmakefile.list.am:
      * Modules/mediastream/RTCIceCandidate.cpp:
      (WebCore::RTCIceCandidate::create):
      * Modules/mediastream/RTCIceCandidate.idl:
      * UseJSC.cmake:
      * WebCore.vcxproj/WebCore.vcxproj:
      * WebCore.vcxproj/WebCore.vcxproj.filters:
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/JSRTCIceCandidateCustom.cpp: Added.
      (WebCore::JSRTCIceCandidateConstructor::constructJSRTCIceCandidate):
      
      LayoutTests:
      
      * fast/mediastream/RTCIceCandidate-expected.txt:
      * fast/mediastream/RTCIceCandidate.html:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a1366a09
  7. 14 Nov, 2013 2 commits
    • commit-queue@webkit.org's avatar
      Clean up sequence handling in Blob constructor · 933bf408
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=124343
      
      Patch by Victor Costan <costan@gmail.com> on 2013-11-14
      Reviewed by Alexey Proskuryakov.
      
      Source/WebCore:
      
      Added test case to LayoutTests/fast/files/blob-constructor.html
      
      * bindings/js/JSBlobCustom.cpp:
      (WebCore::JSBlobConstructor::constructJSBlob):
          Handle exceptions in sequences, eliminate double type-checking for
          ArrayBuffer, ArrayBufferView and Blob parts.
      
      LayoutTests:
      
      * fast/files/blob-constructor-expected.txt:
      * fast/files/script-tests/blob-constructor.js:
          Add test with sequence that throws an error on property access.
      (get Object):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      933bf408
    • ap@apple.com's avatar
      Implement raw format for WebCrypto key export · 32fdefdd
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124376
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-export-key.html
             crypto/subtle/hmac-export-key.html
      
      A CryptoKey just exports its native CryptoKeyData, which will also work nicely for
      JWK format soon. For spki and pkcs8, we'll need to figure out the best way to
      utilize platform library support for ASN.1, but we are not there yet.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::JSSubtleCrypto::exportKey):
      * crypto/CryptoKey.h:
      * crypto/SubtleCrypto.idl:
      * crypto/keys/CryptoKeyAES.cpp:
      (WebCore::CryptoKeyAES::exportData):
      * crypto/keys/CryptoKeyAES.h:
      * crypto/keys/CryptoKeyHMAC.cpp:
      (WebCore::CryptoKeyHMAC::exportData):
      * crypto/keys/CryptoKeyHMAC.h:
      
      * crypto/keys/CryptoKeyRSA.h:
      * crypto/mac/CryptoKeyRSAMac.cpp:
      (WebCore::CryptoKeyRSA::exportData):
      Added a dummy implementation for RSA.
      
      LayoutTests: 
      
      * crypto/subtle/aes-export-key-expected.txt: Added.
      * crypto/subtle/aes-export-key.html: Added.
      * crypto/subtle/hmac-export-key-expected.txt: Added.
      * crypto/subtle/hmac-export-key.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159310 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      32fdefdd
  8. 13 Nov, 2013 4 commits
    • commit-queue@webkit.org's avatar
      Source/WebCore: Blob constructor accepts a sequence (array-like object) as first arg. · 847e8c7e
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=124175
      
      Patch by Victor Costan <costan@gmail.com> on 2013-11-13
      Reviewed by Christophe Dumez.
      
      Added test cases to fast/files/script-tests/blob-constructor.js.
      
      * bindings/js/JSBlobCustom.cpp: Make the constructor work with sequences.
      (WebCore::JSBlobConstructor::constructJSBlob):
      * bindings/js/JSDOMBinding.h:
      (WebCore::toJSSequence): Slightly better error message when conversion fails.
      (WebCore::toJS): Whitespace.
      (WebCore::jsArray): Whitespace.
      
      LayoutTests: Blob constructor accepts a sequence (array-like object) as first arg.
      https://bugs.webkit.org/show_bug.cgi?id=124175
      
      Patch by Victor Costan <costan@gmail.com> on 2013-11-13
      Reviewed by Christophe Dumez.
      
      * crypto/subtle/argument-conversion-expected.txt: Updated sequence error expectations.
      * fast/dom/Window/window-postmessage-args-expected.txt: Updated sequence error expectations.
      * fast/events/constructors/message-event-constructor-expected.txt: Updated sequence error expectations.
      * fast/events/message-port-multi-expected.txt: Updated sequence error expectations.
      * fast/files/blob-constructor-expected.txt: Updated error text and added expectations.
      * fast/files/script-tests/blob-constructor.js: Added sequence test cases.
      * fast/workers/worker-context-multi-port-expected.txt: Updated sequence error expectations.
      * fast/workers/worker-multi-port-expected.txt: Updated sequence error expectations.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      847e8c7e
    • commit-queue@webkit.org's avatar
      Modifying RTCSessionDescription object construction to match the spec · 53a006ec
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=124212
      
      Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-11-13
      Reviewed by Eric Carlson.
      
      According to the spec the RTCSessionDescriptionInit parameter in RTCSessionDescription constructor is optional,
      which must not be nullable. If the 'type' and/or 'sdp' keys are not present, the string object that stores
      them in the RTCSessionDescription class, must be null in those cases. Also, if an object that is not a
      Dictionary is passed as argument to the constructor, an exception must be raised.
      
      Source/WebCore:
      
      Existing test was updated.
      
      * GNUmakefile.list.am:
      * Modules/mediastream/RTCSessionDescription.cpp:
      (WebCore::RTCSessionDescription::create):
      * Modules/mediastream/RTCSessionDescription.idl:
      * UseJSC.cmake:
      * WebCore.vcxproj/WebCore.vcxproj:
      * WebCore.vcxproj/WebCore.vcxproj.filters:
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/JSRTCSessionDescriptionCustom.cpp: Added.
      (WebCore::JSRTCSessionDescriptionConstructor::constructJSRTCSessionDescription):
      
      LayoutTests:
      
      * fast/mediastream/RTCSessionDescription-expected.txt:
      * fast/mediastream/RTCSessionDescription.html:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159230 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      53a006ec
    • ap@apple.com's avatar
      Check WebCrypto parameter types when casting · 2882324e
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124297
      
      Reviewed by Sam Weinig.
      
      Also changed existing toCryptoXXX functions to use TYPE_CASTS_BASE mechanism.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
      And sure enough, there was a bug caught by the added checks.
      
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
      * crypto/CryptoAlgorithmParameters.h:
      (WebCore::CryptoAlgorithmParameters::ENUM_CLASS):
      (WebCore::CryptoAlgorithmParameters::parametersClass):
      * crypto/CryptoKey.h:
      * crypto/CryptoKeyData.h:
      * crypto/CryptoKeySerialization.h:
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::generateKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::generateKey):
      (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
      * crypto/keys/CryptoKeyAES.h:
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::isCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyDataRSAComponents.h:
      (WebCore::isCryptoKeyDataRSAComponents):
      * crypto/keys/CryptoKeyHMAC.h:
      * crypto/keys/CryptoKeyRSA.h:
      * crypto/keys/CryptoKeySerializationRaw.h:
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      * crypto/parameters/CryptoAlgorithmAesCbcParams.h:
      * crypto/parameters/CryptoAlgorithmAesKeyGenParams.h:
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
      * crypto/parameters/CryptoAlgorithmHmacParams.h:
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h:
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h:
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      2882324e
    • ap@apple.com's avatar
      Implement key generation and JWK import for RSASSA-PKCS1-v1_5 · a237529b
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124236
      
      Reviewed by Sam Weinig.
      
      Source/WebCore:
      
      Tests: crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html
             crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      (WebCore::JSCryptoAlgorithmBuilder::add):
      * bindings/js/JSCryptoAlgorithmBuilder.h:
      * crypto/CryptoAlgorithmDescriptionBuilder.h:
      Added a way to add an Uint8Array, as needed for RSA key.algorithm.publicExponent.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams): Removed unneeded JSC prefixes.
      (WebCore::createAesKeyGenParams): Ditto.
      (WebCore::createHmacParams): Ditto.
      (WebCore::createHmacKeyParams): Ditto.
      (WebCore::createRsaKeyGenParams): Added.
      (WebCore::createRsaSsaKeyParams): Added. WebCrypto currently doesn't specify any
      parameters for importKey, so the structure remains blank (unlike with JWK).
      (WebCore::createRsaSsaParams): Added (currently unused, will be sued for sign/verify soon).
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): Ditto.
      
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::getJSArrayFromJSON): Added.
      (WebCore::getBigIntegerVectorFromJSON): Added.
      (WebCore::createRSASSAKeyParameters): Create parameters for key import. The key
      will remember which algorithm it's allowed to be used with.
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): Added support for
      RS256...RS512 (tha is, RSAES_PKCS1_v1_5 with SHA-256...SHA-512).
      (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): Split out of keyData().
      (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Added code to read
      RSA key components from JWK.
      (WebCore::JSCryptoKeySerializationJWK::keyData): Call one of the above functions.
      
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Added.
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      Placeholders.
      
      * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): Added RSA key class for poor man's RTTI.
      
      * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::FormatRSAComponents): Added RSAComponents
      for poor man's RTTI.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/keys/CryptoKeyAES.h:
      (WebCore::isCryptoKeyAES):
      (WebCore::toCryptoKeyAES):
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::toCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyHMAC.h:
      (WebCore::isCryptoKeyHMAC):
      (WebCore::toCryptoKeyHMAC):
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      Switched from "as" functions to "is" and "to" ones, as that's more idiomatic.
      
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Added.
      Glue code for importKey/generateKey for now.
      
      * crypto/keys/CryptoKeyDataRSAComponents.cpp: Added.
      (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
      (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents):
      * crypto/keys/CryptoKeyDataRSAComponents.h: Added.
      (WebCore::toCryptoKeyDataRSAComponents):
      Added a structure to hold RSA key components, extracted from JWK or another format.
      
      * crypto/keys/CryptoKeyRSA.h: Added.
      * crypto/mac/CryptoKeyRSAMac.cpp: Added.
      
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
      Register RSASSA_PKCS1_v1_5.
      
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added a constructor to make
      sure that hasLength is never left uninitialized, even when reading formats that
      don't contain a length.
      
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Added.
      Added parameter structures that are needed for RSASSA_PKCS1_v1_5.
      
      LayoutTests:
      
      * crypto/subtle/resources/common.js:
      (hexToArrayBuffer): Fixed a typo
      (Base64URL.stringify):
      (Base64URL.parse):
      Added helpers to deal with Base64URL, as needed for JWK.
      
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      a237529b
  9. 12 Nov, 2013 3 commits
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r159160, r159161, and r159164. · 388f415d
      commit-queue@webkit.org authored
      http://trac.webkit.org/changeset/159160
      http://trac.webkit.org/changeset/159161
      http://trac.webkit.org/changeset/159164
      https://bugs.webkit.org/show_bug.cgi?id=124253
      
      Too many errors (make fewer) (Requested by ap on #webkit).
      
      Source/WebCore:
      
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      * bindings/js/JSCryptoAlgorithmBuilder.h:
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams):
      (WebCore::createAesKeyGenParams):
      (WebCore::createHmacParams):
      (WebCore::createHmacKeyParams):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey):
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
      (WebCore::JSCryptoKeySerializationJWK::keyData):
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * crypto/CryptoAlgorithmDescriptionBuilder.h:
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Removed.
      * crypto/CryptoKey.h:
      (WebCore::ENUM_CLASS):
      * crypto/CryptoKeyData.h:
      (WebCore::CryptoKeyData::ENUM_CLASS):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::importKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Removed.
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Removed.
      * crypto/keys/CryptoKeyAES.h:
      (WebCore::asCryptoKeyAES):
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::asCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyDataRSAComponents.cpp: Removed.
      * crypto/keys/CryptoKeyDataRSAComponents.h: Removed.
      * crypto/keys/CryptoKeyHMAC.h:
      (WebCore::asCryptoKeyHMAC):
      * crypto/keys/CryptoKeyRSA.h: Removed.
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
      * crypto/mac/CryptoKeyRSAMac.cpp: Removed.
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Removed.
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Removed.
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Removed.
      
      LayoutTests:
      
      * crypto/subtle/resources/common.js:
      (hexToArrayBuffer):
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Removed.
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Removed.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Removed.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Removed.
      * platform/mac/TestExpectations:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159167 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      388f415d
    • ap@apple.com's avatar
      Implement key generation and JWK import for RSASSA-PKCS1-v1_5 · 668796b4
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124236
      
      Release build fix.
      
      * bindings/js/JSCryptoAlgorithmBuilder.cpp: Include TypedArrayInlines.h
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      668796b4
    • ap@apple.com's avatar
      Implement key generation and JWK import for RSASSA-PKCS1-v1_5 · c0d58adc
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124236
      
      Reviewed by Sam Weinig.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html
             crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmBuilder.cpp:
      (WebCore::JSCryptoAlgorithmBuilder::add):
      * bindings/js/JSCryptoAlgorithmBuilder.h:
      * crypto/CryptoAlgorithmDescriptionBuilder.h:
      Added a way to add an Uint8Array, as needed for RSA key.algorithm.publicExponent.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams): Removed unneeded JSC prefixes.
      (WebCore::createAesKeyGenParams): Ditto.
      (WebCore::createHmacParams): Ditto.
      (WebCore::createHmacKeyParams): Ditto.
      (WebCore::createRsaKeyGenParams): Added. 
      (WebCore::createRsaSsaKeyParams): Added. WebCrypto currently doesn't specify any
      parameters for importKey, so the structure remains blank (unlike with JWK).
      (WebCore::createRsaSsaParams): Added (currently unused, will be sued for sign/verify soon).
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Added support for RSAES_PKCS1_v1_5.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Removed unneeded JSC prefixes.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForWrapKey): Ditto.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForUnwrapKey): Ditto.
      
      * bindings/js/JSCryptoKeySerializationJWK.h:
      * bindings/js/JSCryptoKeySerializationJWK.cpp:
      (WebCore::getJSArrayFromJSON): Added.
      (WebCore::getBigIntegerVectorFromJSON): Added.
      (WebCore::createRSASSAKeyParameters): Create parameters for key import. The key
      will remember which algorithm it's allowed to be used with.
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): Added support for
      RS256...RS512 (tha is, RSAES_PKCS1_v1_5 with SHA-256...SHA-512).
      (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence): Split out of keyData().
      (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents): Added code to read
      RSA key components from JWK.
      (WebCore::JSCryptoKeySerializationJWK::keyData): Call one of the above functions.
      
      * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp: Added.
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
      (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
      Placeholders.
      
      * crypto/CryptoKey.h: (WebCore::CryptoKeyClass): Added RSA key class for poor man's RTTI.
      
      * crypto/CryptoKeyData.h: (WebCore::CryptoKeyData::FormatRSAComponents): Added RSAComponents
      for poor man's RTTI.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::importKey): 
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/keys/CryptoKeyAES.h:
      (WebCore::isCryptoKeyAES):
      (WebCore::toCryptoKeyAES):
      * crypto/keys/CryptoKeyDataOctetSequence.h:
      (WebCore::toCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyHMAC.h:
      (WebCore::isCryptoKeyHMAC):
      (WebCore::toCryptoKeyHMAC):
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::encrypt):
      (WebCore::CryptoAlgorithmAES_CBC::decrypt):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::sign):
      (WebCore::CryptoAlgorithmHMAC::verify):
      Switched from "as" functions to "is" and "to" ones, as that's more idiomatic.
      
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: Added.
      * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h: Added.
      Glue code for importKey/generateKey for now.
      
      * crypto/keys/CryptoKeyDataRSAComponents.cpp: Added.
      (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
      (WebCore::CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents):
      * crypto/keys/CryptoKeyDataRSAComponents.h: Added.
      (WebCore::toCryptoKeyDataRSAComponents):
      Added a structure to hold RSA key components, extracted from JWK or another format.
      
      * crypto/keys/CryptoKeyRSA.h: Added.
      * crypto/mac/CryptoKeyRSAMac.cpp: Added.
      
      * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
      (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
      Register RSASSA_PKCS1_v1_5.
      
      * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Added a constructor to make
      sure that hasLength is never left uninitialized, even when reading formats that
      don't contain a length.
      
      * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaKeyParams.h: Added.
      * crypto/parameters/CryptoAlgorithmRsaSsaParams.h: Added.
      Added parameter structures that are needed for RSASSA_PKCS1_v1_5.
      
      LayoutTests: 
      
      * crypto/subtle/resources/common.js:
      (hexToArrayBuffer): Fixed a typo
      (Base64URL.stringify):
      (Base64URL.parse):
      Added helpers to deal with Base64URL, as needed for JWK.
      
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-generate-key.html: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-expected.txt: Added.
      * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159160 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c0d58adc
  10. 11 Nov, 2013 1 commit
    • ap@apple.com's avatar
      Support WebCrypto KeyPair interface · b4086485
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124161
      
      Reviewed by Geoffrey Garen.
      
      No new tests yet, will be tested once generateKey is implemented for any RSA algorithms.
      
      * CMakeLists.txt:
      * DerivedSources.make:
      * GNUmakefile.list.am:
      * WebCore.xcodeproj/project.pbxproj:
      Added new files.
      
      * bindings/js/JSDOMPromise.h: Support returning a key pair via a promise.
      
      * bindings/js/JSCryptoKeyPairCustom.cpp: Added.
      (WebCore::JSCryptoKeyPair::visitChildren):
      * crypto/CryptoKey.idl:
      CryptoKey wrapper is reachable through KeyPair, but it doesn't have (or need)
      a back pointer.
      
      * crypto/CryptoKeyPair.cpp: Added.
      (WebCore::CryptoKeyPair::CryptoKeyPair):
      (WebCore::CryptoKeyPair::~CryptoKeyPair):
      * crypto/CryptoKeyPair.h: Added.
      (WebCore::CryptoKeyPair::create):
      (WebCore::CryptoKeyPair::publicKey):
      (WebCore::CryptoKeyPair::privateKey):
      * crypto/CryptoKeyPair.idl: Added.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159068 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      b4086485
  11. 09 Nov, 2013 1 commit
  12. 08 Nov, 2013 6 commits
    • akling@apple.com's avatar
      Reindent JSDOMBinding.h (finally.) · 41368284
      akling@apple.com authored
      Rubber-stamped by Sam Weinig.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      41368284
    • andersca@apple.com's avatar
      Implement more KeyedEncoder functionality · 955aabc0
      andersca@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124089
      
      Reviewed by Beth Dakin.
      
      Source/WebCore:
      
      * bindings/js/SerializedScriptValue.h:
      * history/HistoryItem.cpp:
      (WebCore::HistoryItem::encodeBackForwardTreeNode):
      * platform/KeyedCoding.h:
      (WebCore::KeyedEncoder::encodeConditionalObject):
      
      Source/WebKit2:
      
      * Shared/cf/KeyedEncoder.cpp:
      (WebKit::KeyedEncoder::encodeBytes):
      (WebKit::KeyedEncoder::encodeInt32):
      (WebKit::KeyedEncoder::encodeFloat):
      * Shared/cf/KeyedEncoder.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      955aabc0
    • commit-queue@webkit.org's avatar
      Checking for TypeError in RTCPeerConnection object creation · 9d56fba8
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=124049
      
      Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-11-08
      Reviewed by Eric Carlson.
      
      Source/WebCore:
      
      If invalid parameters are passed on RTCPeerConnection creation we must throw a TypeError exception.
      According to the spec it requires a Dictionary argument, the RTCConfiguration, which is mandatory.
      
      Please notice that this patch does not make every tests run as expected,
      RTCPeerConnectionHandlerMock needs to be update to deal with contraints.
      
      Existing tests were updated.
      
      * GNUmakefile.list.am:
      * Modules/mediastream/RTCPeerConnection.idl:
      * UseJSC.cmake:
      * WebCore.vcxproj/WebCore.vcxproj:
      * WebCore.vcxproj/WebCore.vcxproj.filters:
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/JSRTCPeerConnectionCustom.cpp: Added.
      (WebCore::JSRTCPeerConnectionConstructor::constructJSRTCPeerConnection):
      
      LayoutTests:
      
      Please notice that this patch does not make every tests run as expected,
      RTCPeerConnectionHandlerMock needs to be update to deal with contraints.
      
      * fast/mediastream/RTCPeerConnection-AddRemoveStream.html:
      * fast/mediastream/RTCPeerConnection-createAnswer.html:
      * fast/mediastream/RTCPeerConnection-createOffer.html:
      * fast/mediastream/RTCPeerConnection-datachannel.html:
      * fast/mediastream/RTCPeerConnection-dtmf.html:
      * fast/mediastream/RTCPeerConnection-events.html:
      * fast/mediastream/RTCPeerConnection-expected.txt:
      * fast/mediastream/RTCPeerConnection-ice-expected.txt:
      * fast/mediastream/RTCPeerConnection-ice.html:
      * fast/mediastream/RTCPeerConnection-localDescription.html:
      * fast/mediastream/RTCPeerConnection-onnegotiationneeded.html:
      * fast/mediastream/RTCPeerConnection-remoteDescription.html:
      * fast/mediastream/RTCPeerConnection-stats-expected.txt:
      * fast/mediastream/RTCPeerConnection-stats.html:
      * fast/mediastream/RTCPeerConnection-statsSelector-expected.txt:
      * fast/mediastream/RTCPeerConnection-statsSelector.html:
      * fast/mediastream/RTCPeerConnection.html:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9d56fba8
    • ap@apple.com's avatar
      Implement JWK key import for HMAC and AES-CBC · 7f6fd501
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=124059
      
      Reviewed by Anders Carlsson.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-cbc-import-jwk.html
             crypto/subtle/hmac-import-jwk.html
             crypto/subtle/import-jwk.html
      
      WebCrypto supports multiple key formats - raw, pkcs8, spki, jwk. The design is that
      we'll transform these into parsed KeyData subclasses before passing to algorithms.
      
      CryptoKeySerialization is a base class for handling all these formats.
      
      * WebCore.xcodeproj/project.pbxproj: Added new files. Removed CryptoKeyFormat.h.
              
      * bindings/js/JSCryptoKeySerializationJWK.h: Added.
      * bindings/js/JSCryptoKeySerializationJWK.cpp: Added.
      (WebCore::getStringFromJSON): A helper. Note that we can rely on the object being
      a nice freshly parsed JSON, no getters or anything.
      (WebCore::getBooleanFromJSON): Ditto.
      (WebCore::JSCryptoKeySerializationJWK::JSCryptoKeySerializationJWK):
      (WebCore::JSCryptoKeySerializationJWK::~JSCryptoKeySerializationJWK):
      (WebCore::createHMACParameters): A simple helper.
      (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm): WebCrypto API is weird,
      you can have algorithm parameters both inside a JWK key and passed as importKey()
      arguments. They need to agree, whatever that means for specific serialization's
      algorithm options (not all necessarily have a 1-1 matching to WebCrypto).
      (WebCore::JSCryptoKeySerializationJWK::reconcileUsages): Take an intersection of usages.
      (WebCore::JSCryptoKeySerializationJWK::reconcileExtractable): Only extractable if
      both JWK and the caller agree.
      (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid): Verify validity of JWK key.
      (WebCore::JSCryptoKeySerializationJWK::keyData): Return an appropriate KeyData
      subclass.
      
      * bindings/js/JSSubtleCryptoCustom.cpp:
      (WebCore::ENUM_CLASS): Moved CryptoKeyFormat here.
      (WebCore::cryptoKeyFormatFromJSValue): Added a human readable string to an exception.
      (WebCore::JSSubtleCrypto::importKey): Support multiple key formats, not just raw.
      
      * crypto/CryptoAlgorithm.cpp: (WebCore::CryptoAlgorithm::importKey):
      * crypto/CryptoAlgorithm.h:
      Updated signature for importKey to one that makes more sense. Decoding formats all
      the way from a binary blob is not something that CryptoAlgorithm subclasses should
      do, we now pass a KeyData subclass instead.
      Removed exportKey/wrapKey/unwrapKey altogether, because I don't yet know what the
      signatures will be.
      
      * crypto/CryptoKeyData.h: Added.
      (WebCore::CryptoKeyData::ENUM_CLASS):
      (WebCore::CryptoKeyData::CryptoKeyData):
      (WebCore::CryptoKeyData::~CryptoKeyData):
      (WebCore::CryptoKeyData::format):
      A base class for passing key material to algorithms. Currently, only one type is
      supported, that being OctetSequence for secret keys. Keys for RSA and EC are more
      complicated, and secret/public ones are different too.
      
      * crypto/CryptoKeyFormat.h: Removed. There are too many key format classes
      confusingly floating around, and this was only needed in one file for parsing.
      
      * crypto/CryptoKeySerialization.h: Added.
      Base class for handling raw/pkcs8/spki/jwk keys.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::importKey):
      * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
      Updated to use CryptoKeyData.
      
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::importKey):
      * crypto/algorithms/CryptoAlgorithmHMAC.h:
      Updated to use CryptoKeyData.
      
      * crypto/keys/CryptoKeyDataOctetSequence.cpp: Added.
      (WebCore::CryptoKeyDataOctetSequence::CryptoKeyDataOctetSequence):
      (WebCore::CryptoKeyDataOctetSequence::~CryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeyDataOctetSequence.h: Added.
      (WebCore::asCryptoKeyDataOctetSequence):
      * crypto/keys/CryptoKeySerializationRaw.cpp: Added.
      (WebCore::CryptoKeySerializationRaw::CryptoKeySerializationRaw):
      (WebCore::CryptoKeySerializationRaw::~CryptoKeySerializationRaw):
      (WebCore::CryptoKeySerializationRaw::reconcileAlgorithm):
      (WebCore::CryptoKeySerializationRaw::reconcileUsages):
      (WebCore::CryptoKeySerializationRaw::reconcileExtractable):
      (WebCore::CryptoKeySerializationRaw::keyData):
      * crypto/keys/CryptoKeySerializationRaw.h: Added.
      Much code to pass around a Vector<char>.
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-import-jwk-expected.txt: Added.
      * crypto/subtle/aes-cbc-import-jwk.html: Added.
      * crypto/subtle/hmac-import-jwk-expected.txt: Added.
      * crypto/subtle/hmac-import-jwk.html: Added.
      * crypto/subtle/import-jwk-expected.txt: Added.
      * crypto/subtle/import-jwk.html: Added.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7f6fd501
    • mark.lam@apple.com's avatar
      Move breakpoint (and exception break) functionality into JSC::Debugger. · 26c53408
      mark.lam@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=121796.
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore: 
      
      - In ScriptDebugServer and JSC::Debugger, SourceID and BreakpointID are
        now numeric tokens.
      
      - JSC::Debugger now tracks user defined breakpoints in a JSC::Breakpoint
        record. Previously, this info is tracked in the ScriptBreakpoint record
        in ScriptDebugServer. The only element of ScriptBreakpoint that is not
        being tracked by JSC::Breakpoint is the ScriptBreakpointAction.
           The ScriptBreakpointAction is still tracked by the ScriptDebugServer
        in a list keyed on the corresponding BreakpointID.
           The ScriptBreakpoint record is now only used as a means of passing
        breakpoint paramaters to the ScriptDebugServer.
      
      - ScriptDebugServer now no longer accesses the JSC::CallFrame* directly.
        It always goes through the DebuggerCallFrame.
      
      * GNUmakefile.list.am:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
      * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
      * JavaScriptCore.xcodeproj/project.pbxproj:
      * debugger/Breakpoint.h: Added.
      (JSC::Breakpoint::Breakpoint):
      - Breakpoint class to track info for each breakpoint in JSC::Debugger.
      * debugger/Debugger.cpp:
      (JSC::DebuggerCallFrameScope::DebuggerCallFrameScope):
      (JSC::DebuggerCallFrameScope::~DebuggerCallFrameScope):
      (JSC::Debugger::Debugger):
      (JSC::Debugger::detach):
      (JSC::Debugger::updateNeedForOpDebugCallbacks):
      (JSC::Debugger::setBreakpoint):
      (JSC::Debugger::removeBreakpoint):
      (JSC::Debugger::hasBreakpoint):
      (JSC::Debugger::clearBreakpoints):
      (JSC::Debugger::setBreakpointsActivated):
      (JSC::Debugger::setPauseOnExceptionsState):
      (JSC::Debugger::setPauseOnNextStatement):
      (JSC::Debugger::breakProgram):
      (JSC::Debugger::continueProgram):
      (JSC::Debugger::stepIntoStatement):
      (JSC::Debugger::stepOverStatement):
      (JSC::Debugger::stepOutOfFunction):
      (JSC::Debugger::updateCallFrame):
      (JSC::Debugger::updateCallFrameAndPauseIfNeeded):
      (JSC::Debugger::pauseIfNeeded):
      (JSC::Debugger::exception):
      (JSC::Debugger::atStatement):
      (JSC::Debugger::callEvent):
      (JSC::Debugger::returnEvent):
      (JSC::Debugger::willExecuteProgram):
      (JSC::Debugger::didExecuteProgram):
      (JSC::Debugger::didReachBreakpoint):
      (JSC::Debugger::currentDebuggerCallFrame):
      * debugger/Debugger.h:
      * debugger/DebuggerCallFrame.cpp:
      (JSC::DebuggerCallFrame::sourceID):
      (JSC::DebuggerCallFrame::sourceIDForCallFrame):
      * debugger/DebuggerCallFrame.h:
      * debugger/DebuggerPrimitives.h: Added.
      - define SourceID, noSourceID, BreakpointID, and noBreakpointID.
      
      Source/WebCore: 
      
      No new tests.
      
      - In ScriptDebugServer and JSC::Debugger, SourceID and BreakpointID are
        now numeric tokens.
      
      - JSC::Debugger now tracks user defined breakpoints in a JSC::Breakpoint
        record. Previously, this info is tracked in the ScriptBreakpoint record
        in ScriptDebugServer. The only element of ScriptBreakpoint that is not
        being tracked by JSC::Breakpoint is the ScriptBreakpointAction.
           The ScriptBreakpointAction is still tracked by the ScriptDebugServer
        in a list keyed on the corresponding BreakpointID.
           The ScriptBreakpoint record is now only used as a means of passing
        breakpoint paramaters to the ScriptDebugServer.
      
      - ScriptDebugServer now no longer accesses the JSC::CallFrame* directly.
        It always goes through the DebuggerCallFrame.
      
      * GNUmakefile.list.am:
      * WebCore.vcxproj/WebCore.vcxproj:
      * WebCore.vcxproj/WebCore.vcxproj.filters:
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/BreakpointID.h: Added.
      * bindings/js/ScriptDebugServer.cpp:
      (WebCore::ScriptDebugServer::ScriptDebugServer):
      (WebCore::ScriptDebugServer::setBreakpoint):
      (WebCore::ScriptDebugServer::removeBreakpoint):
      (WebCore::ScriptDebugServer::clearBreakpoints):
      (WebCore::ScriptDebugServer::dispatchDidPause):
      (WebCore::ScriptDebugServer::dispatchDidContinue):
      (WebCore::ScriptDebugServer::dispatchDidParseSource):
      (WebCore::ScriptDebugServer::notifyDoneProcessingDebuggerEvents):
      (WebCore::ScriptDebugServer::needPauseHandling):
      (WebCore::ScriptDebugServer::handleBreakpointHit):
      (WebCore::ScriptDebugServer::handleExceptionInBreakpointCondition):
      (WebCore::ScriptDebugServer::handlePause):
      * bindings/js/ScriptDebugServer.h:
      * bindings/js/SourceID.h: Added.
      * bindings/js/WorkerScriptDebugServer.cpp:
      (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer):
      * bindings/js/WorkerScriptDebugServer.h:
      * inspector/InspectorDebuggerAgent.cpp:
      (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent):
      (WebCore::parseLocation):
      (WebCore::InspectorDebuggerAgent::setBreakpoint):
      (WebCore::InspectorDebuggerAgent::continueToLocation):
      (WebCore::InspectorDebuggerAgent::resolveBreakpoint):
      (WebCore::InspectorDebuggerAgent::searchInContent):
      (WebCore::InspectorDebuggerAgent::getScriptSource):
      (WebCore::InspectorDebuggerAgent::didParseSource):
      (WebCore::InspectorDebuggerAgent::didPause):
      (WebCore::InspectorDebuggerAgent::clear):
      * inspector/InspectorDebuggerAgent.h:
      * inspector/ScriptDebugListener.h:
      
      Source/WebKit/mac: 
      
      * WebView/WebScriptDebugger.h:
      * WebView/WebScriptDebugger.mm:
      (WebScriptDebugger::WebScriptDebugger):
      (WebScriptDebugger::handlePause):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      26c53408
    • commit-queue@webkit.org's avatar
      InspectorConsoleAgent::didFinishXHRLoading ConsoleMessage should include a column number · 123c7261
      commit-queue@webkit.org authored
      https://bugs.webkit.org/show_bug.cgi?id=114316
      
      Patch by László Langó <lango@inf.u-szeged.hu> on 2013-11-08
      Reviewed by Timothy Hatcher.
      
      InspectorConsoleAgent::didFinishXHRLoading creates a ConsoleMessage with a line number,
      but it should also include a column number. It looks like ultimately the line number comes from
      JSXMLHttpRequest::send, it should also be possible to get the column number at the time.
      The column number would be needed by the Web Inspector to jump to the proper place in source code
      to show where the XHR originated from.
      
      * bindings/js/JSXMLHttpRequestCustom.cpp:
      (WebCore::SendFunctor::SendFunctor):
      (WebCore::SendFunctor::column):
      (WebCore::SendFunctor::operator()):
      (WebCore::JSXMLHttpRequest::send):
      * inspector/InspectorConsoleAgent.cpp:
      (WebCore::InspectorConsoleAgent::didFinishXHRLoading):
      * inspector/InspectorConsoleAgent.h:
      * inspector/InspectorInstrumentation.cpp:
      (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
      * inspector/InspectorInstrumentation.h:
      (WebCore::InspectorInstrumentation::didFinishXHRLoading):
      * xml/XMLHttpRequest.cpp:
      (WebCore::XMLHttpRequest::XMLHttpRequest):
      (WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber):
      (WebCore::XMLHttpRequest::didFinishLoading):
      * xml/XMLHttpRequest.h:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      123c7261
  13. 07 Nov, 2013 1 commit
    • mark.lam@apple.com's avatar
      Cosmetic: rename xxxId to xxxID for ScriptId, SourceId, and BreakpointId. · f1735518
      mark.lam@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123945.
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore: 
      
      * debugger/DebuggerCallFrame.cpp:
      (JSC::DebuggerCallFrame::sourceID):
      (JSC::DebuggerCallFrame::sourceIDForCallFrame):
      * debugger/DebuggerCallFrame.h:
      
      Source/WebCore: 
      
      No new tests.
      
      * bindings/js/JSInjectedScriptHostCustom.cpp:
      (WebCore::JSInjectedScriptHost::functionDetails):
      * bindings/js/JavaScriptCallFrame.h:
      (WebCore::JavaScriptCallFrame::sourceID):
      * bindings/js/ScriptDebugServer.cpp:
      (WebCore::ScriptDebugServer::ScriptDebugServer):
      (WebCore::ScriptDebugServer::setBreakpoint):
      (WebCore::ScriptDebugServer::removeBreakpoint):
      (WebCore::ScriptDebugServer::hasBreakpoint):
      (WebCore::ScriptDebugServer::clearBreakpoints):
      (WebCore::ScriptDebugServer::updateCallFrame):
      (WebCore::ScriptDebugServer::pauseIfNeeded):
      * bindings/js/ScriptDebugServer.h:
      * inspector/InspectorConsoleAgent.cpp:
      (WebCore::InspectorConsoleAgent::addMessageToConsole):
      * inspector/InspectorConsoleAgent.h:
      * inspector/InspectorConsoleInstrumentation.h:
      (WebCore::InspectorInstrumentation::addMessageToConsole):
      * inspector/InspectorDOMAgent.cpp:
      (WebCore::InspectorDOMAgent::buildObjectForEventListener):
      * inspector/InspectorDebuggerAgent.cpp:
      (WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
      (WebCore::parseLocation):
      (WebCore::InspectorDebuggerAgent::setBreakpoint):
      (WebCore::InspectorDebuggerAgent::removeBreakpoint):
      (WebCore::InspectorDebuggerAgent::continueToLocation):
      (WebCore::InspectorDebuggerAgent::resolveBreakpoint):
      (WebCore::InspectorDebuggerAgent::searchInContent):
      (WebCore::InspectorDebuggerAgent::setScriptSource):
      (WebCore::InspectorDebuggerAgent::getScriptSource):
      (WebCore::InspectorDebuggerAgent::compileScript):
      (WebCore::InspectorDebuggerAgent::runScript):
      (WebCore::InspectorDebuggerAgent::didParseSource):
      (WebCore::InspectorDebuggerAgent::didPause):
      (WebCore::InspectorDebuggerAgent::clear):
      (WebCore::InspectorDebuggerAgent::reset):
      * inspector/InspectorDebuggerAgent.h:
      * inspector/InspectorInstrumentation.cpp:
      (WebCore::InspectorInstrumentation::addMessageToConsoleImpl):
      * inspector/InspectorInstrumentation.h:
      * inspector/ScriptDebugListener.h:
      
      Source/WebKit/mac: 
      
      * WebView/WebScriptDebugger.mm:
      (WebScriptDebugger::exception):
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158862 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f1735518
  14. 06 Nov, 2013 2 commits
    • jer.noble@apple.com's avatar
      [MSE] Add MediaSource extensions to AudioTrack, VideoTrack, and TextTrack. · 9161ec36
      jer.noble@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123374
      
      Reviewed by Eric Carlson.
      
      No tests added; tests will be added when Mock implementations are added in a future patch.
      
      Add new partial interfaces for added methods on AudioTrack, TextTrack, and VideoTrack:
      * Modules/mediasource/AudioTrackMediaSource.idl: Add read-only sourceBuffer attribute.
      * Modules/mediasource/TextTrackMediaSource.idl: Ditto.
      * Modules/mediasource/VideoTrackMediaSource.idl: Ditto.
      * Modules/mediasource/AudioTrackMediaSource.h:
      (WebCore::AudioTrackMediaSource::sourceBuffer): Added static wrapper around non-static sourceBuffer().
      * Modules/mediasource/TextTrackMediaSource.h:
      (WebCore::TextTrackMediaSource::sourceBuffer): Ditto.
      * Modules/mediasource/VideoTrackMediaSource.h:
      (WebCore::VideoTrackMediaSource::sourceBuffer): Ditto.
      
      Add support for writable kind & language attributes through a custom setter:
      * bindings/js/JSAudioTrackCustom.cpp:
      (WebCore::JSAudioTrack::setKind):
      (WebCore::JSAudioTrack::setLanguage):
      * bindings/js/JSTextTrackCustom.cpp:
      (WebCore::JSTextTrack::setKind):
      (WebCore::JSTextTrack::setLanguage):
      * bindings/js/JSVideoTrackCustom.cpp:
      (WebCore::JSVideoTrack::setKind):
      (WebCore::JSVideoTrack::setLanguage):
      * html/track/AudioTrack.idl:
      * html/track/TextTrack.idl:
      * html/track/VideoTrack.idl:
      
      Add setter methods to the implementation classes:
      * html/track/TextTrack.cpp:
      (WebCore::TextTrack::TextTrack):
      (WebCore::TextTrack::setKind):
      (WebCore::TextTrack::setLanguage):
      * html/track/TextTrack.h:
      * html/track/TrackBase.cpp:
      (WebCore::TrackBase::TrackBase):
      (WebCore::TrackBase::setKind):
      (WebCore::TrackBase::setKindInternal):
      * html/track/TrackBase.h:
      (WebCore::TrackBase::setLanguage):
      (WebCore::TrackBase::sourceBuffer):
      (WebCore::TrackBase::setSourceBuffer):
      * html/track/VideoTrack.cpp:
      (WebCore::VideoTrack::VideoTrack):
      (WebCore::VideoTrack::setKind):
      (WebCore::VideoTrack::setLanguage):
      * html/track/VideoTrack.h:
      
      Implement the unimplemented portions of MediaSource and SourceBuffer:
      * Modules/mediasource/MediaSource.cpp:
      (WebCore::MediaSource::removeSourceBuffer):
      * Modules/mediasource/MediaSourceBase.cpp:
      (WebCore::MediaSourceBase::MediaSourceBase):
      (WebCore::MediaSourceBase::setPrivateAndOpen):
      (WebCore::MediaSourceBase::setReadyState):
      (WebCore::MediaSourceBase::attachToElement):
      * Modules/mediasource/MediaSourceBase.h:
      (WebCore::MediaSourceBase::mediaElement):
      * Modules/mediasource/SourceBuffer.cpp:
      (WebCore::SourceBuffer::videoTracks):
      (WebCore::SourceBuffer::audioTracks):
      (WebCore::SourceBuffer::textTracks):
      (WebCore::SourceBuffer::sourceBufferPrivateDidAddAudioTrack):
      (WebCore::SourceBuffer::sourceBufferPrivateDidAddVideoTrack):
      (WebCore::SourceBuffer::sourceBufferPrivateDidAddTextTrack):
      (WebCore::SourceBuffer::sourceBufferPrivateDidChangeActiveState):
      * Modules/mediasource/SourceBuffer.h:
      * Modules/mediasource/SourceBuffer.idl:
      
      Add new files to the project:
      * DerivedSources.make:
      * WebCore.xcodeproj/project.pbxproj:
      
      And a smorgasbord of other utility changes:
      * html/HTMLMediaElement.cpp:
      (WebCore::HTMLMediaElement::loadResource): Pass this when attaching.
      (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Ditto.
      * html/HTMLMediaSource.h:
      * html/track/TextTrackList.cpp:
      (TextTrackList::item): Make const.
      * html/track/TextTrackList.h:
      (WebCore::TextTrackList::lastItem): Added.
      * platform/graphics/InbandTextTrackPrivate.h:
      (WebCore::InbandTextTrackPrivate::create): Added.
      (WebCore::MockSourceBufferPrivate::trackDidChangeEnabled):
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      9161ec36
    • antti@apple.com's avatar
      HTMLCollection should use CollectionIndexCache · 1f289c61
      antti@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123906
      
      Reviewed by Ryosuke Niwa.
              
      More code sharing.
      
      * bindings/js/JSDOMWindowCustom.cpp:
      (WebCore::namedItemGetter):
      * bindings/js/JSHTMLDocumentCustom.cpp:
      (WebCore::JSHTMLDocument::nameGetter):
      * dom/ChildNodeList.h:
      * dom/CollectionIndexCache.h:
      (WebCore::::nodeBeforeCached):
      (WebCore::::nodeAfterCached):
      (WebCore::::nodeAt):
                  
          Add a mechanism for disabling use of backward traversal.
      
      * dom/LiveNodeList.h:
      (WebCore::LiveNodeList::collectionCanTraverseBackward):
      * html/HTMLCollection.cpp:
      (WebCore::HTMLCollection::HTMLCollection):
      (WebCore::isMatchingElement):
      (WebCore::HTMLCollection::iterateForPreviousElement):
      (WebCore::firstMatchingElement):
      (WebCore::nextMatchingElement):
      (WebCore::HTMLCollection::length):
      (WebCore::HTMLCollection::item):
      (WebCore::nameShouldBeVisibleInDocumentAll):
      (WebCore::firstMatchingChildElement):
      (WebCore::nextMatchingSiblingElement):
      (WebCore::HTMLCollection::firstElement):
      (WebCore::HTMLCollection::traverseForward):
      (WebCore::HTMLCollection::collectionFirst):
      (WebCore::HTMLCollection::collectionLast):
      (WebCore::HTMLCollection::collectionTraverseForward):
      (WebCore::HTMLCollection::collectionTraverseBackward):
      (WebCore::HTMLCollection::invalidateCache):
      (WebCore::HTMLCollection::namedItem):
      (WebCore::HTMLCollection::updateNameCache):
      * html/HTMLCollection.h:
      (WebCore::HTMLCollection::collectionCanTraverseBackward):
              
          Disable use of backward traversal for collections that use custom traversal.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158774 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      1f289c61
  15. 04 Nov, 2013 3 commits
    • msaboff@apple.com's avatar
      Eliminate HostCall bit from JSC Stack CallerFrame · c9b3ad6e
      msaboff@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123642
      
      Reviewed by Geoffrey Garen.
      
      Source/JavaScriptCore: 
      
      Replace the HostCallFrame bit or'ed to the CallerFrame value in a CallFrame with
      a VM entry sentinel CallFrame.  Logically, the VM entry sentinel call frame is
      pushed on the stack before the callee frame when calling from native to JavaScript
      code.  The callee frame's CallerFrame points at the VM entry sentinel call frame
      and the VM entry sentinel call frame's CallerFrame points to the real caller.
      The VM entry sentinel call frame has a sentinel (1) in the CodeBlock to indicate
      its a VM entry sentinel call frame.  It's ScopeChain has vm.topCallFrame at the
      time of the call.  This allows for a complete stack walk as well as walking just
      the contiguous JS frames.
      
      The VM entry sentinel call frame and callee frame are currently allocated and
      initialized in ExecState::init(), but this initialization will be moved to
      ctiTrampoline when we actually move onto the native stack.
      
      * bytecode/CodeBlock.cpp:
      (JSC::CodeBlock::noticeIncomingCall):
      * debugger/DebuggerCallFrame.cpp:
      (JSC::DebuggerCallFrame::callerFrame):
      * dfg/DFGJITCompiler.cpp:
      (JSC::DFG::JITCompiler::compileExceptionHandlers):
      * interpreter/CallFrame.h:
      (JSC::ExecState::frameExtent):
      (JSC::ExecState::currentVPC):
      (JSC::ExecState::setCurrentVPC):
      (JSC::ExecState::init):
      (JSC::ExecState::noCaller):
      (JSC::ExecState::isVMEntrySentinel):
      (JSC::ExecState::vmEntrySentinelCallerFrame):
      (JSC::ExecState::initializeVMEntrySentinelFrame):
      (JSC::ExecState::callerFrameSkippingVMEntrySentinel):
      (JSC::ExecState::vmEntrySentinelCodeBlock):
      * interpreter/Interpreter.cpp:
      (JSC::unwindCallFrame):
      (JSC::Interpreter::getStackTrace):
      * interpreter/Interpreter.h:
      (JSC::TopCallFrameSetter::TopCallFrameSetter):
      (JSC::TopCallFrameSetter::~TopCallFrameSetter):
      (JSC::NativeCallFrameTracer::NativeCallFrameTracer):
      * interpreter/JSStack.cpp:
      (JSC::JSStack::~JSStack):
      * interpreter/JSStackInlines.h:
      (JSC::JSStack::getStartOfFrame):
      (JSC::JSStack::pushFrame):
      (JSC::JSStack::popFrame):
      * interpreter/Register.h:
      (JSC::Register::operator=):
      (JSC::Register::callFrame):
      * interpreter/StackVisitor.cpp:
      (JSC::StackVisitor::readFrame):
      (JSC::StackVisitor::readNonInlinedFrame):
      (JSC::StackVisitor::readInlinedFrame):
      (JSC::StackVisitor::Frame::print):
      * interpreter/VMInspector.cpp:
      (JSC::VMInspector::countFrames):
      * jit/JIT.cpp:
      (JSC::JIT::privateCompileExceptionHandlers):
      * jit/JITOperations.cpp:
      * jit/JITStubsARM.h:
      (JSC::ctiTrampoline):
      * jit/JITStubsARM64.h:
      * jit/JITStubsARMv7.h:
      (JSC::ctiTrampoline):
      * jit/JITStubsMIPS.h:
      * jit/JITStubsMSVC64.asm:
      * jit/JITStubsSH4.h:
      * jit/JITStubsX86.h:
      * jit/JITStubsX86_64.h:
      * jsc.cpp:
      (functionDumpCallFrame):
      * llint/LowLevelInterpreter.cpp:
      (JSC::CLoop::execute):
      * runtime/VM.cpp:
      (JSC::VM::VM):
      (JSC::VM::throwException):
      
      Source/WebCore: 
      
      Updated JavaScript stack walking as a result of the corresponding changes made in
      JavaScriptCore.
      
      * bindings/js/ScriptController.cpp:
      (WebCore::ScriptController::shouldBypassMainWorldContentSecurityPolicy):
      * bindings/js/ScriptDebugServer.cpp:
      (WebCore::ScriptDebugServer::stepOutOfFunction):
      (WebCore::ScriptDebugServer::returnEvent):
      (WebCore::ScriptDebugServer::didExecuteProgram):
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c9b3ad6e
    • ap@apple.com's avatar
      Implement generateKey for HMAC and AES-CBC · 7537b6dc
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123669
      
      Reviewed by Dan Bernstein.
      
      Source/WebCore: 
      
      Tests: crypto/subtle/aes-cbc-generate-key.html
             crypto/subtle/hmac-generate-key.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesKeyGenParams): Added bindings for AesKeyGenParams.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Handle
      algorithms that generate AES and HMAC keys.
      
      * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::generateKey): Added.
      
      * crypto/CryptoAlgorithmAesKeyGenParams.h: Added.
      
      * crypto/CryptoKey.cpp: (WebCore::CryptoKey::randomData):
      * crypto/CryptoKey.h:
      * crypto/CryptoKeyMac.cpp: Added
      Expose a function that produces random data for symmetric crypto keys. Cross-platform
      implementation uses ARC4 code from WTF, while Mac uses a system function that
      provides a FIPS validated random number generator.
      
      * crypto/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate):
      * crypto/CryptoKeyAES.h:
      Added a function that creates AES keys.
      
      * crypto/SubtleCrypto.idl: Added generateKey.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::generateKey): Added.
      
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::generateKey): Added.
      
      * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate):
      * crypto/keys/CryptoKeyHMAC.h:
      Added a function that creates HMAC keys.
      
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: Removed generateKey stub, the implementation
      ended up in cross-platform file.
      
      * crypto/mac/CryptoAlgorithmHMACMac.cpp: Ditto.
      
      LayoutTests: 
      
      * crypto/subtle/aes-cbc-generate-key-expected.txt: Added.
      * crypto/subtle/aes-cbc-generate-key.html: Added.
      * crypto/subtle/hmac-generate-key-expected.txt: Added.
      * crypto/subtle/hmac-generate-key.html: Added.
      
      * crypto/subtle/sha-1-expected.txt: Now that crypto.webkitSubtle.generateKey exists,
      a different exception is raised.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158582 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      7537b6dc
    • commit-queue@webkit.org's avatar
      Unreviewed, rolling out r158526. · 18e275da
      commit-queue@webkit.org authored
      http://trac.webkit.org/changeset/158526
      https://bugs.webkit.org/show_bug.cgi?id=123744
      
      it broke the build (Requested by jessieberlin on #webkit).
      
      Source/WebCore:
      
      * WebCore.xcodeproj/project.pbxproj:
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesCbcParams):
      (WebCore::createHmacParams):
      (WebCore::createHmacKeyParams):
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey):
      * bindings/js/JSSubtleCryptoCustom.cpp:
      * crypto/CryptoAlgorithmAesKeyGenParams.h: Removed.
      * crypto/CryptoKey.cpp:
      * crypto/CryptoKey.h:
      * crypto/CryptoKeyAES.cpp:
      * crypto/CryptoKeyAES.h:
      * crypto/CryptoKeyMac.cpp: Removed.
      * crypto/SubtleCrypto.idl:
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      * crypto/keys/CryptoKeyHMAC.cpp:
      * crypto/keys/CryptoKeyHMAC.h:
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::generateKey):
      * crypto/mac/CryptoAlgorithmHMACMac.cpp:
      (WebCore::CryptoAlgorithmHMAC::generateKey):
      
      LayoutTests:
      
      * crypto/subtle/aes-cbc-generate-key-expected.txt: Removed.
      * crypto/subtle/aes-cbc-generate-key.html: Removed.
      * crypto/subtle/hmac-generate-key-expected.txt: Removed.
      * crypto/subtle/hmac-generate-key.html: Removed.
      * crypto/subtle/sha-1-expected.txt:
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158578 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      18e275da
  16. 03 Nov, 2013 3 commits
    • akling@apple.com's avatar
      HTMLOptionsCollection is always rooted at a HTMLSelectElement. · f954a071
      akling@apple.com authored
      <https://webkit.org/b/123719>
      
      Tighten up HTMLOptionsCollection by making the constructor take
      a HTMLSelectElement& and adding a HTMLSelectElement& getter instead
      of casting all over the place. Removed now-pointless assertions.
      
      Reviewed by Sam Weinig.
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158557 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      f954a071
    • antti@apple.com's avatar
      ChildNodeList should not be LiveNodeList · d5743425
      antti@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123708
      
      Reviewed by Sam Weinig.
      
      ChildNodeList is a poor fit to be a LiveNodeList. It is heavily special-cased. It is also
      the only subtype that returns non-Elements thus preventing tightening.
      
      * bindings/js/JSNodeListCustom.cpp:
      (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
              
          Support new types.
      
      * dom/ChildNodeList.cpp:
      (WebCore::EmptyNodeList::~EmptyNodeList):
      (WebCore::ChildNodeList::ChildNodeList):
      (WebCore::ChildNodeList::~ChildNodeList):
      (WebCore::ChildNodeList::length):
      (WebCore::childFromFirst):
      (WebCore::childFromLast):
      (WebCore::ChildNodeList::nodeBeforeCached):
      (WebCore::ChildNodeList::nodeAfterCached):
      (WebCore::ChildNodeList::item):
      (WebCore::ChildNodeList::namedItem):
      (WebCore::ChildNodeList::invalidateCache):
              
          Implement the same caching optimizations as LiveNodeList with tighter, less generic code.
      
      * dom/ChildNodeList.h:
              
          Inherit ChildNodeList directly from NodeList.
      
          Add new EmptyNodeList type. This is only ever used if NodeList is requested for a non-container node.
          It allows tighter typing in ChildNodeList.
      
      * dom/LiveNodeList.cpp:
      (WebCore::LiveNodeList::namedItem):
      * dom/LiveNodeList.h:
      (WebCore::LiveNodeListBase::LiveNodeListBase):
      (WebCore::LiveNodeListBase::~LiveNodeListBase):
      (WebCore::LiveNodeList::LiveNodeList):
              
          Remove ChildNodeList specific code and branches.
      
      * dom/Node.cpp:
      (WebCore::Node::childNodes):
              
          Return EmptyNodeList for non-containers.
      
      * dom/NodeList.h:
      (WebCore::NodeList::~NodeList):
      (WebCore::NodeList::isLiveNodeList):
      (WebCore::NodeList::isChildNodeList):
      (WebCore::NodeList::isEmptyNodeList):
              
          For isReachableFromOpaqueRoots.
      
      * dom/NodeRareData.h:
      (WebCore::NodeListsNodeData::ensureChildNodeList):
      (WebCore::NodeListsNodeData::removeChildNodeList):
      (WebCore::NodeListsNodeData::ensureEmptyChildNodeList):
      (WebCore::NodeListsNodeData::removeEmptyChildNodeList):
      (WebCore::NodeListsNodeData::NodeListsNodeData):
      (WebCore::NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList):
              
          EmptyNodeList support.
      
      * html/CollectionType.h:
      * html/HTMLCollection.cpp:
      (WebCore::shouldOnlyIncludeDirectChildren):
      (WebCore::rootTypeFromCollectionType):
      (WebCore::invalidationTypeExcludingIdAndNameAttributes):
      (WebCore::isMatchingElement):
      (WebCore::LiveNodeListBase::itemBefore):
      (WebCore::LiveNodeListBase::traverseLiveNodeListFirstElement):
      (WebCore::LiveNodeListBase::traverseLiveNodeListForwardToOffset):
      (WebCore::LiveNodeListBase::item):
      (WebCore::LiveNodeListBase::itemBeforeOrAfterCachedItem):
              
          Remove ChildNodeList specific code and branches.
      
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      d5743425
    • ap@apple.com's avatar
      Implement generateKey for HMAC and AES-CBC · c07a2c0d
      ap@apple.com authored
      https://bugs.webkit.org/show_bug.cgi?id=123669
      
      Reviewed by Dan Bernstein.
      
      Source/WebCore:
      
      Tests: crypto/subtle/aes-cbc-generate-key.html
             crypto/subtle/hmac-generate-key.html
      
      * WebCore.xcodeproj/project.pbxproj: Added new files.
      
      * bindings/js/JSCryptoAlgorithmDictionary.cpp:
      (WebCore::createAesKeyGenParams): Added bindings for AesKeyGenParams.
      (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Handle
      algorithms that generate AES and HMAC keys.
      
      * bindings/js/JSSubtleCryptoCustom.cpp: (WebCore::JSSubtleCrypto::generateKey): Added.
      
      * crypto/CryptoAlgorithmAesKeyGenParams.h: Added.
      
      * crypto/CryptoKey.cpp: (WebCore::CryptoKey::randomData):
      * crypto/CryptoKey.h:
      * crypto/CryptoKeyMac.cpp: Added
      Expose a function that produces random data for symmetric crypto keys. Cross-platform
      implementation uses ARC4 code from WTF, while Mac uses a system function that
      provides a FIPS validated random number generator.
      
      * crypto/CryptoKeyAES.cpp: (WebCore::CryptoKeyAES::generate):
      * crypto/CryptoKeyAES.h:
      Added a function that creates AES keys.
      
      * crypto/SubtleCrypto.idl: Added generateKey.
      
      * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
      (WebCore::CryptoAlgorithmAES_CBC::generateKey): Added.
      
      * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
      (WebCore::CryptoAlgorithmHMAC::generateKey): Added.
      
      * crypto/keys/CryptoKeyHMAC.cpp: (WebCore::CryptoKeyHMAC::generate):
      * crypto/keys/CryptoKeyHMAC.h:
      Added a function that creates HMAC keys.
      
      * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp: Removed generateKey stub, the implementation
      ended up in cross-platform file.
      
      * crypto/mac/CryptoAlgorithmHMACMac.cpp: Ditto.
      
      LayoutTests:
      
      * crypto/subtle/aes-cbc-generate-key-expected.txt: Added.
      * crypto/subtle/aes-cbc-generate-key.html: Added.
      * crypto/subtle/hmac-generate-key-expected.txt: Added.
      * crypto/subtle/hmac-generate-key.html: Added.
      
      * crypto/subtle/sha-1-expected.txt: Now that crypto.webkitSubtle.generateKey exists,
      a different exception is raised.
      
      
      git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
      c07a2c0d