[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.16-1409-g5afdf4d
aroben at apple.com
aroben at apple.com
Thu Dec 3 13:34:46 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit d2abd9d096a2feb7c99e38af2b1413c9bbadf796
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 12 22:40:38 2009 +0000
Small clean-up in WebView's user content functions
Preparation for <http://webkit.org/b/31414> Implement new SPI for
dealing with user scripts/stylesheets and isolated worlds
Reviewed by Dave Hyatt.
* WebView.cpp:
(toString):
(toKURL):
Added these helper functions to convert BSTRs to WebCore types.
(toStringVector):
(WebView::addUserScriptToGroup):
(WebView::addUserStyleSheetToGroup):
(WebView::removeUserScriptFromGroup):
(WebView::removeUserStyleSheetFromGroup):
(WebView::removeUserScriptsFromGroup):
(WebView::removeUserStyleSheetsFromGroup):
(WebView::removeAllUserContentFromGroup):
Use the new helper functions.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 14cd053..2b97b35 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,27 @@
+2009-11-12 Adam Roben <aroben at apple.com>
+
+ Small clean-up in WebView's user content functions
+
+ Preparation for <http://webkit.org/b/31414> Implement new SPI for
+ dealing with user scripts/stylesheets and isolated worlds
+
+ Reviewed by Dave Hyatt.
+
+ * WebView.cpp:
+ (toString):
+ (toKURL):
+ Added these helper functions to convert BSTRs to WebCore types.
+
+ (toStringVector):
+ (WebView::addUserScriptToGroup):
+ (WebView::addUserStyleSheetToGroup):
+ (WebView::removeUserScriptFromGroup):
+ (WebView::removeUserStyleSheetFromGroup):
+ (WebView::removeUserScriptsFromGroup):
+ (WebView::removeUserStyleSheetsFromGroup):
+ (WebView::removeAllUserContentFromGroup):
+ Use the new helper functions.
+
2009-11-11 Beth Dakin <bdakin at apple.com>
Build fix. No review needed.
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index e2f3fae..b3b6c35 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -5469,6 +5469,16 @@ HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins)
return S_OK;
}
+static String toString(BSTR bstr)
+{
+ return String(bstr, SysStringLen(bstr));
+}
+
+static KURL toKURL(BSTR bstr)
+{
+ return KURL(KURL(), toString(bstr));
+}
+
static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR* patterns)
{
// Convert the patterns into a Vector.
@@ -5476,7 +5486,7 @@ static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR*
return 0;
Vector<String>* patternsVector = new Vector<String>;
for (unsigned i = 0; i < patternsCount; ++i)
- patternsVector->append(String(patterns[i], SysStringLen(patterns[i])));
+ patternsVector->append(toString(patterns[i]));
return patternsVector;
}
@@ -5485,7 +5495,7 @@ HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR sou
unsigned blacklistCount, BSTR* blacklist,
WebUserScriptInjectionTime injectionTime)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
return E_INVALIDARG;
@@ -5494,7 +5504,7 @@ HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR sou
if (!pageGroup)
return E_FAIL;
- pageGroup->addUserScriptToWorld(worldID, String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))),
+ pageGroup->addUserScriptToWorld(worldID, toString(source), toKURL(url),
toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist),
injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd);
@@ -5505,7 +5515,7 @@ HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR
unsigned whitelistCount, BSTR* whitelist,
unsigned blacklistCount, BSTR* blacklist)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
return E_INVALIDARG;
@@ -5514,7 +5524,7 @@ HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR
if (!pageGroup)
return E_FAIL;
- pageGroup->addUserStyleSheetToWorld(worldID, String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))),
+ pageGroup->addUserStyleSheetToWorld(worldID, toString(source), toKURL(url),
toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist));
return S_OK;
@@ -5522,7 +5532,7 @@ HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR
HRESULT WebView::removeUserScriptFromGroup(BSTR groupName, unsigned worldID, BSTR url)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
return E_INVALIDARG;
@@ -5531,14 +5541,14 @@ HRESULT WebView::removeUserScriptFromGroup(BSTR groupName, unsigned worldID, BST
if (!pageGroup)
return E_FAIL;
- pageGroup->removeUserScriptFromWorld(worldID, KURL(KURL(), String(url, SysStringLen(url))));
+ pageGroup->removeUserScriptFromWorld(worldID, toKURL(url));
return S_OK;
}
HRESULT WebView::removeUserStyleSheetFromGroup(BSTR groupName, unsigned worldID, BSTR url)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
return E_INVALIDARG;
@@ -5547,14 +5557,14 @@ HRESULT WebView::removeUserStyleSheetFromGroup(BSTR groupName, unsigned worldID,
if (!pageGroup)
return E_FAIL;
- pageGroup->removeUserStyleSheetFromWorld(worldID, KURL(KURL(), String(url, SysStringLen(url))));
+ pageGroup->removeUserStyleSheetFromWorld(worldID, toKURL(url));
return S_OK;
}
HRESULT WebView::removeUserScriptsFromGroup(BSTR groupName, unsigned worldID)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
return E_INVALIDARG;
@@ -5569,7 +5579,7 @@ HRESULT WebView::removeUserScriptsFromGroup(BSTR groupName, unsigned worldID)
HRESULT WebView::removeUserStyleSheetsFromGroup(BSTR groupName, unsigned worldID)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
return E_INVALIDARG;
@@ -5584,7 +5594,7 @@ HRESULT WebView::removeUserStyleSheetsFromGroup(BSTR groupName, unsigned worldID
HRESULT WebView::removeAllUserContentFromGroup(BSTR groupName)
{
- String group(groupName, SysStringLen(groupName));
+ String group = toString(groupName);
if (group.isEmpty())
return E_INVALIDARG;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list