[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

hyatt at apple.com hyatt at apple.com
Thu Oct 29 20:36:58 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 326237f632b02ba781d8f4152e4807b9dde77e27
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 30 19:25:57 2009 +0000

    WebCore: Add a method for removal of user scripts and stylesheets by URL from a specific world.
    
    Reviewed by Adam Roben.
    
    * page/PageGroup.cpp:
    (WebCore::PageGroup::removeUserContentURLForWorld):
    * page/PageGroup.h:
    
    WebKit/mac: Add the ability to remove user stylesheets and scripts by URL.
    
    Reviewed by Adam Roben.
    
    * WebView/WebView.mm:
    (+[WebView _removeUserContentFromGroup:url:worldID:]):
    * WebView/WebViewPrivate.h:
    
    WebKit/win: Add the ability to remove user stylesheets and scripts by URL.
    
    Reviewed by Adam Roben.
    
    * Interfaces/IWebViewPrivate.idl:
    * WebView.cpp:
    (WebView::removeUserContentWithURLFromGroup):
    * WebView.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48941 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e9c6e8f..f1aebcd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2009-09-30  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Adam Roben.
+
+        Add a method for removal of user scripts and stylesheets by URL from a specific world.
+
+        * page/PageGroup.cpp:
+        (WebCore::PageGroup::removeUserContentURLForWorld):
+        * page/PageGroup.h:
+
 2009-09-30  Chris Hawk  <hawk at chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index a43aab1..fa441b9 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -727,6 +727,7 @@ __ZN7WebCore9PageGroup17addUserStyleSheetERKNS_6StringERKNS_4KURLERKN3WTF6Vector
 __ZN7WebCore9PageGroup17closeLocalStorageEv
 __ZN7WebCore9PageGroup20removeAllUserContentEv
 __ZN7WebCore9PageGroup21removeAllVisitedLinksEv
+__ZN7WebCore9PageGroup32removeUserContentWithURLForWorldERKNS_4KURLEj
 __ZN7WebCore9PageGroup25removeUserContentForWorldEj
 __ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
 __ZN7WebCore9PageGroup9pageGroupERKNS_6StringE
diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp
index f9855a7..9d6f792 100644
--- a/WebCore/page/PageGroup.cpp
+++ b/WebCore/page/PageGroup.cpp
@@ -233,6 +233,41 @@ void PageGroup::addUserStyleSheet(const String& source, const KURL& url, const V
     }
 }
 
+void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned worldID)
+{
+    if (m_userScripts) {
+        UserScriptMap::iterator it = m_userScripts->find(worldID);
+        if (it != m_userScripts->end()) {
+            UserScriptVector* scripts = it->second;
+            for (int i = scripts->size() - 1; i >= 0; --i) {
+                if (scripts->at(i)->url() == url)
+                    scripts->remove(i);
+            }
+            
+            if (scripts->isEmpty()) {
+                m_userScripts->remove(it);
+                delete it->second;
+            }
+        }
+    }
+    
+    if (m_userStyleSheets) {
+        UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
+        if (it != m_userStyleSheets->end()) {
+            UserStyleSheetVector* stylesheets = it->second;
+            for (int i = stylesheets->size() - 1; i >= 0; --i) {
+                if (stylesheets->at(i)->url() == url)
+                    stylesheets->remove(i);
+            }
+            
+            if (stylesheets->isEmpty()) {
+                m_userStyleSheets->remove(it);
+                delete it->second;
+            }
+        }
+    }
+}
+
 void PageGroup::removeUserContentForWorld(unsigned worldID)
 {
     if (m_userScripts) {
diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h
index 0bf3fbc..edfc131 100644
--- a/WebCore/page/PageGroup.h
+++ b/WebCore/page/PageGroup.h
@@ -78,6 +78,7 @@ namespace WebCore {
         const UserStyleSheetMap* userStyleSheets() const { return m_userStyleSheets.get(); }
         
         void removeUserContentForWorld(unsigned);
+        void removeUserContentWithURLForWorld(const KURL&, unsigned);
         void removeAllUserContent();
         
     private:
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index e46bc46..6cf03c9 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,13 @@
+2009-09-30  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Adam Roben.
+
+        Add the ability to remove user stylesheets and scripts by URL.
+
+        * WebView/WebView.mm:
+        (+[WebView _removeUserContentFromGroup:url:worldID:]):
+        * WebView/WebViewPrivate.h:
+
 2009-09-29  Brady Eidson  <beidson at apple.com>
 
         Rubberstamped by Dan Bernstein.
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 1cf7f68..998a261 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -2175,6 +2175,19 @@ static inline IMP getMethod(id o, SEL s)
     pageGroup->addUserStyleSheet(source, url, patternsVector, worldID);
 }
 
++ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID
+{
+    String group(groupName);
+    if (group.isEmpty())
+        return;
+    
+    PageGroup* pageGroup = PageGroup::pageGroup(group);
+    if (!pageGroup)
+        return;
+
+    pageGroup->removeUserContentWithURLForWorld(url, worldID);
+}
+
 + (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID
 {
     String group(groupName);
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 2932665..9346840 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -473,6 +473,7 @@ Could be worth adding to the API.
 
 + (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID patterns:(NSArray *)patterns injectionTime:(WebUserScriptInjectionTime)injectionTime;
 + (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID patterns:(NSArray *)patterns;
++ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID;
 + (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID;
 + (void)_removeAllUserContentFromGroup:(NSString *)groupName;
 
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 0746516..09c5a35 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2009-09-30  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Adam Roben.
+
+        Add the ability to remove user stylesheets and scripts by URL.
+
+        * Interfaces/IWebViewPrivate.idl:
+        * WebView.cpp:
+        (WebView::removeUserContentWithURLFromGroup):
+        * WebView.h:
+
 2009-09-29  Kenneth Russell  <kbr at google.com>
 
         Reviewed by Dimitri Glazkov.
diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl
index 63897bb..db61de8 100644
--- a/WebKit/win/Interfaces/IWebViewPrivate.idl
+++ b/WebKit/win/Interfaces/IWebViewPrivate.idl
@@ -183,6 +183,7 @@ interface IWebViewPrivate : IUnknown
     // For the following functions, 0 < worldID < UINT_MAX.
     HRESULT addUserScriptToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url, [in] unsigned patternsCount, [in, size_is(patternsCount)] BSTR* patterns, [in] WebUserScriptInjectionTime injectionTime);
     HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url, [in] unsigned patternsCount, [in, size_is(patternsCount)] BSTR* patterns);
+    HRESULT removeUserContentWithURLFromGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR url);
     HRESULT removeUserContentFromGroup([in] BSTR groupName, [in] unsigned worldID);
     HRESULT removeAllUserContentFromGroup([in] BSTR groupName);
 
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 07e3ad1..fd97e31 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -5476,6 +5476,22 @@ HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR
     return S_OK;
 }
 
+HRESULT WebView::removeUserContentWithURLFromGroup(BSTR groupName, unsigned worldID, BSTR url)
+{
+    String group(groupName, SysStringLen(groupName));
+    if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
+        return E_INVALIDARG;
+
+    PageGroup* pageGroup = PageGroup::pageGroup(group);
+    ASSERT(pageGroup);
+    if (!pageGroup)
+        return E_FAIL;
+
+    pageGroup->removeUserContentWithURLForWorld(KURL(KURL(), String(url, SysStringLen(url))), worldID);
+
+    return S_OK;
+}
+
 HRESULT WebView::removeUserContentFromGroup(BSTR groupName, unsigned worldID)
 {
     String group(groupName, SysStringLen(groupName));
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
index e668d3c..3ba30df 100644
--- a/WebKit/win/WebView.h
+++ b/WebKit/win/WebView.h
@@ -742,6 +742,7 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, unsigned patternsCount, BSTR* patterns, WebUserScriptInjectionTime);
     virtual HRESULT STDMETHODCALLTYPE addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, unsigned patternsCount, BSTR* patterns);
+    virtual HRESULT STDMETHODCALLTYPE removeUserContentWithURLFromGroup(BSTR groupName, unsigned worldID, BSTR url);
     virtual HRESULT STDMETHODCALLTYPE removeUserContentFromGroup(BSTR groupName, unsigned worldID);
     virtual HRESULT STDMETHODCALLTYPE removeAllUserContentFromGroup(BSTR groupName);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list