commit | 897cd2c92ed023e4d44358b76d1b1b3773763951 | [log] [tgz] |
---|---|---|
author | beidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Aug 25 22:08:51 2020 +0000 |
committer | beidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Tue Aug 25 22:08:51 2020 +0000 |
tree | b2f6820a2cc0375ed86a25e7d7a149038f9bcf73 | |
parent | 34f85127ce1514f7ac6a7cd18840f4559970304d [diff] |
Font loads quickly followed by navigations may fail indefinitely <rdar://problem/65560550> and https://bugs.webkit.org/show_bug.cgi?id=215435 Reviewed by Myles C. Maxfield. Source/WebCore: Second take at this. Myles took the first swipe at this, but a conflict with SuspendableTimer caused issues in the form of layout test asserts with http/tests/security/navigate-when-restoring-cached-page.html His original ChangeLog entry: Font loads are coalesced using a zero-delay timer. However, that zero-delay timer can fire while the page is in the middle of a navigation, which will cause the font loads to fail. Then, the second page can request those same fonts, which are marked as failed, and as such will never actually load/use the desired web font. This patch just stops the zero-delay timer during navigations, and resumes it when resuming the document. This means: 1. The second page in the above story will not see that the font has failed, or even started, and will then re-request the font and load it successfully 2. If the user goes "back" to the previous page, the zero-delay timer is restarted, the CachedFont realizes it's already succeeded, and the previous page is rendered as expected. Test: fast/loader/font-load-timer.html --- Now the explanation of the failure it caused: The font loading timer was a SuspendableTimer, which is an ActiveDOMObject. An ActiveDOMObject was used to make sure the delayed font loads play well with the page cache, which is still necessary. But we also still need to suspend the timer manually when "stopLoading()" is called, which doesn't play well with ActiveDOMObject's automatic suspend/resume. My solution: - Make the timer "just a normal timer" - Make CSSFontSelector itself the ActiveDOMObject - Let DocumentLoader explicitly pause the font load timer - Rely on ActiveDOMObject to resume the timer These keep the bug fixed and resolve the layout test ASSERT seen with http/tests/security/navigate-when-restoring-cached-page.html * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::CSSFontSelector): (WebCore::CSSFontSelector::clearDocument): (WebCore::CSSFontSelector::beginLoadingFontSoon): (WebCore::CSSFontSelector::suspendFontLoadingTimer): (WebCore::CSSFontSelector::fontLoadingTimerFired): (WebCore::CSSFontSelector::stop): (WebCore::CSSFontSelector::suspend): (WebCore::CSSFontSelector::resume): (WebCore::CSSFontSelector::beginLoadTimerFired): Deleted. * css/CSSFontSelector.h: * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::stopLoading): LayoutTests: 1) The page has some content that has “font-family: WebFont” but there are no @font-face blocks on the page 2) In script, after the page has loaded, add an @font-face rule to the page with “font-family: WebFont” and some valid font URL 3) Synchronously, within the same turn of the run loop, trigger a synchronous layout of the element (using offsetWidth or something). This will add the font to the 0-delay time work list. 4) Synchronously, within the same turn of the run loop, navigate to a second page that doesn’t use the web font. 5) The second page waits some small-but-positive amount of time. This will cause the 0-delay timer to fire, but because the page is in the middle of navigating, the font load should fail. 6) The second page adds the same @font-face rule to itself using script. This should pull the same (failed) CachedResource object out of the memory cache. 7) Use the CSS Font Loading API to wait for the font load to complete 8) Make sure that the font is used on the second page (as a reference test). Today, the second page’s font load will fail because it pulled the failed font out of the memory cache. The test makes sure the second page’s font load succeeds. * fast/loader/font-load-timer-expected.html: Added. * fast/loader/font-load-timer.html: Added. * fast/loader/resources/font-load-timer-navigation-destination.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@266148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
or
git clone https://git.webkit.org/git/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.