Changeset 131275 in webkit
- Timestamp:
- Oct 14, 2012, 2:55:53 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r131274 r131275 1 2012-10-14 Sam Weinig <sam@webkit.org> 2 3 Make UserScript and UserStyleSheet value objects that are copyable 4 https://bugs.webkit.org/show_bug.cgi?id=99275 5 6 Reviewed by Tim Horton. 7 8 Simplify UserScript and UserStyleSheet and make them more easily usable 9 without sticking them in an OwnPtr. 10 11 * WebCore.exp.in: 12 Update exports. 13 14 * page/PageGroup.cpp: 15 (WebCore::PageGroup::addUserScriptToWorld): 16 (WebCore::PageGroup::addUserStyleSheetToWorld): 17 * page/PageGroup.h: 18 (PageGroup): 19 * page/UserContentURLPattern.cpp: 20 (WebCore::UserContentURLPattern::matchesPatterns): 21 * page/UserContentURLPattern.h: 22 (UserContentURLPattern): 23 Update to not assume whitelist and blacklist are in Vector<String>*. 24 25 * page/UserScript.h: 26 (UserScript): 27 (WebCore::UserScript::UserScript): 28 (WebCore::UserScript::whitelist): 29 (WebCore::UserScript::blacklist): 30 * page/UserStyleSheet.h: 31 (UserStyleSheet): 32 (WebCore::UserStyleSheet::UserStyleSheet): 33 (WebCore::UserStyleSheet::whitelist): 34 (WebCore::UserStyleSheet::blacklist): 35 Switch OwnPtr<Vector<String> > to Vector<String> and remove Noncopyable restriction. 36 1 37 2012-10-14 Tim Horton <timothy_horton@apple.com> 2 38 -
trunk/Source/WebCore/WebCore.exp.in
r131274 r131275 1053 1053 __ZN7WebCore9PageGroup18addVisitedLinkHashEy 1054 1054 __ZN7WebCore9PageGroup18numberOfPageGroupsEv 1055 __ZN7WebCore9PageGroup20addUserScriptToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLE NS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE1055 __ZN7WebCore9PageGroup20addUserScriptToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLERKNS3_6VectorIS4_Lm0EEESD_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE 1056 1056 __ZN7WebCore9PageGroup20removeAllUserContentEv 1057 1057 __ZN7WebCore9PageGroup21removeAllVisitedLinksEv 1058 __ZN7WebCore9PageGroup24addUserStyleSheetToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLE NS3_10PassOwnPtrINS3_6VectorIS4_Lm0EEEEESD_NS_25UserContentInjectedFramesENS_14UserStyleLevelENS_22UserStyleInjectionTimeE1058 __ZN7WebCore9PageGroup24addUserStyleSheetToWorldEPNS_15DOMWrapperWorldERKN3WTF6StringERKNS_4KURLERKNS3_6VectorIS4_Lm0EEESD_NS_25UserContentInjectedFramesENS_14UserStyleLevelENS_22UserStyleInjectionTimeE 1059 1059 __ZN7WebCore9PageGroup25removeUserScriptFromWorldEPNS_15DOMWrapperWorldERKNS_4KURLE 1060 1060 __ZN7WebCore9PageGroup26removeUserScriptsFromWorldEPNS_15DOMWrapperWorldE -
trunk/Source/WebCore/page/PageGroup.cpp
r130612 r131275 263 263 264 264 void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, 265 PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> >blacklist,265 const Vector<String>& whitelist, const Vector<String>& blacklist, 266 266 UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames) 267 267 { … … 278 278 279 279 void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, 280 PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> >blacklist,280 const Vector<String>& whitelist, const Vector<String>& blacklist, 281 281 UserContentInjectedFrames injectedFrames, 282 282 UserStyleLevel level, -
trunk/Source/WebCore/page/PageGroup.h
r123451 r131275 84 84 85 85 void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&, 86 PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> >blacklist,86 const Vector<String>& whitelist, const Vector<String>& blacklist, 87 87 UserScriptInjectionTime, UserContentInjectedFrames); 88 88 void addUserStyleSheetToWorld(DOMWrapperWorld*, const String& source, const KURL&, 89 PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> >blacklist,89 const Vector<String>& whitelist, const Vector<String>& blacklist, 90 90 UserContentInjectedFrames, 91 91 UserStyleLevel level = UserStyleUserLevel, -
trunk/Source/WebCore/page/UserContentURLPattern.cpp
r127062 r131275 26 26 #include "config.h" 27 27 #include "UserContentURLPattern.h" 28 28 29 #include "KURL.h" 29 30 #include <wtf/StdLibExtras.h> … … 31 32 namespace WebCore { 32 33 33 bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String> * whitelist, const Vector<String>*blacklist)34 bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist) 34 35 { 35 36 // In order for a URL to be a match it has to be present in the whitelist and not present in the blacklist. 36 37 // If there is no whitelist at all, then all URLs are assumed to be in the whitelist. 37 bool matchesWhitelist = !whitelist || whitelist->isEmpty();38 bool matchesWhitelist = whitelist.isEmpty(); 38 39 if (!matchesWhitelist) { 39 for (unsigned i = 0; i < whitelist->size(); ++i) { 40 UserContentURLPattern contentPattern(whitelist->at(i)); 40 size_t whitelistSize = whitelist.size(); 41 for (size_t i = 0; i < whitelistSize; ++i) { 42 UserContentURLPattern contentPattern(whitelist[i]); 41 43 if (contentPattern.matches(url)) { 42 44 matchesWhitelist = true; … … 47 49 48 50 bool matchesBlacklist = false; 49 if (blacklist) { 50 for (unsigned i = 0; i < blacklist->size(); ++i) { 51 UserContentURLPattern contentPattern(blacklist->at(i)); 51 if (!blacklist.isEmpty()) { 52 size_t blacklistSize = blacklist.size(); 53 for (size_t i = 0; i < blacklistSize; ++i) { 54 UserContentURLPattern contentPattern(blacklist[i]); 52 55 if (contentPattern.matches(url)) { 53 56 matchesBlacklist = true; -
trunk/Source/WebCore/page/UserContentURLPattern.h
r127757 r131275 54 54 bool matchSubdomains() const { return m_matchSubdomains; } 55 55 56 static bool matchesPatterns(const KURL&, const Vector<String> * whitelist, const Vector<String>*blacklist);56 static bool matchesPatterns(const KURL&, const Vector<String>& whitelist, const Vector<String>& blacklist); 57 57 58 58 private: -
trunk/Source/WebCore/page/UserScript.h
r95901 r131275 30 30 #include "UserContentTypes.h" 31 31 #include "UserScriptTypes.h" 32 #include <wtf/OwnPtr.h>33 #include <wtf/PassOwnPtr.h>34 32 #include <wtf/Vector.h> 35 33 … … 37 35 38 36 class UserScript { 39 WTF_MAKE_ NONCOPYABLE(UserScript); WTF_MAKE_FAST_ALLOCATED;37 WTF_MAKE_FAST_ALLOCATED; 40 38 public: 41 UserScript(const String& source, const KURL& url, 42 PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, 43 UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames) 39 UserScript(const String& source, const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames) 44 40 : m_source(source) 45 41 , m_url(url) … … 53 49 const String& source() const { return m_source; } 54 50 const KURL& url() const { return m_url; } 55 const Vector<String> * whitelist() const { return m_whitelist.get(); }56 const Vector<String> * blacklist() const { return m_blacklist.get(); }51 const Vector<String>& whitelist() const { return m_whitelist; } 52 const Vector<String>& blacklist() const { return m_blacklist; } 57 53 UserScriptInjectionTime injectionTime() const { return m_injectionTime; } 58 54 UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; } … … 61 57 String m_source; 62 58 KURL m_url; 63 OwnPtr<Vector<String>> m_whitelist;64 OwnPtr<Vector<String>> m_blacklist;59 Vector<String> m_whitelist; 60 Vector<String> m_blacklist; 65 61 UserScriptInjectionTime m_injectionTime; 66 62 UserContentInjectedFrames m_injectedFrames; -
trunk/Source/WebCore/page/UserStyleSheet.h
r95901 r131275 30 30 #include "UserContentTypes.h" 31 31 #include "UserStyleSheetTypes.h" 32 #include <wtf/OwnPtr.h>33 #include <wtf/PassOwnPtr.h>34 32 #include <wtf/Vector.h> 35 33 … … 37 35 38 36 class UserStyleSheet { 39 WTF_MAKE_ NONCOPYABLE(UserStyleSheet); WTF_MAKE_FAST_ALLOCATED;37 WTF_MAKE_FAST_ALLOCATED; 40 38 public: 41 UserStyleSheet(const String& source, const KURL& url, 42 PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, 43 UserContentInjectedFrames injectedFrames, UserStyleLevel level) 39 UserStyleSheet(const String& source, const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level) 44 40 : m_source(source) 45 41 , m_url(url) … … 53 49 const String& source() const { return m_source; } 54 50 const KURL& url() const { return m_url; } 55 const Vector<String> * whitelist() const { return m_whitelist.get(); }56 const Vector<String> * blacklist() const { return m_blacklist.get(); }51 const Vector<String>& whitelist() const { return m_whitelist; } 52 const Vector<String>& blacklist() const { return m_blacklist; } 57 53 UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; } 58 54 UserStyleLevel level() const { return m_level; } … … 61 57 String m_source; 62 58 KURL m_url; 63 OwnPtr<Vector<String>> m_whitelist;64 OwnPtr<Vector<String>> m_blacklist;59 Vector<String> m_whitelist; 60 Vector<String> m_blacklist; 65 61 UserContentInjectedFrames m_injectedFrames; 66 62 UserStyleLevel m_level; -
trunk/Source/WebKit/chromium/ChangeLog
r131223 r131275 1 2012-10-14 Sam Weinig <sam@webkit.org> 2 3 Make UserScript and UserStyleSheet value objects that are copyable 4 https://bugs.webkit.org/show_bug.cgi?id=99275 5 6 Reviewed by Tim Horton. 7 8 * src/WebViewImpl.cpp: 9 (WebKit::WebView::addUserScript): 10 (WebKit::WebView::addUserStyleSheet): 11 Update for new PageGroup function signatures. 12 1 13 2012-10-12 Adam Barth <abarth@webkit.org> 2 14 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r131131 r131275 3513 3513 WebView::UserContentInjectIn injectIn) 3514 3514 { 3515 OwnPtr<Vector<String> > patterns = adoptPtr(new Vector<String>);3515 Vector<String> patterns; 3516 3516 for (size_t i = 0; i < patternsIn.size(); ++i) 3517 patterns ->append(patternsIn[i]);3517 patterns.append(patternsIn[i]); 3518 3518 3519 3519 PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); 3520 3520 RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); 3521 pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns .release(), nullptr,3521 pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns, Vector<String>(), 3522 3522 static_cast<UserScriptInjectionTime>(injectAt), 3523 3523 static_cast<UserContentInjectedFrames>(injectIn)); … … 3529 3529 WebView::UserStyleInjectionTime injectionTime) 3530 3530 { 3531 OwnPtr<Vector<String> > patterns = adoptPtr(new Vector<String>);3531 Vector<String> patterns; 3532 3532 for (size_t i = 0; i < patternsIn.size(); ++i) 3533 patterns ->append(patternsIn[i]);3533 patterns.append(patternsIn[i]); 3534 3534 3535 3535 PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); … … 3540 3540 // 3541 3541 // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. 3542 pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns .release(), nullptr,3542 pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns, Vector<String>(), 3543 3543 static_cast<UserContentInjectedFrames>(injectIn), 3544 3544 UserStyleAuthorLevel, -
trunk/Source/WebKit/efl/ChangeLog
r131119 r131275 1 2012-10-14 Sam Weinig <sam@webkit.org> 2 3 Make UserScript and UserStyleSheet value objects that are copyable 4 https://bugs.webkit.org/show_bug.cgi?id=99275 5 6 Reviewed by Tim Horton. 7 8 * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: 9 (DumpRenderTreeSupportEfl::addUserScript): 10 (DumpRenderTreeSupportEfl::addUserStyleSheet): 11 Update for new PageGroup function signatures. 12 1 13 2012-10-11 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 14 -
trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
r130612 r131275 297 297 298 298 page->group().addUserScriptToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), 299 nullptr, nullptr, runAtStart ? WebCore::InjectAtDocumentStart : WebCore::InjectAtDocumentEnd,299 Vector<String>(), Vector<String>(), runAtStart ? WebCore::InjectAtDocumentStart : WebCore::InjectAtDocumentEnd, 300 300 allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly); 301 301 } … … 312 312 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); 313 313 314 page->group().addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), nullptr, nullptr, allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly);314 page->group().addUserStyleSheetToWorld(WebCore::mainThreadNormalWorld(), sourceCode, WebCore::KURL(), Vector<String>(), Vector<String>(), allFrames ? WebCore::InjectInAllFrames : WebCore::InjectInTopFrameOnly); 315 315 } 316 316 -
trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
r130159 r131275 209 209 WebKitWebView* webView = getViewFromFrame(frame); 210 210 Page* page = core(webView); 211 page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, KURL(), nullptr, nullptr, allFrames ? InjectInAllFrames : InjectInTopFrameOnly);211 page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, KURL(), Vector<String>(), Vector<String>(), allFrames ? InjectInAllFrames : InjectInTopFrameOnly); 212 212 } 213 213 -
trunk/Source/WebKit/mac/ChangeLog
r131085 r131275 1 2012-10-14 Sam Weinig <sam@webkit.org> 2 3 Make UserScript and UserStyleSheet value objects that are copyable 4 https://bugs.webkit.org/show_bug.cgi?id=99275 5 6 Reviewed by Tim Horton. 7 8 * WebView/WebView.mm: 9 (-[WebView _injectMailQuirksScript]): 10 (-[WebView _injectOutlookQuirksScript]): 11 Update for new PageGroup function signatures. 12 1 13 2012-10-10 Brady Eidson <beidson@apple.com> 2 14 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r131018 r131275 683 683 static NSString *mailQuirksScriptContents = leakMailQuirksUserScriptContents(); 684 684 core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]), 685 mailQuirksScriptContents, KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInAllFrames);685 mailQuirksScriptContents, KURL(), Vector<String>(), Vector<String>(), InjectAtDocumentEnd, InjectInAllFrames); 686 686 } 687 687 … … 704 704 static NSString *outlookQuirksScriptContents = leakOutlookQuirksUserScriptContents(); 705 705 core(self)->group().addUserScriptToWorld(core([WebScriptWorld world]), 706 outlookQuirksScriptContents, KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInAllFrames);706 outlookQuirksScriptContents, KURL(), Vector<String>(), Vector<String>(), InjectAtDocumentEnd, InjectInAllFrames); 707 707 } 708 708 … … 2628 2628 } 2629 2629 2630 static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) 2631 { 2632 // Convert the patterns into Vectors. 2630 static Vector<String> toStringVector(NSArray* patterns) 2631 { 2632 Vector<String> patternsVector; 2633 2633 2634 NSUInteger count = [patterns count]; 2634 if ( count == 0)2635 return nullptr;2636 OwnPtr<Vector<String> > patternsVector = adoptPtr(new Vector<String>); 2635 if (!count) 2636 return patternsVector; 2637 2637 2638 for (NSUInteger i = 0; i < count; ++i) { 2638 2639 id entry = [patterns objectAtIndex:i]; 2639 2640 if ([entry isKindOfClass:[NSString class]]) 2640 patternsVector ->append(String((NSString*)entry));2641 } 2642 return patternsVector .release();2641 patternsVector.append(String((NSString *)entry)); 2642 } 2643 return patternsVector; 2643 2644 } 2644 2645 -
trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
r130898 r131275 836 836 void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode) 837 837 { 838 page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), nullptr, nullptr, WebCore::InjectInAllFrames);838 page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), Vector<String>(), Vector<String>(), WebCore::InjectInAllFrames); 839 839 } 840 840 -
trunk/Source/WebKit2/ChangeLog
r131273 r131275 1 2012-10-14 Sam Weinig <sam@webkit.org> 2 3 Make UserScript and UserStyleSheet value objects that are copyable 4 https://bugs.webkit.org/show_bug.cgi?id=99275 5 6 Reviewed by Tim Horton. 7 8 * Shared/UserContentContainer.cpp: 9 (WebKit::toStringVector): 10 (WebKit::UserContentContainer::Item::Item): 11 (WebKit::UserContentContainer::Item::encode): 12 (WebKit::UserContentContainer::Item::decode): 13 * Shared/UserContentContainer.h: 14 (WebKit::UserContentContainer::Item::whitelist): 15 (WebKit::UserContentContainer::Item::blacklist): 16 Switch UserContentContainer::Item to store Vector<String> instead of ImmutableArray, easing 17 transition to new PageGroup function signatures. 18 19 * WebProcess/InjectedBundle/InjectedBundle.cpp: 20 (WebKit::toStringVector): 21 * WebProcess/WebPage/qt/WebPageQt.cpp: 22 (WebKit::WebPage::setUserScripts): 23 Update for new PageGroup function signatures. 24 1 25 2012-10-14 Tim Horton <timothy_horton@apple.com> 2 26 -
trunk/Source/WebKit2/Shared/UserContentContainer.cpp
r130948 r131275 33 33 namespace WebKit { 34 34 35 static Vector<String> toStringVector(ImmutableArray* array) 36 { 37 Vector<String> patternVector; 38 if (!array) 39 return patternVector; 40 41 size_t size = array->size(); 42 if (!size) 43 return patternVector; 44 45 patternVector.reserveInitialCapacity(size); 46 for (size_t i = 0; i < size; ++i) { 47 WebString* webString = array->at<WebString>(i); 48 ASSERT(webString); 49 patternVector.uncheckedAppend(webString->string()); 50 } 51 52 return patternVector; 53 } 54 35 55 UserContentContainer::Item::Item() 36 56 { … … 40 60 : m_source(source) 41 61 , m_url(url) 42 , m_whitelist( whitelist)43 , m_blacklist( blacklist)62 , m_whitelist(toStringVector(whitelist.get())) 63 , m_blacklist(toStringVector(blacklist.get())) 44 64 , m_injectedFrames(injectedFrames) 45 65 , m_type(type) … … 48 68 } 49 69 50 static void encodeStringArray(CoreIPC::ArgumentEncoder* encoder, ImmutableArray* array)51 {52 ASSERT(encoder);53 uint32_t size = array ? array->size() : 0;54 encoder->encode(size);55 for (uint32_t i = 0; i < size; ++i) {56 WebString* webString = array->at<WebString>(i);57 ASSERT(webString);58 encoder->encode(webString->string());59 }60 }61 62 70 void UserContentContainer::Item::encode(CoreIPC::ArgumentEncoder* encoder) const 63 71 { 64 72 encoder->encode(m_source->string()); 65 73 encoder->encode(m_url ? m_url->string() : String()); 66 encode StringArray(encoder, m_whitelist.get());67 encode StringArray(encoder, m_blacklist.get());74 encoder->encode(m_whitelist); 75 encoder->encode(m_blacklist); 68 76 encoder->encode(static_cast<uint32_t>(m_injectedFrames)); 69 77 encoder->encode(static_cast<uint32_t>(m_type)); 70 }71 72 static bool decodeStringArray(CoreIPC::ArgumentDecoder* decoder, Vector<RefPtr<APIObject> >& vector)73 {74 ASSERT(decoder);75 ASSERT(vector.isEmpty());76 77 uint32_t size;78 if (!decoder->decode(size))79 return false;80 81 if (!size)82 return true;83 84 vector.reserveInitialCapacity(size);85 for (uint32_t i = 0; i < size; ++i) {86 String string;87 if (!decoder->decode(string))88 return false;89 vector.uncheckedAppend(WebString::create(string));90 }91 92 return true;93 78 } 94 79 … … 97 82 ASSERT(!item.m_source); 98 83 ASSERT(!item.m_url); 99 ASSERT( !item.m_whitelist);100 ASSERT( !item.m_blacklist);84 ASSERT(item.m_whitelist.isEmpty()); 85 ASSERT(item.m_blacklist.isEmpty()); 101 86 102 87 String source; … … 110 95 item.m_url = WebURL::create(url); 111 96 112 Vector<RefPtr<APIObject> > whitelist; 113 if (!decodeStringArray(decoder, whitelist)) 97 if (!decoder->decode(item.m_whitelist)) 114 98 return false; 115 item.m_whitelist = ImmutableArray::adopt(whitelist); 116 117 Vector<RefPtr<APIObject> > blacklist; 118 if (!decodeStringArray(decoder, blacklist)) 99 if (!decoder->decode(item.m_blacklist)) 119 100 return false; 120 item.m_blacklist = ImmutableArray::adopt(blacklist);121 101 122 102 uint32_t injectedFrames; … … 131 111 132 112 return true; 133 }134 135 static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* array)136 {137 if (!array)138 return nullptr;139 140 size_t size = array->size();141 if (!size)142 return nullptr;143 144 OwnPtr<Vector<String> > stringVector = adoptPtr(new Vector<String>());145 stringVector->reserveInitialCapacity(size);146 for (size_t i = 0; i < size; ++i) {147 WebString* webString = array->at<WebString>(i);148 ASSERT(webString);149 stringVector->uncheckedAppend(webString->string());150 }151 152 return stringVector.release();153 }154 155 PassOwnPtr<Vector<String> > UserContentContainer::Item::whitelist() const156 {157 return toStringVector(m_whitelist.get());158 }159 160 PassOwnPtr<Vector<String> > UserContentContainer::Item::blacklist() const161 {162 return toStringVector(m_blacklist.get());163 113 } 164 114 -
trunk/Source/WebKit2/Shared/UserContentContainer.h
r130948 r131275 32 32 #include <WebCore/KURL.h> 33 33 #include <wtf/RefPtr.h> 34 #include <wtf/Vector.h> 34 35 35 36 namespace CoreIPC { … … 62 63 const String& source() const { return m_source->string(); } 63 64 WebCore::KURL url() const { return !m_url || m_url->string().isEmpty() ? WebCore::blankURL() : WebCore::KURL(WebCore::KURL(), m_url->string()); } 64 PassOwnPtr<Vector<String> > whitelist() const;65 PassOwnPtr<Vector<String> > blacklist() const;65 const Vector<String>& whitelist() const { return m_whitelist; } 66 const Vector<String>& blacklist() const { return m_blacklist; } 66 67 InjectedFrames injectedFrames() const { return m_injectedFrames; } 67 68 Type type() const { return m_type; } … … 70 71 RefPtr<WebString> m_source; 71 72 RefPtr<WebURL> m_url; 72 RefPtr<ImmutableArray> m_whitelist;73 RefPtr<ImmutableArray> m_blacklist;73 Vector<String> m_whitelist; 74 Vector<String> m_blacklist; 74 75 InjectedFrames m_injectedFrames; 75 76 Type m_type; -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
r131151 r131275 427 427 } 428 428 429 static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns) 430 { 429 static Vector<String> toStringVector(ImmutableArray* patterns) 430 { 431 Vector<String> patternsVector; 432 431 433 if (!patterns) 432 return nullptr;433 434 size_t size = 434 return patternsVector; 435 436 size_t size = patterns->size(); 435 437 if (!size) 436 return nullptr; 437 438 OwnPtr<Vector<String> > patternsVector = adoptPtr(new Vector<String>); 439 patternsVector->reserveInitialCapacity(size); 438 return patternsVector; 439 440 patternsVector.reserveInitialCapacity(size); 440 441 for (size_t i = 0; i < size; ++i) { 441 442 WebString* entry = patterns->at<WebString>(i); 442 443 if (entry) 443 patternsVector ->uncheckedAppend(entry->string());444 patternsVector.uncheckedAppend(entry->string()); 444 445 } 445 return patternsVector .release();446 return patternsVector; 446 447 } 447 448 -
trunk/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
r130216 r131275 424 424 pageGroup->removeUserScriptsFromWorld(mainThreadNormalWorld()); 425 425 for (unsigned i = 0; i < scripts.size(); ++i) 426 pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), nullptr, nullptr, InjectAtDocumentEnd, InjectInTopFrameOnly);426 pageGroup->addUserScriptToWorld(mainThreadNormalWorld(), scripts.at(i), KURL(), Vector<String>(), Vector<String>(), InjectAtDocumentEnd, InjectInTopFrameOnly); 427 427 } 428 428
Note:
See TracChangeset
for help on using the changeset viewer.