Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bfd32ef

Browse filesBrowse files
WebKit Review Botwebkit-commit-queue
authored andcommitted
Unreviewed, rolling out r128809.
http://trac.webkit.org/changeset/128809 https://bugs.webkit.org/show_bug.cgi?id=96958 Broke the Windows build. (Requested by andersca on #webkit). Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-17 Source/WebCore: * platform/win/BString.cpp: (WebCore::BString::~BString): (WebCore::BString::adoptBSTR): * platform/win/BString.h: (BString): Source/WebKit/win: * DefaultPolicyDelegate.cpp: (DefaultPolicyDelegate::decidePolicyForNavigationAction): (DefaultPolicyDelegate::decidePolicyForMIMEType): (DefaultPolicyDelegate::unableToImplementPolicyWithError): * MarshallingHelpers.cpp: (MarshallingHelpers::KURLToBSTR): (MarshallingHelpers::CFStringRefToBSTR): (MarshallingHelpers::stringArrayToSafeArray): (MarshallingHelpers::safeArrayToStringArray): * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::runJavaScriptPrompt): * WebCoreSupport/WebEditorClient.cpp: (WebEditorClient::checkGrammarOfString): (WebEditorClient::getGuessesForWord): * WebFrame.cpp: (WebFrame::canProvideDocumentSource): * WebHistory.cpp: (WebHistory::removeItem): (WebHistory::addItem): * WebIconDatabase.cpp: (WebIconDatabase::startUpIconDatabase): * WebNotificationCenter.cpp: (WebNotificationCenter::postNotification): * WebPreferences.cpp: (WebPreferences::setStringValue): * WebView.cpp: (PreferencesChangedOrRemovedObserver::onNotify): (WebView::close): (WebView::canShowMIMEType): (WebView::initWithFrame): (WebView::setApplicationNameForUserAgent): (WebView::setCustomUserAgent): (WebView::userAgentForURL): (WebView::setCustomTextEncodingName): (WebView::customTextEncodingName): (WebView::setPreferences): (WebView::searchFor): (WebView::executeCoreCommandByName): (WebView::markAllMatchesForText): (WebView::setGroupName): (WebView::registerURLSchemeAsLocal): (WebView::replaceSelectionWithText): (WebView::onNotify): (WebView::notifyPreferencesChanged): (WebView::MIMETypeForExtension): (WebView::standardUserAgentWithApplicationName): (WebView::addAdditionalPluginDirectory): (WebView::registerEmbeddedViewMIMEType): (toString): (toKURL): (WebView::addOriginAccessWhitelistEntry): (WebView::removeOriginAccessWhitelistEntry): (WebView::geolocationDidFailWithError): (WebView::setDomainRelaxationForbiddenForURLScheme): (WebView::setCompositionForTesting): (WebView::confirmCompositionForTesting): Canonical link: https://commits.webkit.org/114879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent a6d4cd1 commit bfd32ef
Copy full SHA for bfd32ef

14 files changed

+232-116Lines changed: 232 additions & 116 deletions
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Source/WebCore/ChangeLog‎

Copy file name to clipboardExpand all lines: Source/WebCore/ChangeLog
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2012-09-17 Sheriff Bot <webkit.review.bot@gmail.com>
2+
3+
Unreviewed, rolling out r128809.
4+
http://trac.webkit.org/changeset/128809
5+
https://bugs.webkit.org/show_bug.cgi?id=96958
6+
7+
Broke the Windows build. (Requested by andersca on #webkit).
8+
9+
* platform/win/BString.cpp:
10+
(WebCore::BString::~BString):
11+
(WebCore::BString::adoptBSTR):
12+
* platform/win/BString.h:
13+
(BString):
14+
115
2012-09-17 Patrick Gansterer <paroga@webkit.org>
216

317
[WIN] Use BString in favour of BSTR to improve memory management
Collapse file

‎Source/WebCore/platform/win/BString.cpp‎

Copy file name to clipboardExpand all lines: Source/WebCore/platform/win/BString.cpp
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ BString::BString(CFStringRef cfstr)
106106

107107
BString::~BString()
108108
{
109-
clear();
109+
SysFreeString(m_bstr);
110110
}
111111

112112
BString::BString(const BString& other)
@@ -119,15 +119,11 @@ BString::BString(const BString& other)
119119

120120
void BString::adoptBSTR(BSTR bstr)
121121
{
122-
clear();
122+
if (m_bstr)
123+
SysFreeString(m_bstr);
123124
m_bstr = bstr;
124125
}
125126

126-
void BString::clear()
127-
{
128-
SysFreeString(m_bstr);
129-
}
130-
131127
BString& BString::operator=(const BString& other)
132128
{
133129
if (this != &other)
Collapse file

‎Source/WebCore/platform/win/BString.h‎

Copy file name to clipboardExpand all lines: Source/WebCore/platform/win/BString.h
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ namespace WebCore {
5252
~BString();
5353

5454
void adoptBSTR(BSTR);
55-
void clear();
5655

5756
BString(const BString&);
5857
BString& operator=(const BString&);
5958
BString& operator=(const BSTR&);
6059

61-
BSTR* operator&() { ASSERT(!m_bstr); return &m_bstr; }
6260
operator BSTR() const { return m_bstr; }
6361

6462
BSTR release() { BSTR result = m_bstr; m_bstr = 0; return result; }
Collapse file

‎Source/WebKit/win/ChangeLog‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/ChangeLog
+65Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1+
2012-09-17 Sheriff Bot <webkit.review.bot@gmail.com>
2+
3+
Unreviewed, rolling out r128809.
4+
http://trac.webkit.org/changeset/128809
5+
https://bugs.webkit.org/show_bug.cgi?id=96958
6+
7+
Broke the Windows build. (Requested by andersca on #webkit).
8+
9+
* DefaultPolicyDelegate.cpp:
10+
(DefaultPolicyDelegate::decidePolicyForNavigationAction):
11+
(DefaultPolicyDelegate::decidePolicyForMIMEType):
12+
(DefaultPolicyDelegate::unableToImplementPolicyWithError):
13+
* MarshallingHelpers.cpp:
14+
(MarshallingHelpers::KURLToBSTR):
15+
(MarshallingHelpers::CFStringRefToBSTR):
16+
(MarshallingHelpers::stringArrayToSafeArray):
17+
(MarshallingHelpers::safeArrayToStringArray):
18+
* WebCoreSupport/WebChromeClient.cpp:
19+
(WebChromeClient::runJavaScriptPrompt):
20+
* WebCoreSupport/WebEditorClient.cpp:
21+
(WebEditorClient::checkGrammarOfString):
22+
(WebEditorClient::getGuessesForWord):
23+
* WebFrame.cpp:
24+
(WebFrame::canProvideDocumentSource):
25+
* WebHistory.cpp:
26+
(WebHistory::removeItem):
27+
(WebHistory::addItem):
28+
* WebIconDatabase.cpp:
29+
(WebIconDatabase::startUpIconDatabase):
30+
* WebNotificationCenter.cpp:
31+
(WebNotificationCenter::postNotification):
32+
* WebPreferences.cpp:
33+
(WebPreferences::setStringValue):
34+
* WebView.cpp:
35+
(PreferencesChangedOrRemovedObserver::onNotify):
36+
(WebView::close):
37+
(WebView::canShowMIMEType):
38+
(WebView::initWithFrame):
39+
(WebView::setApplicationNameForUserAgent):
40+
(WebView::setCustomUserAgent):
41+
(WebView::userAgentForURL):
42+
(WebView::setCustomTextEncodingName):
43+
(WebView::customTextEncodingName):
44+
(WebView::setPreferences):
45+
(WebView::searchFor):
46+
(WebView::executeCoreCommandByName):
47+
(WebView::markAllMatchesForText):
48+
(WebView::setGroupName):
49+
(WebView::registerURLSchemeAsLocal):
50+
(WebView::replaceSelectionWithText):
51+
(WebView::onNotify):
52+
(WebView::notifyPreferencesChanged):
53+
(WebView::MIMETypeForExtension):
54+
(WebView::standardUserAgentWithApplicationName):
55+
(WebView::addAdditionalPluginDirectory):
56+
(WebView::registerEmbeddedViewMIMEType):
57+
(toString):
58+
(toKURL):
59+
(WebView::addOriginAccessWhitelistEntry):
60+
(WebView::removeOriginAccessWhitelistEntry):
61+
(WebView::geolocationDidFailWithError):
62+
(WebView::setDomainRelaxationForbiddenForURLScheme):
63+
(WebView::setCompositionForTesting):
64+
(WebView::confirmCompositionForTesting):
65+
166
2012-09-16 Mark Lam <mark.lam@apple.com>
267

368
Added MSVC project changes to enable building the llint.
Collapse file

‎Source/WebKit/win/DefaultPolicyDelegate.cpp‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/DefaultPolicyDelegate.cpp
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "WebKitDLL.h"
2828
#include "DefaultPolicyDelegate.h"
2929

30-
#include <WebCore/BString.h>
3130
#include <WebCore/COMPtr.h>
3231
#include <wtf/text/WTFString.h>
3332

@@ -117,14 +116,15 @@ HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::decidePolicyForNavigationAction
117116
else if (navType == WebNavigationTypePlugInRequest)
118117
listener->use();
119118
else {
120-
BString url;
119+
BSTR url;
121120
// A file URL shouldn't fall through to here, but if it did,
122121
// it would be a security risk to open it.
123122
if (SUCCEEDED(request->URL(&url)) && !String(url, SysStringLen(url)).startsWith("file:")) {
124123
// FIXME: Open the URL not by means of a webframe, but by handing it over to the system and letting it determine how to open that particular URL scheme. See documentation for [NSWorkspace openURL]
125124
;
126125
}
127126
listener->ignore();
127+
SysFreeString(url);
128128
}
129129
}
130130
return S_OK;
@@ -152,7 +152,7 @@ HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::decidePolicyForMIMEType(
152152
if (FAILED(webView->canShowMIMEType(type, &canShowMIMEType)))
153153
canShowMIMEType = FALSE;
154154

155-
BString url;
155+
BSTR url;
156156
request->URL(&url);
157157

158158
if (String(url, SysStringLen(url)).startsWith("file:")) {
@@ -171,6 +171,7 @@ HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::decidePolicyForMIMEType(
171171
listener->use();
172172
else
173173
listener->ignore();
174+
SysFreeString(url);
174175
return S_OK;
175176
}
176177

@@ -179,13 +180,15 @@ HRESULT STDMETHODCALLTYPE DefaultPolicyDelegate::unableToImplementPolicyWithErro
179180
/*[in]*/ IWebError* error,
180181
/*[in]*/ IWebFrame* frame)
181182
{
182-
BString errorStr;
183+
BSTR errorStr;
183184
error->localizedDescription(&errorStr);
184185

185-
BString frameName;
186+
BSTR frameName;
186187
frame->name(&frameName);
187188

188189
LOG_ERROR("called unableToImplementPolicyWithError:%S inFrame:%S", errorStr ? errorStr : TEXT(""), frameName ? frameName : TEXT(""));
190+
SysFreeString(errorStr);
191+
SysFreeString(frameName);
189192

190193
return S_OK;
191194
}
Collapse file

‎Source/WebKit/win/MarshallingHelpers.cpp‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/MarshallingHelpers.cpp
+20-6Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "WebKitDLL.h"
2828
#include "MarshallingHelpers.h"
2929

30-
#include <WebCore/BString.h>
3130
#include <WebCore/IntRect.h>
3231
#include <WebCore/KURL.h>
3332
#include <wtf/MathExtras.h>
@@ -47,7 +46,7 @@ KURL MarshallingHelpers::BSTRToKURL(BSTR urlStr)
4746

4847
BSTR MarshallingHelpers::KURLToBSTR(const KURL& url)
4948
{
50-
return BString(url.string()).release();
49+
return SysAllocStringLen(url.string().characters(), url.string().length());
5150
}
5251

5352
CFURLRef MarshallingHelpers::PathStringToFileCFURLRef(const String& string)
@@ -90,7 +89,20 @@ CFStringRef MarshallingHelpers::LPCOLESTRToCFStringRef(LPCOLESTR str)
9089

9190
BSTR MarshallingHelpers::CFStringRefToBSTR(CFStringRef str)
9291
{
93-
return BString(str).release();
92+
if (!str)
93+
return 0;
94+
95+
const UniChar* uniChars = CFStringGetCharactersPtr(str);
96+
if (uniChars)
97+
return SysAllocStringLen((LPCTSTR)uniChars, CFStringGetLength(str));
98+
99+
CFIndex length = CFStringGetLength(str);
100+
BSTR bstr = SysAllocStringLen(0, length);
101+
if (bstr) {
102+
CFStringGetCharacters(str, CFRangeMake(0, length), (UniChar*)bstr);
103+
bstr[length] = 0;
104+
}
105+
return bstr;
94106
}
95107

96108
int MarshallingHelpers::CFNumberRefToInt(CFNumberRef num)
@@ -147,8 +159,9 @@ SAFEARRAY* MarshallingHelpers::stringArrayToSafeArray(CFArrayRef inArray)
147159
long count = 0;
148160
for (CFIndex i=0; i<size; i++) {
149161
CFStringRef item = (CFStringRef) CFArrayGetValueAtIndex(inArray, i);
150-
BString bstr(item);
151-
::SafeArrayPutElement(sa, &count, bstr); // SafeArrayPutElement() copies the string correctly.
162+
BSTR bstr = CFStringRefToBSTR(item);
163+
::SafeArrayPutElement(sa, &count, bstr);
164+
SysFreeString(bstr); // SafeArrayPutElement() should make a copy of the string
152165
count++;
153166
}
154167
return sa;
@@ -219,9 +232,10 @@ CFArrayRef MarshallingHelpers::safeArrayToStringArray(SAFEARRAY* inArray)
219232
if (len > 0) {
220233
items = new CFStringRef[len];
221234
for (; lBound <= uBound; lBound++) {
222-
BString str;
235+
BSTR str;
223236
hr = ::SafeArrayGetElement(inArray, &lBound, &str);
224237
items[lBound] = BSTRToCFStringRef(str);
238+
SysFreeString(str);
225239
}
226240
}
227241
CFArrayRef result = CFArrayCreate(0, (const void**)items, len, &kCFTypeArrayCallBacks);
Collapse file

‎Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,15 +410,17 @@ bool WebChromeClient::runJavaScriptPrompt(Frame*, const String& message, const S
410410

411411
TimerBase::fireTimersInNestedEventLoop();
412412

413-
BString resultBSTR;
413+
BSTR resultBSTR = 0;
414414
if (FAILED(ui->runJavaScriptTextInputPanelWithPrompt(m_webView, BString(message), BString(defaultValue), &resultBSTR)))
415415
return false;
416416

417-
if (!resultBSTR)
418-
return false;
417+
if (resultBSTR) {
418+
result = String(resultBSTR, SysStringLen(resultBSTR));
419+
SysFreeString(resultBSTR);
420+
return true;
421+
}
419422

420-
result = String(resultBSTR, SysStringLen(resultBSTR));
421-
return true;
423+
return false;
422424
}
423425

424426
void WebChromeClient::setStatusbarText(const String& statusText)
Collapse file

‎Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,19 +695,21 @@ void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector
695695
continue;
696696
if (FAILED(detailObj->location(&detail.location)))
697697
continue;
698-
BString userDesc;
698+
BSTR userDesc;
699699
if (FAILED(detailObj->userDescription(&userDesc)))
700700
continue;
701701
detail.userDescription = String(userDesc, SysStringLen(userDesc));
702+
SysFreeString(userDesc);
702703

703704
COMPtr<IEnumSpellingGuesses> enumGuessesObj;
704705
if (FAILED(detailObj->guesses(&enumGuessesObj)))
705706
continue;
706707
while (true) {
707-
BString guess;
708+
BSTR guess;
708709
if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
709710
break;
710711
detail.guesses.append(String(guess, SysStringLen(guess)));
712+
SysFreeString(guess);
711713
}
712714

713715
details.append(detail);
@@ -776,10 +778,11 @@ void WebEditorClient::getGuessesForWord(const String& word, const String& contex
776778

777779
while (true) {
778780
ULONG fetched;
779-
BString guess;
781+
BSTR guess;
780782
if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
781783
break;
782784
guesses.append(String(guess, SysStringLen(guess)));
785+
SysFreeString(guess);
783786
}
784787
}
785788

Collapse file

‎Source/WebKit/win/WebFrame.cpp‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/WebFrame.cpp
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,10 +1442,11 @@ HRESULT WebFrame::canProvideDocumentSource(bool* result)
14421442
COMPtr<IWebURLResponse> urlResponse;
14431443
hr = dataSource->response(&urlResponse);
14441444
if (SUCCEEDED(hr) && urlResponse) {
1445-
BString mimeTypeBStr;
1445+
BSTR mimeTypeBStr;
14461446
if (SUCCEEDED(urlResponse->MIMEType(&mimeTypeBStr))) {
14471447
String mimeType(mimeTypeBStr, SysStringLen(mimeTypeBStr));
14481448
*result = mimeType == "text/html" || WebCore::DOMImplementation::isXMLMIMEType(mimeType);
1449+
SysFreeString(mimeTypeBStr);
14491450
}
14501451
}
14511452
return hr;
Collapse file

‎Source/WebKit/win/WebHistory.cpp‎

Copy file name to clipboardExpand all lines: Source/WebKit/win/WebHistory.cpp
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "WebNotificationCenter.h"
3737
#include "WebPreferences.h"
3838
#include <CoreFoundation/CoreFoundation.h>
39-
#include <WebCore/BString.h>
4039
#include <WebCore/HistoryItem.h>
4140
#include <WebCore/HistoryPropertyList.h>
4241
#include <WebCore/KURL.h>
@@ -613,13 +612,14 @@ HRESULT STDMETHODCALLTYPE WebHistory::historyAgeInDaysLimit(
613612
HRESULT WebHistory::removeItem(IWebHistoryItem* entry)
614613
{
615614
HRESULT hr = S_OK;
616-
BString urlBStr;
615+
BSTR urlBStr = 0;
617616

618617
hr = entry->URLString(&urlBStr);
619618
if (FAILED(hr))
620619
return hr;
621620

622621
RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
622+
SysFreeString(urlBStr);
623623

624624
// If this exact object isn't stored, then make no change.
625625
// FIXME: Is this the right behavior if this entry isn't present, but another entry for the same URL is?
@@ -646,12 +646,13 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry, bool discardDuplicate, bool*
646646
if (!entry)
647647
return E_FAIL;
648648

649-
BString urlBStr;
649+
BSTR urlBStr = 0;
650650
hr = entry->URLString(&urlBStr);
651651
if (FAILED(hr))
652652
return hr;
653653

654654
RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
655+
SysFreeString(urlBStr);
655656

656657
COMPtr<IWebHistoryItem> oldEntry((IWebHistoryItem*) CFDictionaryGetValue(
657658
m_entriesByURL.get(), urlString.get()));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.