Commit 19fd5912 authored by hyatt@apple.com's avatar hyatt@apple.com

Add support for blacklist patterns to user stylesheets and scripts in addition...

Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns.

Reviewed by Adam Roben.

WebCore: 

* WebCore.base.exp:
* dom/Document.cpp:
(WebCore::Document::pageGroupUserSheets):
* page/Frame.cpp:
(WebCore::Frame::injectUserScriptsForWorld):
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserScript):
(WebCore::PageGroup::addUserStyleSheet):
(WebCore::PageGroup::removeUserContentWithURLForWorld):
(WebCore::PageGroup::removeUserContentForWorld):
* page/PageGroup.h:
* page/UserContentURLPattern.cpp:
(WebCore::UserContentURLPattern::matchesPatterns):
* page/UserContentURLPattern.h:
* page/UserScript.h:
(WebCore::UserScript::UserScript):
(WebCore::UserScript::whitelist):
(WebCore::UserScript::blacklist):
* page/UserStyleSheet.h:
(WebCore::UserStyleSheet::UserStyleSheet):
(WebCore::UserStyleSheet::whitelist):
(WebCore::UserStyleSheet::blacklist):

WebKit/mac: 

* WebView/WebView.mm:
(toStringVector):
(+[WebView _addUserScriptToGroup:source:url:worldID:whitelist:blacklist:injectionTime:]):
(+[WebView _addUserStyleSheetToGroup:source:url:worldID:whitelist:blacklist:]):
* WebView/WebViewPrivate.h:

WebKit/win: 

* Interfaces/IWebViewPrivate.idl:
* WebView.cpp:
(toStringVector):
(WebView::addUserScriptToGroup):
(WebView::addUserStyleSheetToGroup):
* WebView.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49033 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 21a8cae5
2009-10-02 Dave Hyatt <hyatt@apple.com>
Reviewed by Adam Roben.
Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns.
* WebCore.base.exp:
* dom/Document.cpp:
(WebCore::Document::pageGroupUserSheets):
* page/Frame.cpp:
(WebCore::Frame::injectUserScriptsForWorld):
* page/PageGroup.cpp:
(WebCore::PageGroup::addUserScript):
(WebCore::PageGroup::addUserStyleSheet):
(WebCore::PageGroup::removeUserContentWithURLForWorld):
(WebCore::PageGroup::removeUserContentForWorld):
* page/PageGroup.h:
* page/UserContentURLPattern.cpp:
(WebCore::UserContentURLPattern::matchesPatterns):
* page/UserContentURLPattern.h:
* page/UserScript.h:
(WebCore::UserScript::UserScript):
(WebCore::UserScript::whitelist):
(WebCore::UserScript::blacklist):
* page/UserStyleSheet.h:
(WebCore::UserStyleSheet::UserStyleSheet):
(WebCore::UserStyleSheet::whitelist):
(WebCore::UserStyleSheet::blacklist):
2009-10-02 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Darin Adler.
......@@ -721,9 +721,9 @@ __ZN7WebCore9HTMLNames9iframeTagE
__ZN7WebCore9HTMLNames9scriptTagE
__ZN7WebCore9PageCache11setCapacityEi
__ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv
__ZN7WebCore9PageGroup13addUserScriptERKNS_6StringERKNS_4KURLERKN3WTF6VectorIS1_Lm0EEEjNS_23UserScriptInjectionTimeE
__ZN7WebCore9PageGroup17addUserStyleSheetERKNS_6StringERKNS_4KURLEN3WTF10PassOwnPtrINS7_6VectorIS1_Lm0EEEEESB_j
__ZN7WebCore9PageGroup13addUserScriptERKNS_6StringERKNS_4KURLEN3WTF10PassOwnPtrINS7_6VectorIS1_Lm0EEEEESB_jNS_23UserScriptInjectionTimeE
__ZN7WebCore9PageGroup14addVisitedLinkEPKtm
__ZN7WebCore9PageGroup17addUserStyleSheetERKNS_6StringERKNS_4KURLERKN3WTF6VectorIS1_Lm0EEEj
__ZN7WebCore9PageGroup17closeLocalStorageEv
__ZN7WebCore9PageGroup20removeAllUserContentEv
__ZN7WebCore9PageGroup21removeAllVisitedLinksEv
......
......@@ -1969,7 +1969,7 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const
const UserStyleSheetVector* sheets = it->second;
for (unsigned i = 0; i < sheets->size(); ++i) {
const UserStyleSheet* sheet = sheets->at(i).get();
if (!UserContentURLPattern::matchesPatterns(url(), sheet->patterns()))
if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist()))
continue;
RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::create(const_cast<Document*>(this), sheet->url());
parsedSheet->setIsUserStyleSheet(true);
......
......@@ -881,12 +881,11 @@ void Frame::injectUserScriptsForWorld(unsigned worldID, const UserScriptVector&
if (!doc)
return;
// FIXME: Need to implement pattern checking.
Vector<ScriptSourceCode> sourceCode;
unsigned count = userScripts.size();
for (unsigned i = 0; i < count; ++i) {
UserScript* script = userScripts[i].get();
if (script->injectionTime() == injectionTime && UserContentURLPattern::matchesPatterns(doc->url(), script->patterns()))
if (script->injectionTime() == injectionTime && UserContentURLPattern::matchesPatterns(doc->url(), script->whitelist(), script->blacklist()))
sourceCode.append(ScriptSourceCode(script->source(), script->url()));
}
script()->evaluateInIsolatedWorld(worldID, sourceCode);
......
......@@ -199,12 +199,12 @@ StorageNamespace* PageGroup::localStorage()
}
#endif
void PageGroup::addUserScript(const String& source, const KURL& url, const Vector<String>& patterns,
unsigned worldID, UserScriptInjectionTime injectionTime)
void PageGroup::addUserScript(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
PassOwnPtr<Vector<String> > blacklist, unsigned worldID, UserScriptInjectionTime injectionTime)
{
if (worldID == UINT_MAX)
return;
OwnPtr<UserScript> userScript(new UserScript(source, url, patterns, worldID, injectionTime));
OwnPtr<UserScript> userScript(new UserScript(source, url, whitelist, blacklist, worldID, injectionTime));
if (!m_userScripts)
m_userScripts.set(new UserScriptMap);
UserScriptVector*& scriptsInWorld = m_userScripts->add(worldID, 0).first->second;
......@@ -213,11 +213,12 @@ void PageGroup::addUserScript(const String& source, const KURL& url, const Vecto
scriptsInWorld->append(userScript.release());
}
void PageGroup::addUserStyleSheet(const String& source, const KURL& url, const Vector<String>& patterns, unsigned worldID)
void PageGroup::addUserStyleSheet(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist,
PassOwnPtr<Vector<String> > blacklist, unsigned worldID)
{
if (worldID == UINT_MAX)
return;
OwnPtr<UserStyleSheet> userStyleSheet(new UserStyleSheet(source, url, patterns, worldID));
OwnPtr<UserStyleSheet> userStyleSheet(new UserStyleSheet(source, url, whitelist, blacklist, worldID));
if (!m_userStyleSheets)
m_userStyleSheets.set(new UserStyleSheetMap);
UserStyleSheetVector*& styleSheetsInWorld = m_userStyleSheets->add(worldID, 0).first->second;
......@@ -245,8 +246,8 @@ void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned world
}
if (scripts->isEmpty()) {
m_userScripts->remove(it);
delete it->second;
m_userScripts->remove(it);
}
}
}
......@@ -264,8 +265,8 @@ void PageGroup::removeUserContentWithURLForWorld(const KURL& url, unsigned world
}
if (stylesheets->isEmpty()) {
m_userStyleSheets->remove(it);
delete it->second;
m_userStyleSheets->remove(it);
}
}
......@@ -285,8 +286,8 @@ void PageGroup::removeUserContentForWorld(unsigned worldID)
if (m_userScripts) {
UserScriptMap::iterator it = m_userScripts->find(worldID);
if (it != m_userScripts->end()) {
m_userScripts->remove(it);
delete it->second;
m_userScripts->remove(it);
}
}
......@@ -294,9 +295,9 @@ void PageGroup::removeUserContentForWorld(unsigned worldID)
bool sheetsChanged = false;
UserStyleSheetMap::iterator it = m_userStyleSheets->find(worldID);
if (it != m_userStyleSheets->end()) {
delete it->second;
m_userStyleSheets->remove(it);
sheetsChanged = true;
delete it->second;
}
if (sheetsChanged) {
......
......@@ -70,11 +70,14 @@ namespace WebCore {
bool hasLocalStorage() { return m_localStorage; }
#endif
void addUserScript(const String& source, const KURL&, const Vector<String>& patterns,
void addUserScript(const String& source, const KURL&,
PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
unsigned worldID, UserScriptInjectionTime);
const UserScriptMap* userScripts() const { return m_userScripts.get(); }
void addUserStyleSheet(const String& source, const KURL&, const Vector<String>& patterns, unsigned worldID);
void addUserStyleSheet(const String& source, const KURL&,
PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
unsigned worldID);
const UserStyleSheetMap* userStyleSheets() const { return m_userStyleSheets.get(); }
void removeUserContentForWorld(unsigned);
......
......@@ -30,19 +30,33 @@
namespace WebCore {
bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String>& patterns)
bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String>* whitelist, const Vector<String>* blacklist)
{
// Treat no patterns at all as though a pattern of * was specified.
if (patterns.isEmpty())
return true;
// In order for a URL to be a match it has to be present in the whitelist and not present in the blacklist.
// If there is no whitelist at all, then all URLs are assumed to be in the whitelist.
bool matchesWhitelist = !whitelist || whitelist->isEmpty();
if (!matchesWhitelist) {
for (unsigned i = 0; i < whitelist->size(); ++i) {
UserContentURLPattern contentPattern(whitelist->at(i));
if (contentPattern.matches(url)) {
matchesWhitelist = true;
break;
}
}
}
for (unsigned i = 0; i < patterns.size(); ++i) {
UserContentURLPattern contentPattern(patterns[i]);
if (contentPattern.matches(url))
return true;
bool matchesBlacklist = false;
if (blacklist) {
for (unsigned i = 0; i < blacklist->size(); ++i) {
UserContentURLPattern contentPattern(blacklist->at(i));
if (contentPattern.matches(url)) {
matchesBlacklist = true;
break;
}
}
}
return false;
return matchesWhitelist && !matchesBlacklist;
}
bool UserContentURLPattern::parse(const String& pattern)
......
......@@ -49,7 +49,7 @@ public:
bool matchSubdomains() const { return m_matchSubdomains; }
static bool matchesPatterns(const KURL&, const Vector<String>&);
static bool matchesPatterns(const KURL&, const Vector<String>* whitelist, const Vector<String>* blacklist);
private:
bool parse(const String& pattern);
......
......@@ -29,6 +29,7 @@
#include "KURL.h"
#include "UserScriptTypes.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
......@@ -36,11 +37,12 @@ namespace WebCore {
class UserScript {
public:
UserScript(const String& source, const KURL& url,
const Vector<String>& patterns, unsigned worldID,
UserScriptInjectionTime injectionTime)
PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
unsigned worldID, UserScriptInjectionTime injectionTime)
: m_source(source)
, m_url(url)
, m_patterns(patterns)
, m_whitelist(whitelist)
, m_blacklist(blacklist)
, m_worldID(worldID)
, m_injectionTime(injectionTime)
{
......@@ -48,14 +50,16 @@ public:
const String& source() const { return m_source; }
const KURL& url() const { return m_url; }
const Vector<String>& patterns() const { return m_patterns; }
const Vector<String>* whitelist() const { return m_whitelist.get(); }
const Vector<String>* blacklist() const { return m_blacklist.get(); }
unsigned worldID() const { return m_worldID; }
UserScriptInjectionTime injectionTime() const { return m_injectionTime; }
private:
String m_source;
KURL m_url;
Vector<String> m_patterns;
OwnPtr<Vector<String> > m_whitelist;
OwnPtr<Vector<String> > m_blacklist;
unsigned m_worldID;
UserScriptInjectionTime m_injectionTime;
};
......
......@@ -29,6 +29,7 @@
#include "KURL.h"
#include "UserStyleSheetTypes.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
......@@ -36,23 +37,27 @@ namespace WebCore {
class UserStyleSheet {
public:
UserStyleSheet(const String& source, const KURL& url,
const Vector<String>& patterns, unsigned worldID)
PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist,
unsigned worldID)
: m_source(source)
, m_url(url)
, m_patterns(patterns)
, m_whitelist(whitelist)
, m_blacklist(blacklist)
, m_worldID(worldID)
{
}
const String& source() const { return m_source; }
const KURL& url() const { return m_url; }
const Vector<String>& patterns() const { return m_patterns; }
const Vector<String>* whitelist() const { return m_whitelist.get(); }
const Vector<String>* blacklist() const { return m_blacklist.get(); }
unsigned worldID() const { return m_worldID; }
private:
String m_source;
KURL m_url;
Vector<String> m_patterns;
OwnPtr<Vector<String> > m_whitelist;
OwnPtr<Vector<String> > m_blacklist;
unsigned m_worldID;
};
......
2009-10-02 Dave Hyatt <hyatt@apple.com>
Reviewed by Adam Roben.
Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns.
* WebView/WebView.mm:
(toStringVector):
(+[WebView _addUserScriptToGroup:source:url:worldID:whitelist:blacklist:injectionTime:]):
(+[WebView _addUserStyleSheetToGroup:source:url:worldID:whitelist:blacklist:]):
* WebView/WebViewPrivate.h:
2009-10-01 Mark Rowe <mrowe@apple.com>
Fix the Tiger build. Don't unconditionally enable 3D canvas as it is not supported on Tiger.
......
......@@ -2128,7 +2128,23 @@ static inline IMP getMethod(id o, SEL s)
_private->page->focusController()->setActive([[self window] isKeyWindow]);
}
+ (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID patterns:(NSArray *)patterns injectionTime:(WebUserScriptInjectionTime)injectionTime
static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
{
// Convert the patterns into Vectors.
NSUInteger count = [patterns count];
if (count == 0)
return 0;
Vector<String>* patternsVector = new Vector<String>;
for (NSUInteger i = 0; i < count; ++i) {
id entry = [patterns objectAtIndex:i];
if ([entry isKindOfClass:[NSString class]])
patternsVector->append(String((NSString*)entry));
}
return patternsVector;
}
+ (void)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID
whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime
{
String group(groupName);
if (group.isEmpty() || worldID == UINT_MAX)
......@@ -2138,20 +2154,12 @@ static inline IMP getMethod(id o, SEL s)
if (!pageGroup)
return;
// Convert the patterns into a Vector.
Vector<String> patternsVector;
NSUInteger count = [patterns count];
for (NSUInteger i = 0; i < count; ++i) {
id entry = [patterns objectAtIndex: i];
if ([entry isKindOfClass:[NSString class]])
patternsVector.append(String((NSString*)entry));
}
pageGroup->addUserScript(source, url, patternsVector, worldID,
pageGroup->addUserScript(source, url, toStringVector(whitelist), toStringVector(blacklist), worldID,
injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd);
}
+ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID patterns:(NSArray *)patterns
+ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID
whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist
{
String group(groupName);
if (group.isEmpty() || worldID == UINT_MAX)
......@@ -2161,16 +2169,7 @@ static inline IMP getMethod(id o, SEL s)
if (!pageGroup)
return;
// Convert the patterns into a Vector.
Vector<String> patternsVector;
NSUInteger count = [patterns count];
for (NSUInteger i = 0; i < count; ++i) {
id entry = [patterns objectAtIndex: i];
if ([entry isKindOfClass:[NSString class]])
patternsVector.append(String((NSString*)entry));
}
pageGroup->addUserStyleSheet(source, url, patternsVector, worldID);
pageGroup->addUserStyleSheet(source, url, toStringVector(whitelist), toStringVector(blacklist), worldID);
}
+ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID
......
......@@ -471,8 +471,8 @@ Could be worth adding to the API.
// Removes all white list entries created with _whiteListAccessFromOrigin.
+ (void)_resetOriginAccessWhiteLists;
+ (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)_addUserScriptToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist injectionTime:(WebUserScriptInjectionTime)injectionTime;
+ (void)_addUserStyleSheetToGroup:(NSString *)groupName source:(NSString *)source url:(NSURL *)url worldID:(unsigned)worldID whitelist:(NSArray *)whitelist blacklist:(NSArray *)blacklist;
+ (void)_removeUserContentFromGroup:(NSString *)groupName url:(NSURL *)url worldID:(unsigned)worldID;
+ (void)_removeUserContentFromGroup:(NSString *)groupName worldID:(unsigned)worldID;
+ (void)_removeAllUserContentFromGroup:(NSString *)groupName;
......
2009-10-02 Dave Hyatt <hyatt@apple.com>
Reviewed by Adam Roben.
Add support for blacklist patterns to user stylesheets and scripts in addition to whitelist patterns.
* Interfaces/IWebViewPrivate.idl:
* WebView.cpp:
(toStringVector):
(WebView::addUserScriptToGroup):
(WebView::addUserStyleSheetToGroup):
* WebView.h:
2009-10-02 Steve Falkenburg <sfalken@apple.com>
Reviewed by Mark Rowe.
......
......@@ -181,8 +181,13 @@ interface IWebViewPrivate : IUnknown
HRESULT MIMETypeForExtension([in] BSTR extension, [out, retval] BSTR* mimeType);
// 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 addUserScriptToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url,
[in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist,
[in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist,
[in] WebUserScriptInjectionTime injectionTime);
HRESULT addUserStyleSheetToGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR source, [in] BSTR url,
[in] unsigned whitelistCount, [in, size_is(whitelistCount)] BSTR* whitelist,
[in] unsigned blacklistCount, [in, size_is(blacklistCount)] BSTR* blacklist);
HRESULT removeUserContentWithURLFromGroup([in] BSTR groupName, [in] unsigned worldID, [in] BSTR url);
HRESULT removeUserContentFromGroup([in] BSTR groupName, [in] unsigned worldID);
HRESULT removeAllUserContentFromGroup([in] BSTR groupName);
......
......@@ -5433,7 +5433,21 @@ HRESULT WebView::setCanStartPlugins(BOOL canStartPlugins)
return S_OK;
}
HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, unsigned patternsCount, BSTR* patterns, WebUserScriptInjectionTime injectionTime)
static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR* patterns)
{
// Convert the patterns into a Vector.
if (patternsCount == 0)
return 0;
Vector<String>* patternsVector = new Vector<String>;
for (unsigned i = 0; i < patternsCount; ++i)
patternsVector.append(String(patterns[i], SysStringLen(patterns[i])));
return patternsVector;
}
HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url,
unsigned whitelistCount, BSTR* whitelist,
unsigned blacklistCount, BSTR* blacklist,
WebUserScriptInjectionTime injectionTime)
{
String group(groupName, SysStringLen(groupName));
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
......@@ -5444,18 +5458,16 @@ HRESULT WebView::addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR sou
if (!pageGroup)
return E_FAIL;
// Convert the patterns into a Vector.
Vector<String> patternsVector;
for (unsigned i = 0; i < patternsCount; ++i)
patternsVector.append(String(patterns[i], SysStringLen(patterns[i])));
pageGroup->addUserScript(String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))), patternsVector, worldID,
pageGroup->addUserScript(String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))),
toStringVector(whitelist), toStringVector(blacklist), worldID,
injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd);
return S_OK;
}
HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url, unsigned patternsCount, BSTR* patterns)
HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url
unsigned whitelistCount, BSTR* whitelist,
unsigned blacklistCount, BSTR* blacklist)
{
String group(groupName, SysStringLen(groupName));
if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max())
......@@ -5466,12 +5478,8 @@ HRESULT WebView::addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR
if (!pageGroup)
return E_FAIL;
// Convert the patterns into a Vector.
Vector<String> patternsVector;
for (unsigned i = 0; i < patternsCount; ++i)
patternsVector.append(String(patterns[i], SysStringLen(patterns[i])));
pageGroup->addUserStyleSheet(String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))), patternsVector, worldID);
pageGroup->addUserStyleSheet(String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))),
toStringVector(whitelist), toStringVector(blacklist), worldID);
return S_OK;
}
......
......@@ -740,8 +740,13 @@ public:
virtual HRESULT STDMETHODCALLTYPE setCanStartPlugins(
/* [in] */ BOOL canStartPlugins);
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 addUserScriptToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url,
unsigned whitelistCount, BSTR* whitelist,
unsigned blacklistCount, BSTR* blacklist,
WebUserScriptInjectionTime);
virtual HRESULT STDMETHODCALLTYPE addUserStyleSheetToGroup(BSTR groupName, unsigned worldID, BSTR source, BSTR url,
unsigned whitelistCount, BSTR* whitelist,
unsigned blacklistCount, BSTR* blacklist);
virtual HRESULT STDMETHODCALLTYPE removeUserContentWithURLFromGroup(BSTR groupName, unsigned worldID, BSTR url);
virtual HRESULT STDMETHODCALLTYPE removeUserContentFromGroup(BSTR groupName, unsigned worldID);
virtual HRESULT STDMETHODCALLTYPE removeAllUserContentFromGroup(BSTR groupName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment