[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 12:52:33 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 211fe6e2368f00d000c887ac1d7025800f1b2e92
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 31 22:48:10 2010 +0000

    WebKitTestRunner needs layoutTestController.addUserStyleSheet
    https://bugs.webkit.org/show_bug.cgi?id=42680
    
    Reviewed by Gavin Barraclough.
    
    WebKitTestRunner needs layoutTestController.addUserScript
    https://bugs.webkit.org/show_bug.cgi?id=42681
    
    WebKit2:
    
    Improve UserContent APIs to allow passing null in the same places
    the WebKit1 API allowed. Add convenience function toWTFString to do
    WKStringRef conversion with correct null string behavior.
    
    * UIProcess/API/C/WKAPICast.h:
    (toWTFString):
    * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
    (WKBundleAddUserScript):
    (WKBundleAddUserStyleSheet):
    (WKBundleRemoveUserScript):
    (WKBundleRemoveUserStyleSheet):
    * WebProcess/InjectedBundle/InjectedBundle.cpp:
    (WebKit::toStringVector):
    
    WebKitTools:
    
    * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
    * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
    (WTR::InjectedBundle::beginTesting):
    * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
    (WTR::LayoutTestController::addUserScript):
    (WTR::LayoutTestController::addUserStyleSheet):
    * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
    
    LayoutTests:
    
    * platform/mac-wk2/Skipped: Update skipped list.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66548 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6bc1822..5be20d0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-08-31  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Gavin Barraclough.
+
+        WebKitTestRunner needs layoutTestController.addUserStyleSheet
+        https://bugs.webkit.org/show_bug.cgi?id=42680
+
+        WebKitTestRunner needs layoutTestController.addUserScript
+        https://bugs.webkit.org/show_bug.cgi?id=42681
+
+        * platform/mac-wk2/Skipped: Update skipped list.
+
 2010-08-31  Tony Chang  <tony at chromium.org>
 
         Unreviewed, updating test_expectations.txt.
diff --git a/LayoutTests/platform/mac-wk2/Skipped b/LayoutTests/platform/mac-wk2/Skipped
index fd3fbf6..fa9bb8d 100644
--- a/LayoutTests/platform/mac-wk2/Skipped
+++ b/LayoutTests/platform/mac-wk2/Skipped
@@ -1752,26 +1752,6 @@ http/tests/security/local-user-CSS-from-remote.html
 # <https://bugs.webkit.org/show_bug.cgi?id=42679> 
 platform/mac/fast/loader/user-stylesheet-fast-path.html
 
-# WebKitTestRunner needs layoutTestController.addUserStyleSheet
-# <https://bugs.webkit.org/show_bug.cgi?id=42680>
-printing/page-rule-selection.html
-userscripts/mixed-case-stylesheet.html
-userscripts/simple-stylesheet.html
-userscripts/user-style-all-frames.html
-userscripts/user-style-top-frame-only.html
-
-# WebKitTestRunner needs layoutTestController.addUserScript
-# <https://bugs.webkit.org/show_bug.cgi?id=42681>
-userscripts/script-not-run-for-fragments.html
-userscripts/script-run-at-end.html
-userscripts/script-run-at-start.html
-userscripts/user-script-all-frames.html
-userscripts/user-script-top-frame-only.html
-userscripts/user-script-audio-document.html
-userscripts/user-script-image-document.html
-userscripts/user-script-plugin-document.html
-userscripts/user-script-video-document.html
-
 # WebKitTestRunner needs layoutTestController.setPOSIXLocale
 # <https://bugs.webkit.org/show_bug.cgi?id=42682>
 fast/css/opacity-float.html
@@ -1970,6 +1950,9 @@ editing/selection/doubleclick-inline-first-last-contenteditable.html
 # WebKitTestRunner needs layoutTestController.suspendAnimations
 animations/suspend-resume-animation.html
 
+# WebKitTestRunner needs layoutTestController.pageProperty
+printing/page-rule-selection.html
+
 # WebKitTestRunner gets confused by location.href redirects.
 plugins/attach-during-destroy.html
 plugins/destroy-reentry.html
@@ -2163,6 +2146,14 @@ storage/domstorage/sessionstorage/window-open.html
 http/tests/security/popup-blocked-from-fake-event.html
 http/tests/security/popup-blocked-from-window-open.html
 
+# Unexplained failures that were formerly in the layoutTestController.addUserScript list.
+userscripts/script-not-run-for-fragments.html
+userscripts/script-run-at-start.html
+userscripts/user-script-image-document.html
+userscripts/user-script-plugin-document.html
+userscripts/user-script-audio-document.html
+userscripts/user-script-video-document.html
+
 # Unexplained failures that were formerly in the "unsafe access" list.
 http/tests/security/cross-frame-access-child-explicit-domain.html
 http/tests/security/cross-frame-access-enumeration.html
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c0bc0a0..7b73784 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
+2010-08-31  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Gavin Barraclough.
+
+        WebKitTestRunner needs layoutTestController.addUserStyleSheet
+        https://bugs.webkit.org/show_bug.cgi?id=42680
+
+        WebKitTestRunner needs layoutTestController.addUserScript
+        https://bugs.webkit.org/show_bug.cgi?id=42681
+
+        Improve UserContent APIs to allow passing null in the same places
+        the WebKit1 API allowed. Add convenience function toWTFString to do
+        WKStringRef conversion with correct null string behavior.
+
+        * UIProcess/API/C/WKAPICast.h:
+        (toWTFString):
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleAddUserScript):
+        (WKBundleAddUserStyleSheet):
+        (WKBundleRemoveUserScript):
+        (WKBundleRemoveUserStyleSheet):
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::toStringVector):
+
 2010-08-31  Steve Falkenburg  <sfalken at apple.com>
 
         Rubber stamped by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index b25e523..7c604ce 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -157,6 +157,20 @@ inline WKURLRef toCopiedURLRef(const WTF::String& string)
     return toRef(webURL.release().releaseRef());
 }
 
+inline WTF::String toWTFString(WKStringRef stringRef)
+{
+    if (!stringRef)
+        return WTF::String();
+    return toWK(stringRef)->string();
+}
+
+inline WTF::String toWTFString(WKURLRef urlRef)
+{
+    if (!urlRef)
+        return WTF::String();
+    return toWK(urlRef)->string();
+}
+
 /* Enum conversions */
 
 inline WKTypeID toRef(WebKit::APIObject::Type type)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 81b645d..c5f7dd8 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -80,22 +80,22 @@ size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundleRef)
 
 void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef)
 {
-    toWK(bundleRef)->addUserScript(toWK(scriptWorldRef), toWK(sourceRef)->string(), toWK(urlRef)->string(), toWK(whitelistRef), toWK(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef));
+    toWK(bundleRef)->addUserScript(toWK(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toWK(whitelistRef), toWK(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef));
 }
 
 void WKBundleAddUserStyleSheet(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserContentInjectedFrames injectedFramesRef)
 {
-    toWK(bundleRef)->addUserStyleSheet(toWK(scriptWorldRef), toWK(sourceRef)->string(), toWK(urlRef)->string(), toWK(whitelistRef), toWK(blacklistRef), toUserContentInjectedFrames(injectedFramesRef));
+    toWK(bundleRef)->addUserStyleSheet(toWK(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toWK(whitelistRef), toWK(blacklistRef), toUserContentInjectedFrames(injectedFramesRef));
 }
 
 void WKBundleRemoveUserScript(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
 {
-    toWK(bundleRef)->removeUserScript(toWK(scriptWorldRef), toWK(urlRef)->string());
+    toWK(bundleRef)->removeUserScript(toWK(scriptWorldRef), toWTFString(urlRef));
 }
 
 void WKBundleRemoveUserStyleSheet(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
 {
-    toWK(bundleRef)->removeUserStyleSheet(toWK(scriptWorldRef), toWK(urlRef)->string());
+    toWK(bundleRef)->removeUserStyleSheet(toWK(scriptWorldRef), toWTFString(urlRef));
 }
 
 void WKBundleRemoveUserScripts(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index 90ef4a1..65e7809 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -199,6 +199,9 @@ void InjectedBundle::removeAllVisitedLinks()
 
 static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns)
 {
+    if (!patterns)
+        return 0;
+
     size_t size =  patterns->size();
     if (!size)
         return 0;
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f797ac3..ead3b45 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-31  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Gavin Barraclough.
+
+        WebKitTestRunner needs layoutTestController.addUserStyleSheet
+        https://bugs.webkit.org/show_bug.cgi?id=42680
+
+        WebKitTestRunner needs layoutTestController.addUserScript
+        https://bugs.webkit.org/show_bug.cgi?id=42681
+
+        * WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::addUserScript):
+        (WTR::LayoutTestController::addUserStyleSheet):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.h:
+
 2010-08-31  Dirk Pranke  <dpranke at chromium.org>
 
         Unreviewed, rolling out r66542.
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
index 7993d78..c849a7b 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl
@@ -61,6 +61,10 @@ module WTR {
         // Animation testing.
         int numberOfActiveAnimations();
         boolean pauseAnimationAtTimeOnElementWithId(in DOMString animationName, in double time, in DOMString elementId);
+
+        // UserContent testing.
+        void addUserScript(in DOMString source, in boolean runAtStart, in boolean allFrames);
+        void addUserStyleSheet(in DOMString source, in boolean allFrames);
     };
 
 }
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index b2aa836..ecc302f 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -133,6 +133,8 @@ void InjectedBundle::beginTesting()
     WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
     WKBundleRemoveAllVisitedLinks(m_bundle);
 
+    WKBundleRemoveAllUserContent(m_bundle);
+
     m_mainPage->reset();
 }
 
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index f2393f1..d6c5a82 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -32,6 +32,7 @@
 #include <WebKit2/WKBundleFrame.h>
 #include <WebKit2/WKBundleFramePrivate.h>
 #include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundleScriptWorld.h>
 #include <WebKit2/WKBundlePrivate.h>
 #include <WebKit2/WKRetainPtr.h>
 #include <WebKit2/WebKit2.h>
@@ -163,6 +164,25 @@ bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef anima
     return WKBundleFramePauseAnimationOnElementWithId(mainFrame, toWK(animationName).get(), toWK(elementId).get(), time);
 }
 
+void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
+{
+    WKRetainPtr<WKStringRef> sourceWK = toWK(source);
+    WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
+
+    WKBundleAddUserScript(InjectedBundle::shared().bundle(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
+        (runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd),
+        (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
+}
+
+void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
+{
+    WKRetainPtr<WKStringRef> sourceWK = toWK(source);
+    WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
+
+    WKBundleAddUserStyleSheet(InjectedBundle::shared().bundle(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
+        (allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
+}
+
 void LayoutTestController::keepWebHistory()
 {
     WKBundleSetShouldTrackVisitedLinks(InjectedBundle::shared().bundle(), true);
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
index 7c3125c..8368a11 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.h
@@ -80,6 +80,10 @@ public:
     unsigned numberOfActiveAnimations() const;
     bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
 
+    // UserContent testing.
+    void addUserScript(JSStringRef source, bool runAtStart, bool allFrames);
+    void addUserStyleSheet(JSStringRef source, bool allFrames);
+
     enum WhatToDump { RenderTree, MainFrameText, AllFramesText };
     WhatToDump whatToDump() const { return m_whatToDump; }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list