Ignore:
Timestamp:
Mar 4, 2016, 10:30:52 AM (9 years ago)
Author:
[email protected]
Message:

[iOS] Crash during font loading when injected bundle cancels load
https://bugs.webkit.org/show_bug.cgi?id=155001

Reviewed by Tim Horton.

Source/WebCore:

If a injected bundle cancels the load, the fontLoaded() callback will be
called twice. We can simply detect this condition.

Test: CancelLoading.CancelFontSubresource API test

  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::fontLoaded):

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/Ahem.ttf: Added.
  • TestWebKitAPI/Tests/WebKit2/webfont.html: Added.
  • TestWebKitAPI/Tests/WebKit2Cocoa/CancelFontSubresource.mm: Added.

(-[Myles webView:didFinishNavigation:]):
(TEST):

  • TestWebKitAPI/Tests/WebKit2Cocoa/CancelFontSubresourcePlugIn.mm: Added.

(-[CancelFontSubresourcePlugIn webProcessPlugIn:didCreateBrowserContextController:]):
(-[CancelFontSubresourcePlugIn webProcessPlugInBrowserContextController:frame:willSendRequestForResource:request:redirectResponse:]):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSFontFaceSource.cpp

    r196969 r197570  
    111111    if (m_status == Status::Pending)
    112112        setStatus(Status::Loading);
     113    else if (m_status == Status::Failure) {
     114        // This function may be called twice if loading was cancelled.
     115        ASSERT(m_font->errorOccurred());
     116        return;
     117    }
    113118
    114119    if (m_font->errorOccurred())
Note: See TracChangeset for help on using the changeset viewer.