Changeset 50906 in webkit
- Timestamp:
- Nov 12, 2009 2:40:38 PM (14 years ago)
- Location:
- trunk/WebKit/win
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/win/ChangeLog
r50856 r50906 1 2009-11-12 Adam Roben <aroben@apple.com> 2 3 Small clean-up in WebView's user content functions 4 5 Preparation for <http://webkit.org/b/31414> Implement new SPI for 6 dealing with user scripts/stylesheets and isolated worlds 7 8 Reviewed by Dave Hyatt. 9 10 * WebView.cpp: 11 (toString): 12 (toKURL): 13 Added these helper functions to convert BSTRs to WebCore types. 14 15 (toStringVector): 16 (WebView::addUserScriptToGroup): 17 (WebView::addUserStyleSheetToGroup): 18 (WebView::removeUserScriptFromGroup): 19 (WebView::removeUserStyleSheetFromGroup): 20 (WebView::removeUserScriptsFromGroup): 21 (WebView::removeUserStyleSheetsFromGroup): 22 (WebView::removeAllUserContentFromGroup): 23 Use the new helper functions. 24 1 25 2009-11-11 Beth Dakin <bdakin@apple.com> 2 26 -
trunk/WebKit/win/WebView.cpp
r50007 r50906 5470 5470 } 5471 5471 5472 static String toString(BSTR bstr) 5473 { 5474 return String(bstr, SysStringLen(bstr)); 5475 } 5476 5477 static KURL toKURL(BSTR bstr) 5478 { 5479 return KURL(KURL(), toString(bstr)); 5480 } 5481 5472 5482 static PassOwnPtr<Vector<String> > toStringVector(unsigned patternsCount, BSTR* patterns) 5473 5483 { … … 5477 5487 Vector<String>* patternsVector = new Vector<String>; 5478 5488 for (unsigned i = 0; i < patternsCount; ++i) 5479 patternsVector->append( String(patterns[i], SysStringLen(patterns[i])));5489 patternsVector->append(toString(patterns[i])); 5480 5490 return patternsVector; 5481 5491 } … … 5486 5496 WebUserScriptInjectionTime injectionTime) 5487 5497 { 5488 String group (groupName, SysStringLen(groupName));5498 String group = toString(groupName); 5489 5499 if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) 5490 5500 return E_INVALIDARG; … … 5495 5505 return E_FAIL; 5496 5506 5497 pageGroup->addUserScriptToWorld(worldID, String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))),5507 pageGroup->addUserScriptToWorld(worldID, toString(source), toKURL(url), 5498 5508 toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist), 5499 5509 injectionTime == WebInjectAtDocumentStart ? InjectAtDocumentStart : InjectAtDocumentEnd); … … 5506 5516 unsigned blacklistCount, BSTR* blacklist) 5507 5517 { 5508 String group (groupName, SysStringLen(groupName));5518 String group = toString(groupName); 5509 5519 if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) 5510 5520 return E_INVALIDARG; … … 5515 5525 return E_FAIL; 5516 5526 5517 pageGroup->addUserStyleSheetToWorld(worldID, String(source, SysStringLen(source)), KURL(KURL(), String(url, SysStringLen(url))),5527 pageGroup->addUserStyleSheetToWorld(worldID, toString(source), toKURL(url), 5518 5528 toStringVector(whitelistCount, whitelist), toStringVector(blacklistCount, blacklist)); 5519 5529 … … 5523 5533 HRESULT WebView::removeUserScriptFromGroup(BSTR groupName, unsigned worldID, BSTR url) 5524 5534 { 5525 String group (groupName, SysStringLen(groupName));5535 String group = toString(groupName); 5526 5536 if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) 5527 5537 return E_INVALIDARG; … … 5532 5542 return E_FAIL; 5533 5543 5534 pageGroup->removeUserScriptFromWorld(worldID, KURL(KURL(), String(url, SysStringLen(url))));5544 pageGroup->removeUserScriptFromWorld(worldID, toKURL(url)); 5535 5545 5536 5546 return S_OK; … … 5539 5549 HRESULT WebView::removeUserStyleSheetFromGroup(BSTR groupName, unsigned worldID, BSTR url) 5540 5550 { 5541 String group (groupName, SysStringLen(groupName));5551 String group = toString(groupName); 5542 5552 if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) 5543 5553 return E_INVALIDARG; … … 5548 5558 return E_FAIL; 5549 5559 5550 pageGroup->removeUserStyleSheetFromWorld(worldID, KURL(KURL(), String(url, SysStringLen(url))));5560 pageGroup->removeUserStyleSheetFromWorld(worldID, toKURL(url)); 5551 5561 5552 5562 return S_OK; … … 5555 5565 HRESULT WebView::removeUserScriptsFromGroup(BSTR groupName, unsigned worldID) 5556 5566 { 5557 String group (groupName, SysStringLen(groupName));5567 String group = toString(groupName); 5558 5568 if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) 5559 5569 return E_INVALIDARG; … … 5570 5580 HRESULT WebView::removeUserStyleSheetsFromGroup(BSTR groupName, unsigned worldID) 5571 5581 { 5572 String group (groupName, SysStringLen(groupName));5582 String group = toString(groupName); 5573 5583 if (group.isEmpty() || !worldID || worldID == numeric_limits<unsigned>::max()) 5574 5584 return E_INVALIDARG; … … 5585 5595 HRESULT WebView::removeAllUserContentFromGroup(BSTR groupName) 5586 5596 { 5587 String group (groupName, SysStringLen(groupName));5597 String group = toString(groupName); 5588 5598 if (group.isEmpty()) 5589 5599 return E_INVALIDARG;
Note: See TracChangeset
for help on using the changeset viewer.