[webkit-reviews] review granted: [Bug 46091] Add WebKit2 API to load a string as plain text : [Attachment 68083] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Sep 20 08:03:12 PDT 2010
Adam Roben (aroben) <aroben at apple.com> has granted Sam Weinig
<sam at webkit.org>'s request for review:
Bug 46091: Add WebKit2 API to load a string as plain text
https://bugs.webkit.org/show_bug.cgi?id=46091
Attachment 68083: Patch
https://bugs.webkit.org/attachment.cgi?id=68083&action=review
------- Additional Comments from Adam Roben (aroben) <aroben at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=68083&action=review
> WebKit2/WebProcess/WebPage/WebPage.cpp:257
> +void WebPage::commonLoadData(PassRefPtr<SharedBuffer> sharedBuffer, const
String& MIMEType, const String& encodingName, const KURL& baseURL, const KURL&
failingURL)
> +{
> + ResourceRequest request(baseURL);
> + SubstituteData substituteData(sharedBuffer, MIMEType, encodingName,
failingURL);
> + m_mainFrame->coreFrame()->loader()->load(request, substituteData,
false);
> +}
I don't think there's any need for "common" in this function name.
> WebKit2/WebProcess/WebPage/WebPage.cpp:270
> void WebPage::loadHTMLString(const String& htmlString, const String&
baseURLString)
> {
> RefPtr<SharedBuffer> sharedBuffer =
SharedBuffer::create(reinterpret_cast<const char*>(htmlString.characters()),
htmlString.length() * sizeof(UChar));
> - String MIMEType("text/html");
> - String encodingName("utf-16");
> KURL baseURL = baseURLString.isEmpty() ? blankURL() : KURL(KURL(),
baseURLString);
> - KURL failingURL;
> -
> - ResourceRequest request(baseURL);
> - SubstituteData substituteData(sharedBuffer.release(), MIMEType,
encodingName, failingURL);
> + commonLoadData(sharedBuffer, "text/html", "utf-16", baseURL, KURL());
> +}
>
> - m_mainFrame->coreFrame()->loader()->load(request, substituteData,
false);
> +void WebPage::loadPlainTextString(const String& string)
> +{
> + RefPtr<SharedBuffer> sharedBuffer =
SharedBuffer::create(reinterpret_cast<const char*>(string.characters()),
string.length() * sizeof(UChar));
> + commonLoadData(sharedBuffer, "text/plain", "utf-16", blankURL(),
KURL());
> }
Neither of these functions seems prepared to handle sharedBuffer outliving the
string it's constructed from. Is that a problem?
More information about the webkit-reviews
mailing list