[Webkit-unassigned] [Bug 46091] Add WebKit2 API to load a string as plain text
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Sep 20 08:03:13 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=46091
Adam Roben (aroben) <aroben at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #68083|review? |review+
Flag| |
--- Comment #2 from Adam Roben (aroben) <aroben at apple.com> 2010-09-20 08:03:13 PST ---
(From update of attachment 68083)
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?
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list