2009-09-28 Fumitoshi Ukai <ukai@chromium.org>
authorukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2009 07:02:18 +0000 (07:02 +0000)
committerukai@chromium.org <ukai@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2009 07:02:18 +0000 (07:02 +0000)
        Reviewed by Eric Seidel.

        Add experimentalWebSocketsEnabled in Settings.
        https://bugs.webkit.org/show_bug.cgi?id=28941

        * WebCore.base.exp:
        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::JSDOMWindow::webSocket):
        * bindings/v8/V8DOMWrapper.cpp:
        (WebCore::V8DOMWrapper::getConstructor):
        * bindings/v8/custom/V8WebSocketCustom.cpp:
        * page/Settings.cpp:
        (WebCore::Settings::Settings):
        (WebCore::Settings::setExperimentalWebSocketsEnabled):
        * page/Settings.h:
        (WebCore::Settings::experimentalWebSocketsEnabled):

2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>

        Reviewed by Eric Seidel.

        Add experimentalWebSocketsEnabled in WebPreferences.
        https://bugs.webkit.org/show_bug.cgi?id=28941

        * WebView/WebPreferenceKeysPrivate.h:
        * WebView/WebPreferences.mm:
        (+[WebPreferences initialize]):
        (-[WebPreferences experimentalWebSocketsEnabled]):
        (-[WebPreferences setExperimentalWebSocketsEnabled:]):
        * WebView/WebPreferencesPrivate.h:
        * WebView/WebView.mm:
        (-[WebView _preferencesChangedNotification:]):

2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>

        Reviewed by Eric Seidel.

        Add experimentalWebSocketsEnabled in WebPreferences.
        https://bugs.webkit.org/show_bug.cgi?id=28941

        * Interfaces/IWebPreferencesPrivate.idl:
        * WebPreferenceKeysPrivate.h:
        * WebPreferences.cpp:
        (WebPreferences::initializeDefaultSettings):
        (WebPreferences::setExperimentalWebSocketsEnabled):
        (WebPreferences::experimentalWebSocketsEnabled):
        * WebPreferences.h:
        * WebView.cpp:
        (WebView::notifyPreferencesChanged):
        (core):

2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>

        Reviewed by Eric Seidel.

        Add experimentalWebSocketsEnabled in WebPreferences.
        https://bugs.webkit.org/show_bug.cgi?id=28941

        * DumpRenderTree/mac/DumpRenderTree.mm:
        (resetDefaultsToConsistentValues):
        * DumpRenderTree/win/DumpRenderTree.cpp:
        (resetDefaultsToConsistentValues):

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

21 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/v8/V8DOMWrapper.cpp
WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
WebCore/page/Settings.cpp
WebCore/page/Settings.h
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebPreferenceKeysPrivate.h
WebKit/mac/WebView/WebPreferences.mm
WebKit/mac/WebView/WebPreferencesPrivate.h
WebKit/mac/WebView/WebView.mm
WebKit/win/ChangeLog
WebKit/win/Interfaces/IWebPreferencesPrivate.idl
WebKit/win/WebPreferenceKeysPrivate.h
WebKit/win/WebPreferences.cpp
WebKit/win/WebPreferences.h
WebKit/win/WebView.cpp
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp

index 5a7e8f9..aa6c183 100644 (file)
@@ -1,3 +1,22 @@
+2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add experimentalWebSocketsEnabled in Settings.
+        https://bugs.webkit.org/show_bug.cgi?id=28941
+
+        * WebCore.base.exp:
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::webSocket):
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::getConstructor):
+        * bindings/v8/custom/V8WebSocketCustom.cpp:
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::setExperimentalWebSocketsEnabled):
+        * page/Settings.h:
+        (WebCore::Settings::experimentalWebSocketsEnabled):
+        
 2009-09-11  Fumitoshi Ukai  <ukai@chromium.org>
 
         Reviewed by Adam Barth.
index a229b06..7542741 100644 (file)
@@ -645,6 +645,7 @@ __ZN7WebCore8Settings29setWebArchiveDebugModeEnabledEb
 __ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
 __ZN7WebCore8Settings32setAcceleratedCompositingEnabledEb
 __ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
+__ZN7WebCore8Settings32setExperimentalWebSocketsEnabledEb
 __ZN7WebCore8Settings33setDownloadableBinaryFontsEnabledEb
 __ZN7WebCore8Settings33setEnforceCSSMIMETypeInStrictModeEb
 __ZN7WebCore8Settings34setLocalFileContentSniffingEnabledEb
index 08c7144..0e94ad7 100644 (file)
@@ -720,6 +720,14 @@ JSValue JSDOMWindow::sharedWorker(ExecState* exec) const
 #if ENABLE(WEB_SOCKETS)
 JSValue JSDOMWindow::webSocket(ExecState* exec) const
 {
+    Frame* frame = impl()->frame();
+    if (!frame)
+        return jsUndefined();
+    Settings* settings = frame->settings();
+    if (!settings)
+        return jsUndefined();
+    if (!settings->experimentalWebSocketsEnabled())
+        return jsUndefined();
     return getDOMConstructor<JSWebSocketConstructor>(exec, this);
 }
 #endif
index 10df85c..aea84c1 100644 (file)
@@ -579,6 +579,16 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     if (!frame)
         return v8::Local<v8::Function>();
 
+#if ENABLE(WEB_SOCKETS)
+    // Make typeof(window.WebSocket) == 'undefined' when
+    // experimentalWebSocketEnabled is false.
+    if (type == V8ClassIndex::WEBSOCKET) {
+        Settings* settings = frame->settings();
+        if (!settings || !settings->experimentalWebSocketsEnabled())
+            return v8::Local<v8::Function>();
+    }
+#endif
+
     v8::Handle<v8::Context> context = V8Proxy::context(frame);
     if (context.IsEmpty())
         return v8::Local<v8::Function>();
index baf6e0e..024419d 100644 (file)
@@ -35,6 +35,7 @@
 #include "WebSocket.h"
 
 #include "Frame.h"
+#include "Settings.h"
 #include "V8Binding.h"
 #include "V8ObjectEventListener.h"
 #include "V8Proxy.h"
index 708d595..65145f4 100644 (file)
@@ -117,6 +117,7 @@ Settings::Settings(Page* page)
     , m_acceleratedCompositingEnabled(true)
     , m_experimentalNotificationsEnabled(false)
     , m_pluginHalterEnabled(false)
+    , m_experimentalWebSocketsEnabled(false)
 {
     // A Frame may not have been created yet, so we initialize the AtomicString 
     // hash before trying to use it.
@@ -528,4 +529,11 @@ void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTime
 }
 #endif
 
+#if ENABLE(WEB_SOCKETS)
+void Settings::setExperimentalWebSocketsEnabled(bool enabled)
+{
+    m_experimentalWebSocketsEnabled = enabled;
+}
+#endif
+
 } // namespace WebCore
index b3daf19..2e6b4e6 100644 (file)
@@ -267,6 +267,11 @@ namespace WebCore {
         void setPluginAllowedRunTime(unsigned);
         unsigned pluginAllowedRunTime() const { return m_pluginAllowedRunTime; }
 
+#if ENABLE(WEB_SOCKETS)
+        void setExperimentalWebSocketsEnabled(bool);
+        bool experimentalWebSocketsEnabled() const { return m_experimentalWebSocketsEnabled; }
+#endif
+
     private:
         Page* m_page;
         
@@ -335,6 +340,10 @@ namespace WebCore {
         bool m_experimentalNotificationsEnabled : 1;
         bool m_pluginHalterEnabled : 1;
 
+#if ENABLE(WEB_SOCKETS)
+        bool m_experimentalWebSocketsEnabled : 1;
+#endif
+
 #if USE(SAFARI_THEME)
         static bool gShouldPaintNativeControls;
 #endif
index 38c074a..8de4587 100644 (file)
@@ -1,3 +1,19 @@
+2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add experimentalWebSocketsEnabled in WebPreferences.
+        https://bugs.webkit.org/show_bug.cgi?id=28941
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences experimentalWebSocketsEnabled]):
+        (-[WebPreferences setExperimentalWebSocketsEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChangedNotification:]):
+
 2009-09-28  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Anders Carlsson.
index 77bc7e8..f74a8d0 100644 (file)
@@ -56,6 +56,7 @@
 #define WebKitDatabasesEnabledPreferenceKey @"WebKitDatabasesEnabledPreferenceKey"
 #define WebKitLocalStorageEnabledPreferenceKey @"WebKitLocalStorageEnabledPreferenceKey"
 #define WebKitExperimentalNotificationsEnabledPreferenceKey @"WebKitExperimentalNotificationsEnabledPreferenceKey"
+#define WebKitExperimentalWebSocketsEnabledPreferenceKey @"WebKitExperimentalWebSocketsEnabledPreferenceKey"
 #define WebKitAllowAnimatedImagesPreferenceKey @"WebKitAllowAnimatedImagesPreferenceKey"
 #define WebKitAllowAnimatedImageLoopingPreferenceKey @"WebKitAllowAnimatedImageLoopingPreferenceKey"
 #define WebKitDisplayImagesKey @"WebKitDisplayImagesKey"
index 68bec54..d2e17ba 100644 (file)
@@ -321,6 +321,7 @@ static WebCacheModel cacheModelForMainBundle(void)
         [NSNumber numberWithBool:YES],  WebKitDatabasesEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitLocalStorageEnabledPreferenceKey,
         [NSNumber numberWithBool:NO],   WebKitExperimentalNotificationsEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO],   WebKitExperimentalWebSocketsEnabledPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitAllowAnimatedImagesPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitAllowAnimatedImageLoopingPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitDisplayImagesKey,
@@ -1022,6 +1023,16 @@ static WebCacheModel cacheModelForMainBundle(void)
     [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
 }
 
+- (BOOL)experimentalWebSocketsEnabled
+{
+    return [self _boolValueForKey:WebKitExperimentalWebSocketsEnabledPreferenceKey];
+}
+
+- (void)setExperimentalWebSocketsEnabled:(BOOL)experimentalWebSocketsEnabled
+{
+    [self _setBoolValue:experimentalWebSocketsEnabled forKey:WebKitExperimentalWebSocketsEnabledPreferenceKey];
+}
+
 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
 {
     LOG(Encoding, "requesting for %@\n", ident);
index 7a3e5bc..65f60ad 100644 (file)
@@ -110,6 +110,9 @@ extern NSString *WebPreferencesRemovedNotification;
 - (BOOL)experimentalNotificationsEnabled;
 - (void)setExperimentalNotificationsEnabled:(BOOL)notificationsEnabled;
 
+- (BOOL)experimentalWebSocketsEnabled;
+- (void)setExperimentalWebSocketsEnabled:(BOOL)websocketsEnabled;
+
 // zero means do AutoScale
 - (float)PDFScaleFactor;
 - (void)setPDFScaleFactor:(float)scale;
index 7d445eb..b1b4165 100644 (file)
@@ -1278,6 +1278,7 @@ static bool fastDocumentTeardownEnabled()
     settings->setDatabasesEnabled([preferences databasesEnabled]);
     settings->setLocalStorageEnabled([preferences localStorageEnabled]);
     settings->setExperimentalNotificationsEnabled([preferences experimentalNotificationsEnabled]);
+    settings->setExperimentalWebSocketsEnabled([preferences experimentalWebSocketsEnabled]);
     settings->setPrivateBrowsingEnabled([preferences privateBrowsingEnabled]);
     settings->setSansSerifFontFamily([preferences sansSerifFontFamily]);
     settings->setSerifFontFamily([preferences serifFontFamily]);
index 94db91e..f79330b 100644 (file)
@@ -1,3 +1,21 @@
+2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add experimentalWebSocketsEnabled in WebPreferences.
+        https://bugs.webkit.org/show_bug.cgi?id=28941
+
+        * Interfaces/IWebPreferencesPrivate.idl:
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::setExperimentalWebSocketsEnabled):
+        (WebPreferences::experimentalWebSocketsEnabled):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+        (core):
+
 2009-09-25  Darin Adler  <darin@apple.com>
 
         Reviewed by Steve Falkenburg.
index e26d042..d994211 100644 (file)
@@ -82,6 +82,9 @@ interface IWebPreferencesPrivate : IUnknown
     HRESULT experimentalNotificationsEnabled([out, retval] BOOL *enabled);
     HRESULT setExperimentalNotificationsEnabled([in] BOOL enabled);
 
+    HRESULT experimentalWebSocketsEnabled([out, retval] BOOL *enabled);
+    HRESULT setExperimentalWebSocketsEnabled([in] BOOL enabled);
+
     HRESULT setShouldUseHighResolutionTimers([in] BOOL useHighResolutionTimers);
     HRESULT shouldUseHighResolutionTimers([out, retval] BOOL* useHighResolutionTimers);
 
index 7171cf0..e0c2b6f 100644 (file)
@@ -54,6 +54,7 @@
 #define WebKitDatabasesEnabledPreferenceKey "WebKitDatabasesEnabled"
 #define WebKitLocalStorageEnabledPreferenceKey "WebKitLocalStorageEnabled"
 #define WebKitExperimentalNotificationsEnabledPreferenceKey "WebKitExperimentalNotificationsEnabled"
+#define WebKitExperimentalWebSocketsEnabledPreferenceKey "WebKitExperimentalWebSocketsEnabled"
 #define WebKitAllowAnimatedImagesPreferenceKey "WebKitAllowAnimatedImagesPreferenceKey"
 #define WebKitAllowAnimatedImageLoopingPreferenceKey "WebKitAllowAnimatedImageLoopingPreferenceKey"
 #define WebKitDisplayImagesKey "WebKitDisplayImagesKey"
index e1ba407..4f942a5 100644 (file)
@@ -213,6 +213,7 @@ void WebPreferences::initializeDefaultSettings()
     CFDictionaryAddValue(defaults, CFSTR(WebKitDatabasesEnabledPreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitLocalStorageEnabledPreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitExperimentalNotificationsEnabledPreferenceKey), kCFBooleanFalse);
+    CFDictionaryAddValue(defaults, CFSTR(WebKitExperimentalWebSocketsEnabledPreferenceKey), kCFBooleanFaluse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImagesPreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImageLoopingPreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitDisplayImagesKey), kCFBooleanTrue);
@@ -1311,6 +1312,18 @@ HRESULT STDMETHODCALLTYPE WebPreferences::experimentalNotificationsEnabled(BOOL*
     return S_OK;
 }
 
+HRESULT STDMETHODCALLTYPE WebPreferences::setExperimentalWebSocketsEnabled(BOOL enabled)
+{
+    setBoolValue(CFSTR(WebKitExperimentalWebSocketsEnabledPreferenceKey), enabled);
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::experimentalWebSocketsEnabled(BOOL* enabled)
+{
+    *enabled = boolValueForKey(CFSTR(WebKitExperimentalWebSocketsEnabledPreferenceKey));
+    return S_OK;
+}
+
 HRESULT WebPreferences::setZoomsTextOnly(BOOL zoomsTextOnly)
 {
     setBoolValue(CFSTR(WebKitZoomsTextOnlyPreferenceKey), zoomsTextOnly);
index b534277..14035d0 100644 (file)
@@ -332,6 +332,12 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setExperimentalNotificationsEnabled(
         /* [in] */ BOOL enabled);
 
+    virtual HRESULT STDMETHODCALLTYPE experimentalWebSocketsEnabled(
+        /* [retval][out] */ BOOL *enabled);
+
+    virtual HRESULT STDMETHODCALLTYPE setExperimentalWebSocketsEnabled(
+        /* [in] */ BOOL enabled);
+
     virtual HRESULT STDMETHODCALLTYPE setShouldPaintNativeControls( 
     /* [in] */ BOOL shouldPaint);
 
index eb3a0f3..89e4688 100644 (file)
@@ -4409,6 +4409,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
         return hr;
     settings->setExperimentalNotificationsEnabled(enabled);
 
+    hr = prefsPrivate->experimentalWebSocketsEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings->setExperimentalWebSocketsEnabled(enabled);
+
     hr = prefsPrivate->isWebSecurityEnabled(&enabled);
     if (FAILED(hr))
         return hr;
@@ -5625,4 +5630,3 @@ Page* core(IWebView* iWebView)
 
     return page;
 }
-
index 9ace8b2..8049c4d 100644 (file)
@@ -1,3 +1,15 @@
+2009-09-28  Fumitoshi Ukai  <ukai@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Add experimentalWebSocketsEnabled in WebPreferences.
+        https://bugs.webkit.org/show_bug.cgi?id=28941
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetDefaultsToConsistentValues):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (resetDefaultsToConsistentValues):
+
 2009-09-28  Yaar Schnitman  <yaar@chromium.org>
 
         Reviewed by David Kilzer.
index 99cfae8..7f94a33 100644 (file)
@@ -407,6 +407,7 @@ static void resetDefaultsToConsistentValues()
     [preferences setCacheModel:WebCacheModelDocumentBrowser];
     [preferences setXSSAuditorEnabled:NO];
     [preferences setExperimentalNotificationsEnabled:NO];
+    [preferences setExperimentalWebSocketsEnabled:NO];
 
     [preferences setPrivateBrowsingEnabled:NO];
     [preferences setAuthorAndUserStylesEnabled:YES];
index e891056..e47c7e8 100644 (file)
@@ -737,6 +737,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
         prefsPrivate->setAuthorAndUserStylesEnabled(TRUE);
         prefsPrivate->setDeveloperExtrasEnabled(FALSE);
         prefsPrivate->setExperimentalNotificationsEnabled(TRUE);
+        prefsPrivate->setExperimentalWebSocketsEnabled(FALSE);
         prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592>
         prefsPrivate->setXSSAuditorEnabled(FALSE);
         prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE);