Reviewed by Darin Adler.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 21:15:40 +0000 (21:15 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 21:15:40 +0000 (21:15 +0000)
        REGRESSION (WebKit2): keygen element doesn't work
        https://bugs.webkit.org/show_bug.cgi?id=56402
        <rdar://problem/9006545>

        Covered by existing regresison tests.

        * English.lproj/Localizable.strings:

        * WebCore.exp.in: Removed WebCoreKeyGenerator, which no longer exists. Added
        _wkSignedPublicKeyAndChallengeString, so that this WKSI function could be used in WebCore.

        * platform/mac/SSLKeyGeneratorMac.mm: Removed.
        * platform/mac/WebCoreKeyGenerator.h: Removed.
        * platform/mac/WebCoreKeyGenerator.m: Removed.
        * platform/mac/WebCoreSystemInterface.h:
        * platform/mac/WebCoreSystemInterface.mm:
        * WebCore.xcodeproj/project.pbxproj:
        Renamed SSLKeyGeneratorMac.mm to .cpp, as it doesn't use any Objective C any more.
        Removed WebCoreKeyGenerator, as we no longer need an interface to WebKit.

        * platform/LocalizationStrategy.h:
        * platform/LocalizedStrings.cpp:
        (WebCore::keygenMenuItem512):
        (WebCore::keygenMenuItem1024):
        (WebCore::keygenMenuItem2048):
        (WebCore::keygenKeychainItemName):
        * platform/LocalizedStrings.h:
        Added strings used by keygen element, now that the code using them is in WebCore.

        * platform/mac/SSLKeyGeneratorMac.cpp: Copied from Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm.
        (WebCore::getSupportedKeySizes):
        (WebCore::signedPublicKeyAndChallengeString):
        Moved the code from WebKit. There is never any need to provide implementation at runtime,
        like old code was doing.

        * platform/win/SSLKeyGeneratorWin.cpp: (WebCore::WebCore::getSupportedKeySizes):
        Added a FIXME about localization. Note that Safari for Windows doesn't support keygen.

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

31 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/Skipped
LayoutTests/platform/win-wk2/Skipped
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/LocalizationStrategy.h
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/platform/mac/SSLKeyGeneratorMac.cpp [new file with mode: 0644]
Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm [deleted file]
Source/WebCore/platform/mac/WebCoreKeyGenerator.h [deleted file]
Source/WebCore/platform/mac/WebCoreKeyGenerator.m [deleted file]
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.h
Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m [deleted file]
Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm [new file with mode: 0644]
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit/mac/WebView/WebFrameView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm

index 77ad8cd..99cc79a 100644 (file)
@@ -1,3 +1,15 @@
+2011-03-15  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): keygen element doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=56402
+        <rdar://problem/9006545>
+
+        * platform/mac-wk2/Skipped:
+        * platform/win-wk2/Skipped:
+        Moved tests that were skipped becasue of keygen to win-wk2/Skipped.
+
 2011-03-15  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Not reviewed.
index 7bd0f9b..3ee0040 100644 (file)
@@ -1912,11 +1912,6 @@ http/tests/loading/cross-origin-XHR-willLoadRequest.html
 fast/dom/Window/window-resize-and-move-arguments.html
 fast/dom/Window/window-resize.html
 
-# WebKit2 needs keygen support
-fast/html/keygen.html
-fast/invalid/residual-style.html
-html5lib/runner.html
-
 # WebKitTestRunner needs to sanitize file urls in the output
 http/tests/misc/image-blocked-src-change.html
 http/tests/misc/image-blocked-src-no-change.html
index bd95698..4acdc71 100644 (file)
@@ -155,3 +155,8 @@ fast/frames/iframe-plugin-load-remove-document-crash.html
 
 # Crashes http://webkit.org/b/55780
 platform/win/plugins/get-value-netscape-window.html
+
+# No keygen support
+fast/html/keygen.html
+fast/invalid/residual-style.html
+html5lib/runner.html
index a732efa..07d50ae 100644 (file)
@@ -1,3 +1,45 @@
+2011-03-15  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): keygen element doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=56402
+        <rdar://problem/9006545>
+
+        Covered by existing regresison tests.
+
+        * English.lproj/Localizable.strings:
+
+        * WebCore.exp.in: Removed WebCoreKeyGenerator, which no longer exists. Added
+        _wkSignedPublicKeyAndChallengeString, so that this WKSI function could be used in WebCore.
+
+        * platform/mac/SSLKeyGeneratorMac.mm: Removed.
+        * platform/mac/WebCoreKeyGenerator.h: Removed.
+        * platform/mac/WebCoreKeyGenerator.m: Removed.
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+        * WebCore.xcodeproj/project.pbxproj:
+        Renamed SSLKeyGeneratorMac.mm to .cpp, as it doesn't use any Objective C any more.
+        Removed WebCoreKeyGenerator, as we no longer need an interface to WebKit.
+
+        * platform/LocalizationStrategy.h:
+        * platform/LocalizedStrings.cpp:
+        (WebCore::keygenMenuItem512):
+        (WebCore::keygenMenuItem1024):
+        (WebCore::keygenMenuItem2048):
+        (WebCore::keygenKeychainItemName):
+        * platform/LocalizedStrings.h:
+        Added strings used by keygen element, now that the code using them is in WebCore.
+
+        * platform/mac/SSLKeyGeneratorMac.cpp: Copied from Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm.
+        (WebCore::getSupportedKeySizes):
+        (WebCore::signedPublicKeyAndChallengeString):
+        Moved the code from WebKit. There is never any need to provide implementation at runtime,
+        like old code was doing.
+
+        * platform/win/SSLKeyGeneratorWin.cpp: (WebCore::WebCore::getSupportedKeySizes):
+        Added a FIXME about localization. Note that Safari for Windows doesn't support keygen.
+
 2011-03-15  Anders Carlsson  <andersca@apple.com>
 
         Fix clang build.
index 2019d1d..5bf8005 100644 (file)
Binary files a/Source/WebCore/English.lproj/Localizable.strings and b/Source/WebCore/English.lproj/Localizable.strings differ
index a69598e..b66f254 100644 (file)
 .objc_class_name_DOMTreeWalker
 .objc_class_name_DOMUIEvent
 .objc_class_name_DOMWheelEvent
-.objc_class_name_WebCoreKeyGenerator
 .objc_class_name_WebCoreViewFactory
 .objc_class_name_WebFontCache
 .objc_class_name_WebScriptObject
@@ -1355,6 +1354,7 @@ _wkSetUpFontCache
 _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
 _wkSignalCFReadStreamHasBytes
+_wkSignedPublicKeyAndChallengeString
 
 #if ENABLE(DOM_STORAGE)
 __ZN7WebCore14StorageTracker17initializeTrackerERKN3WTF6StringE
index e26d783..bc8898c 100644 (file)
                93F199B808245E59001E9ABC /* Scrollbar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B2AF80450824100A8000F /* Scrollbar.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */ = {isa = PBXBuildFile; fileRef = BE983D95052A2E0A00892D85 /* WebCoreKeyboardUIMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199BE08245E59001E9ABC /* BlockExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 65A640F00533BB1F0085E777 /* BlockExceptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199DE08245E59001E9ABC /* Position.h in Headers */ = {isa = PBXBuildFile; fileRef = BE91FC8B06133666005E3790 /* Position.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F6A3D60663BF04004D2919 /* HTMLCanvasElement.h */; };
                93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D90660B0665D937006B6F1A /* ClipboardMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93F19ABC08245E59001E9ABC /* XMLDocumentParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* XMLDocumentParser.cpp */; };
                93F19AD508245E59001E9ABC /* RenderTreeAsText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93955A4203D72932008635CE /* RenderTreeAsText.cpp */; };
                93F19AE108245E59001E9ABC /* BlockExceptions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65F80697054D9F86008BF776 /* BlockExceptions.mm */; };
-               93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */; };
-               93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */; };
+               93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.cpp */; };
                93F19AF808245E59001E9ABC /* Position.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE91FC8C06133666005E3790 /* Position.cpp */; };
                93F19AFD08245E59001E9ABC /* HTMLCanvasElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F6A3D50663BF04004D2919 /* HTMLCanvasElement.cpp */; };
                93F19AFF08245E59001E9ABC /* ClipboardMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D90660C0665D937006B6F1A /* ClipboardMac.mm */; };
                84A81F3C0FC7DFF000955300 /* SourceAlpha.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SourceAlpha.h; path = filters/SourceAlpha.h; sourceTree = "<group>"; };
                84A81F3F0FC7E02700955300 /* SourceGraphic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourceGraphic.cpp; path = filters/SourceGraphic.cpp; sourceTree = "<group>"; };
                84A81F400FC7E02700955300 /* SourceGraphic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SourceGraphic.h; path = filters/SourceGraphic.h; sourceTree = "<group>"; };
-               84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreKeyGenerator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SSLKeyGeneratorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SSLKeyGeneratorMac.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                84B6B975120F13E500B8EFAF /* SVGPathSegListSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathSegListSource.cpp; sourceTree = "<group>"; };
                84B6B976120F13E500B8EFAF /* SVGPathSegListSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegListSource.h; sourceTree = "<group>"; };
                84C5B2F81216DC810088B53A /* SVGPathTraversalStateBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathTraversalStateBuilder.cpp; sourceTree = "<group>"; };
                                93309E9F099EB78C0056E581 /* SharedTimerMac.mm */,
                                0A4844980CA44CB200B7BD48 /* SoftLinking.h */,
                                4B3043C80AE0371D00A82647 /* SoundMac.mm */,
-                               84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */,
+                               84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.cpp */,
                                93B2D8170F9920EE006AE6B2 /* SuddenTermination.mm */,
                                6582A15509999D6D00BEEB6D /* SystemTimeMac.cpp */,
                                BCE659E50EA92FB2007E4533 /* ThemeMac.h */,
                                BCE659E80EA92FFA007E4533 /* ThemeMac.mm */,
                                51DF6D7F0B92A18E00C2DC85 /* ThreadCheck.mm */,
-                               84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */,
-                               84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */,
                                934D9BA60B8C1175007B42A9 /* WebCoreNSStringExtras.h */,
                                934D9BA40B8C116B007B42A9 /* WebCoreNSStringExtras.mm */,
                                DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */,
                                93F199A808245E59001E9ABC /* WebCoreFrameView.h in Headers */,
                                BC53D911114310CC000D817E /* WebCoreJSClientData.h in Headers */,
                                93F199BB08245E59001E9ABC /* WebCoreKeyboardUIMode.h in Headers */,
-                               93F199C208245E59001E9ABC /* WebCoreKeyGenerator.h in Headers */,
                                934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */,
                                DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */,
                                EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */,
                                B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */,
                                B523CF091182675400EBB29C /* SQLTransactionSync.cpp in Sources */,
                                1A2E6E590CC55213004A2062 /* SQLValue.cpp in Sources */,
-                               93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.mm in Sources */,
+                               93F19AE608245E59001E9ABC /* SSLKeyGeneratorMac.cpp in Sources */,
                                CEA3949C11D45CDA003094CF /* StaticHashSetNodeList.cpp in Sources */,
                                BC7FA62E0D1F0EFF00DB22A9 /* StaticNodeList.cpp in Sources */,
                                A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */,
                                93309E1D099E64920056E581 /* visible_units.cpp in Sources */,
                                93309E1F099E64920056E581 /* VisiblePosition.cpp in Sources */,
                                A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
-                               93F19AE508245E59001E9ABC /* WebCoreKeyGenerator.m in Sources */,
                                934D9BA50B8C116B007B42A9 /* WebCoreNSStringExtras.mm in Sources */,
                                B50F5B810E96CD9900AD71A6 /* WebCoreObjCExtras.mm in Sources */,
                                93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */,
index eba0e7c..2c38c92 100644 (file)
@@ -167,6 +167,13 @@ public:
     virtual String allFilesText() = 0;
 #endif
 
+#if PLATFORM(MAC)
+    virtual String keygenMenuItem512() = 0;
+    virtual String keygenMenuItem1024() = 0;
+    virtual String keygenMenuItem2048() = 0;
+    virtual String keygenKeychainItemName(const String& host) = 0;
+#endif
+
     virtual String imageTitle(const String& filename, const IntSize& size) = 0;
 
     virtual String mediaElementLoadingStateText() = 0;
index 9656dbe..96383eb 100644 (file)
@@ -569,6 +569,29 @@ String allFilesText()
 }
 #endif
 
+#if PLATFORM(MAC)
+String keygenMenuItem512()
+{
+    return platformStrategies()->localizationStrategy()->keygenMenuItem512();
+}
+
+String keygenMenuItem1024()
+{
+    return platformStrategies()->localizationStrategy()->keygenMenuItem1024();
+}
+
+String keygenMenuItem2048()
+{
+    return platformStrategies()->localizationStrategy()->keygenMenuItem2048();
+}
+
+String keygenKeychainItemName(const String& host)
+{
+    return platformStrategies()->localizationStrategy()->keygenKeychainItemName(host);
+}
+
+#endif
+
 String imageTitle(const String& filename, const IntSize& size)
 {
     return platformStrategies()->localizationStrategy()->imageTitle(filename, size);
index f22c975..25f76a4 100644 (file)
@@ -163,6 +163,13 @@ namespace WebCore {
     String allFilesText();
 #endif
 
+#if PLATFORM(MAC)
+    String keygenMenuItem512();
+    String keygenMenuItem1024();
+    String keygenMenuItem2048();
+    String keygenKeychainItemName(const String& host);
+#endif
+
     String imageTitle(const String& filename, const IntSize& size);
 
     String mediaElementLoadingStateText();
diff --git a/Source/WebCore/platform/mac/SSLKeyGeneratorMac.cpp b/Source/WebCore/platform/mac/SSLKeyGeneratorMac.cpp
new file mode 100644 (file)
index 0000000..0a1a4d8
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2003, 2005, 2008, 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SSLKeyGenerator.h"
+
+#include "KURL.h"
+#include "LocalizedStrings.h"
+#include "WebCoreSystemInterface.h"
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+void getSupportedKeySizes(Vector<String>& supportedKeySizes)
+{
+    ASSERT(supportedKeySizes.isEmpty());
+    supportedKeySizes.append(keygenMenuItem2048());
+    supportedKeySizes.append(keygenMenuItem1024());
+    supportedKeySizes.append(keygenMenuItem512());
+}
+
+String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL& url)
+{   
+    // This switch statement must always be synced with the UI strings returned by getSupportedKeySizes.
+    UInt32 keySize;
+    switch (keySizeIndex) {
+    case 0:
+        keySize = 2048;
+        break;
+    case 1:
+        keySize = 1024;
+        break;
+    case 2:
+        keySize = 512;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        return String();
+    }
+
+    RetainPtr<CFStringRef> challengeStringCF(AdoptCF, challengeString.createCFString());
+    RetainPtr<CFStringRef> keyDescription(AdoptCF, keygenKeychainItemName(url.host()).createCFString());
+    RetainPtr<CFStringRef> result(AdoptCF, wkSignedPublicKeyAndChallengeString(keySize, challengeStringCF.get(), keyDescription.get()));
+
+    return result.get();
+}
+
+}
diff --git a/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm b/Source/WebCore/platform/mac/SSLKeyGeneratorMac.mm
deleted file mode 100644 (file)
index dd76b59..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import "config.h"
-#import "SSLKeyGenerator.h"
-
-#import "KURL.h"
-#import "WebCoreKeyGenerator.h"
-
-namespace WebCore {
-
-void getSupportedKeySizes(Vector<String>& supportedKeySizes)
-{ 
-    NSEnumerator *enumerator = [[[WebCoreKeyGenerator sharedGenerator] strengthMenuItemTitles] objectEnumerator];
-    NSString *string;
-    while ((string = [enumerator nextObject]) != nil)
-        supportedKeySizes.append(string);
-}
-
-String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL& url)
-{   
-    return [[WebCoreKeyGenerator sharedGenerator] signedPublicKeyAndChallengeStringWithStrengthIndex:keySizeIndex 
-                                                                                           challenge:challengeString
-                                                                                             pageURL:url];
-}
-
-}
diff --git a/Source/WebCore/platform/mac/WebCoreKeyGenerator.h b/Source/WebCore/platform/mac/WebCoreKeyGenerator.h
deleted file mode 100644 (file)
index c9260e1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-@interface WebCoreKeyGenerator : NSObject
-
-+ (WebCoreKeyGenerator *)sharedGenerator;
-- (NSArray *)strengthMenuItemTitles;
-- (NSString *)signedPublicKeyAndChallengeStringWithStrengthIndex:(unsigned)index challenge:(NSString *)challenge pageURL:(NSURL *)pageURL;
-
-@end
diff --git a/Source/WebCore/platform/mac/WebCoreKeyGenerator.m b/Source/WebCore/platform/mac/WebCoreKeyGenerator.m
deleted file mode 100644 (file)
index a1e780c..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2003 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import "config.h"
-#import "WebCoreKeyGenerator.h"
-
-#import <wtf/Assertions.h>
-#import <wtf/UnusedParam.h>
-
-static WebCoreKeyGenerator *sharedGenerator;
-
-@implementation WebCoreKeyGenerator
-
-+ (WebCoreKeyGenerator *)sharedGenerator
-{
-    return sharedGenerator;
-}
-
-- init
-{
-    ASSERT(!sharedGenerator);
-    [super init];
-    sharedGenerator = [self retain];
-    return self;
-}
-
-- (NSArray *)strengthMenuItemTitles
-{
-    return nil;
-}
-
-- (NSString *)signedPublicKeyAndChallengeStringWithStrengthIndex:(unsigned)unusedIndex challenge:(NSString *)unusedChallenge pageURL:(NSURL *)unusedPageURL
-{
-    UNUSED_PARAM(unusedIndex);
-    UNUSED_PARAM(unusedChallenge);
-    UNUSED_PARAM(unusedPageURL);
-
-    return nil;
-}
-
-@end
index e60466f..308a551 100644 (file)
@@ -117,6 +117,7 @@ extern BOOL (*wkGetGlyphTransformedAdvances)(CGFontRef, NSFont*, CGAffineTransfo
 extern void (*wkDrawMediaSliderTrack)(int themeStyle, CGContextRef context, CGRect rect, float timeLoaded, float currentTime, 
     float duration, unsigned state);
 extern void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect rect, unsigned state);
+extern CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
 extern NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
 extern NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
 extern NSString* (*wkGetMIMETypeForExtension)(NSString*);
index 4220aa1..ab059bd 100644 (file)
@@ -48,6 +48,7 @@ void (*wkDrawMediaUIPart)(int part, int themeStyle, CGContextRef context, CGRect
 void (*wkMeasureMediaUIPart)(int part, int themeStyle, CGRect *bounds, CGSize *naturalSize);
 BOOL (*wkMediaControllerThemeAvailable)(int themeStyle);
 NSString* (*wkGetPreferredExtensionForMIMEType)(NSString*);
+CFStringRef (*wkSignedPublicKeyAndChallengeString)(unsigned keySize, CFStringRef challenge, CFStringRef keyDescription);
 NSArray* (*wkGetExtensionsForMIMEType)(NSString*);
 NSString* (*wkGetMIMETypeForExtension)(NSString*);
 NSTimeInterval (*wkGetNSURLResponseCalculatedExpiration)(NSURLResponse *response);
index 50aee8e..b10961b 100644 (file)
@@ -30,6 +30,7 @@ namespace WebCore {
 
 void WebCore::getSupportedKeySizes(Vector<String>& v)
 {
+    // FIXME: Strings should be localizable.
     v.append("High Grade");
     v.append("Medium Grade");
 }
index c5f0cef..b1a2ce8 100644 (file)
@@ -1,3 +1,13 @@
+2011-03-15  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): keygen element doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=56402
+        <rdar://problem/9006545>
+
+        * WebKit.xcodeproj/project.pbxproj: Renamed WebKeyGenerator.m to use Objective C++.
+
 2011-03-11  Anton D'Auria  <adauria@apple.com>
 
         Reviewed and landed by Brady Eidson.
index d10820f..20c156f 100644 (file)
                939811130824BF01008DF038 /* WebHistory.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65DA2608052CC18700A97B31 /* WebHistory.mm */; };
                939811150824BF01008DF038 /* WebNSDataExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = BECD142A0565830A005BB09C /* WebNSDataExtras.m */; };
                939811160824BF01008DF038 /* WebNSEventExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = BE887C00056D3A6E009BB3E7 /* WebNSEventExtras.m */; };
-               939811170824BF01008DF038 /* WebKeyGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 84723BE4056D719E0044BFEA /* WebKeyGenerator.m */; };
+               939811170824BF01008DF038 /* WebKeyGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84723BE4056D719E0044BFEA /* WebKeyGenerator.mm */; };
                939811190824BF01008DF038 /* WebNSPrintOperationExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = EDD1A5C705C83987008E3150 /* WebNSPrintOperationExtras.m */; };
                9398111A0824BF01008DF038 /* WebResource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 84311A1305EAAAF00088EDA4 /* WebResource.mm */; };
                9398111B0824BF01008DF038 /* WebDefaultEditingDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BE95BEE505FD0805006E1513 /* WebDefaultEditingDelegate.m */; };
                8467275C0367158500CA2ACA /* WebPluginController.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginController.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                8467275D0367158500CA2ACA /* WebPluginController.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPluginController.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                84723BE3056D719E0044BFEA /* WebKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               84723BE4056D719E0044BFEA /* WebKeyGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebKeyGenerator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               84723BE4056D719E0044BFEA /* WebKeyGenerator.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKeyGenerator.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                848DFF840365FE6A00CA2ACA /* WebPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPlugin.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                848DFF850365FE6A00CA2ACA /* WebPluginContainer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginContainer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                848DFF860365FE6A00CA2ACA /* WebPluginViewFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginViewFactory.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                                9345D4EA0365C5B2008635CE /* WebJavaScriptTextInputPanel.h */,
                                9345D4EB0365C5B2008635CE /* WebJavaScriptTextInputPanel.m */,
                                84723BE3056D719E0044BFEA /* WebKeyGenerator.h */,
-                               84723BE4056D719E0044BFEA /* WebKeyGenerator.m */,
+                               84723BE4056D719E0044BFEA /* WebKeyGenerator.mm */,
                                1AA879B411CBE9BF003C664F /* WebPlatformStrategies.h */,
                                1AA879B511CBE9BF003C664F /* WebPlatformStrategies.mm */,
                                0A2D87FB107AF52B00CDDEE3 /* WebPluginHalterClient.h */,
                                1C7B0C660EB2464D00A28502 /* WebInspectorClientCF.cpp in Sources */,
                                939810E40824BF01008DF038 /* WebJavaScriptTextInputPanel.m in Sources */,
                                37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */,
-                               939811170824BF01008DF038 /* WebKeyGenerator.m in Sources */,
+                               939811170824BF01008DF038 /* WebKeyGenerator.mm in Sources */,
                                939811030824BF01008DF038 /* WebKitErrors.m in Sources */,
                                939810C30824BF01008DF038 /* WebKitLogging.m in Sources */,
                                939810C40824BF01008DF038 /* WebKitNSStringExtras.mm in Sources */,
index 7e7fbb3..c413284 100644 (file)
@@ -1,3 +1,33 @@
+2011-03-15  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): keygen element doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=56402
+        <rdar://problem/9006545>
+
+        * WebCoreSupport/WebKeyGenerator.h:
+        * WebCoreSupport/WebKeyGenerator.m: Removed.
+        * WebCoreSupport/WebKeyGenerator.mm: Copied from Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m.
+        (+[WebKeyGenerator sharedGenerator]):
+        (toWebCertificateParseResult):
+        WebCore no longer needs WebKeyGenerator. Safari still does need a part of it, so keeping
+        this misnamed and misplaced code for now.
+
+        * WebCoreSupport/WebPlatformStrategies.h:
+        * WebCoreSupport/WebPlatformStrategies.mm:
+        (WebPlatformStrategies::keygenMenuItem512):
+        (WebPlatformStrategies::keygenMenuItem1024):
+        (WebPlatformStrategies::keygenMenuItem2048):
+        (WebPlatformStrategies::keygenKeychainItemName):
+        Added strings used by keygen.
+
+        * WebCoreSupport/WebSystemInterface.mm: (InitWebCoreSystemInterface): Initialize a WebCore
+        pointer to a function used by keygen.
+
+        * WebView/WebFrameView.mm: (-[WebFrameView initWithFrame:]): WebKeyGenerator can be lazily
+        initialized now.
+
 2011-03-15  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Simon Fraser.
index ed2ff77..7728699 100644 (file)
@@ -1,29 +1,26 @@
 /*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2005, 2011 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
  *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 typedef enum {
@@ -34,14 +31,11 @@ typedef enum {
 
 #ifdef __OBJC__
 
-#import <WebCore/WebCoreKeyGenerator.h>
+@interface WebKeyGenerator : NSObject
 
-@interface WebKeyGenerator : WebCoreKeyGenerator
-{
-    NSArray *strengthMenuItemTitles;
-}
-+ (void)createSharedGenerator;
++ (WebKeyGenerator *)sharedGenerator;
 - (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data;
+
 @end
 
 #endif
diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.m
deleted file mode 100644 (file)
index ea1526f..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <WebKit/WebKeyGenerator.h>
-
-#import "WebLocalizableStringsInternal.h"
-#import <WebKitSystemInterface.h>
-#import <wtf/Assertions.h>
-
-@implementation WebKeyGenerator
-
-+ (void)createSharedGenerator
-{
-    if (![self sharedGenerator]) {
-        [[[self alloc] init] release];
-    }
-    ASSERT([[self sharedGenerator] isKindOfClass:self]);
-}
-
-- (void)dealloc
-{
-    [strengthMenuItemTitles release];
-    [super dealloc];
-}
-
-- (NSArray *)strengthMenuItemTitles
-{
-    if (!strengthMenuItemTitles) {
-        strengthMenuItemTitles = [[NSArray alloc] initWithObjects:
-            UI_STRING_INTERNAL("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu"),
-            UI_STRING_INTERNAL("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu"),
-            UI_STRING_INTERNAL("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu"), nil];
-    }
-    return strengthMenuItemTitles;
-}
-
-- (NSString *)signedPublicKeyAndChallengeStringWithStrengthIndex:(unsigned)index challenge:(NSString *)challenge pageURL:(NSURL *)pageURL
-{    
-    // This switch statement must always be synced with the UI strings returned by strengthMenuItemTitles.
-    UInt32 keySize;
-    switch (index) {
-        case 0:
-            keySize = 2048;
-            break;
-        case 1:
-            keySize = 1024;
-            break;
-        case 2:
-            keySize = 512;
-            break;
-        default:
-            return nil;
-    }
-    
-    NSString *keyDescription = [NSString stringWithFormat:UI_STRING_INTERNAL("Key from %@", "name of keychain key generated by the KEYGEN tag"), [pageURL host]];
-    return [(NSString *)WKSignedPublicKeyAndChallengeString(keySize, (CFStringRef)challenge, (CFStringRef)keyDescription) autorelease];
-}
-
-static inline WebCertificateParseResult toWebCertificateParseResult(WKCertificateParseResult result)
-{
-    switch (result) {
-    case WKCertificateParseResultSucceeded:
-        return WebCertificateParseResultSucceeded;
-    case WKCertificateParseResultFailed:
-        return WebCertificateParseResultFailed;
-    case WKCertificateParseResultPKCS7:
-        return WebCertificateParseResultPKCS7;
-    }
-
-    ASSERT_NOT_REACHED();
-    return WebCertificateParseResultFailed;
-}
-
-- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data
-{
-    return toWebCertificateParseResult(WKAddCertificatesToKeychainFromData([data bytes], [data length]));
-}
-
-@end
diff --git a/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm b/Source/WebKit/mac/WebCoreSupport/WebKeyGenerator.mm
new file mode 100644 (file)
index 0000000..18200d4
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005, 2011 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WebKeyGenerator.h>
+
+#import <WebKitSystemInterface.h>
+#import <wtf/Assertions.h>
+
+@implementation WebKeyGenerator
+
++ (WebKeyGenerator *)sharedGenerator
+{
+    static WebKeyGenerator *sharedGenerator = [[WebKeyGenerator alloc] init];
+    return sharedGenerator;
+}
+
+static inline WebCertificateParseResult toWebCertificateParseResult(WKCertificateParseResult result)
+{
+    // FIXME: WebKeyGenerator is not used in WebKit, and this code should be moved to Safari.
+
+    switch (result) {
+    case WKCertificateParseResultSucceeded:
+        return WebCertificateParseResultSucceeded;
+    case WKCertificateParseResultFailed:
+        return WebCertificateParseResultFailed;
+    case WKCertificateParseResultPKCS7:
+        return WebCertificateParseResultPKCS7;
+    }
+
+    ASSERT_NOT_REACHED();
+    return WebCertificateParseResultFailed;
+}
+
+- (WebCertificateParseResult)addCertificatesToKeychainFromData:(NSData *)data
+{
+    return toWebCertificateParseResult(WKAddCertificatesToKeychainFromData([data bytes], [data length]));
+}
+
+@end
index 30cadcf..059d113 100644 (file)
@@ -153,6 +153,10 @@ private:
     virtual WTF::String crashedPluginText();
     virtual WTF::String multipleFileUploadText(unsigned numberOfFiles);
     virtual WTF::String unknownFileSizeText();
+    virtual WTF::String keygenMenuItem512();
+    virtual WTF::String keygenMenuItem1024();
+    virtual WTF::String keygenMenuItem2048();
+    virtual WTF::String keygenKeychainItemName(const WTF::String& host);
     virtual WTF::String imageTitle(const WTF::String& filename, const WebCore::IntSize& size);
     virtual WTF::String mediaElementLoadingStateText();
     virtual WTF::String mediaElementLiveBroadcastStateText();
index 94fc572..d6317d6 100644 (file)
@@ -666,6 +666,26 @@ String WebPlatformStrategies::unknownFileSizeText()
     return UI_STRING_INTERNAL("Unknown", "Unknown filesize FTP directory listing item");
 }
 
+String WebPlatformStrategies::keygenMenuItem512()
+{
+    return UI_STRING_INTERNAL("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenMenuItem1024()
+{
+    return UI_STRING_INTERNAL("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenMenuItem2048()
+{
+    return UI_STRING_INTERNAL("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenKeychainItemName(const WTF::String& host)
+{
+    return [NSString stringWithFormat:UI_STRING_INTERNAL("Key from %@", "Name of keychain key generated by the KEYGEN tag"), (NSString *)host];
+}
+
 String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size)
 {
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
index 6501586..1b212a7 100644 (file)
@@ -63,6 +63,7 @@ void InitWebCoreSystemInterface(void)
     INIT(GetHTTPPipeliningPriority);
     INIT(GetMIMETypeForExtension);
     INIT(GetNSURLResponseLastModifiedDate);
+    INIT(SignedPublicKeyAndChallengeString);
     INIT(GetPreferredExtensionForMIMEType);
     INIT(GetWheelEventDeltas);
     INIT(HitTestMediaUIPart);
index 801c1f4..c42738c 100644 (file)
@@ -308,7 +308,6 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
         WebCore::notifyHistoryItemChanged = WKNotifyHistoryItemChanged;
 
         [WebViewFactory createSharedFactory];
-        [WebKeyGenerator createSharedGenerator];
 
 // FIXME: Remove the NSAppKitVersionNumberWithDeferredWindowDisplaySupport check once
 // once AppKit's Deferred Window Display support is available.
index af4cac5..e17601a 100644 (file)
@@ -1,3 +1,18 @@
+2011-03-15  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): keygen element doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=56402
+        <rdar://problem/9006545>
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+        Added strings used by keygen.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: Initialize a WebCore pointer to
+        a function used by keygen.
+
 2011-03-15  Beth Dakin  <bdakin@apple.com>
 
         Reviewed by Simon Fraser.
index 7e14701..900631f 100644 (file)
@@ -771,6 +771,30 @@ String WebPlatformStrategies::allFilesText()
 
 #endif
 
+#if PLATFORM(MAC)
+
+String WebPlatformStrategies::keygenMenuItem512()
+{
+    return UI_STRING("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenMenuItem1024()
+{
+    return UI_STRING("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenMenuItem2048()
+{
+    return UI_STRING("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu");
+}
+
+String WebPlatformStrategies::keygenKeychainItemName(const WTF::String& host)
+{
+    return UI_STRING("Key from <hostname>", "Name of keychain key generated by the KEYGEN tag").replace("<hostname>", host);
+}
+
+#endif
+
 String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size)
 {
     // FIXME: This should format the numbers correctly. In Mac WebKit, we used +[NSNumberFormatter localizedStringFromNumber:numberStyle:].
index 92f8236..d0c3b46 100644 (file)
@@ -178,6 +178,12 @@ private:
     virtual String uploadFileText();
     virtual String allFilesText();
 #endif
+#if PLATFORM(MAC)
+    virtual String keygenMenuItem512();
+    virtual String keygenMenuItem1024();
+    virtual String keygenMenuItem2048();
+    virtual String keygenKeychainItemName(const String& host);
+#endif
     virtual String imageTitle(const String& filename, const WebCore::IntSize& size);
     virtual String mediaElementLoadingStateText();
     virtual String mediaElementLiveBroadcastStateText();
index d8c94da..06faa2f 100644 (file)
@@ -59,6 +59,7 @@ void InitWebCoreSystemInterface(void)
         INIT(GetHTTPPipeliningPriority);
         INIT(GetMIMETypeForExtension);
         INIT(GetNSURLResponseLastModifiedDate);
+        INIT(SignedPublicKeyAndChallengeString);
         INIT(GetPreferredExtensionForMIMEType);
         INIT(GetUserToBaseCTM);
         INIT(GetWheelEventDeltas);