WebKit-https.git
15 months agoUnreviewed, rolling out r233112.
commit-queue@webkit.org [Tue, 3 Jul 2018 20:50:04 +0000 (20:50 +0000)]
Unreviewed, rolling out r233112.
https://bugs.webkit.org/show_bug.cgi?id=187300

this revision is causing crashes on iOS 11 simulator
(Requested by Truitt on #webkit).

Reverted changeset:

"[Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit
fullscreen handler after r231924"
https://bugs.webkit.org/show_bug.cgi?id=186945
https://trac.webkit.org/changeset/233112

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233476 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoImplement support for Element.toggleAttribute
cdumez@apple.com [Tue, 3 Jul 2018 20:46:38 +0000 (20:46 +0000)]
Implement support for Element.toggleAttribute
https://bugs.webkit.org/show_bug.cgi?id=186883

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Import WPT test coverage from:
https://github.com/web-platform-tests/wpt/commit/c3db018b96681af3c73ec331ecc01d38e48b8b10

* web-platform-tests/dom/nodes/attributes-expected.txt:
* web-platform-tests/dom/nodes/attributes.html:

Source/WebCore:

Implement support for Element.toggleAttribute as per:
- https://github.com/whatwg/dom/issues/461
- https://dom.spec.whatwg.org/#dom-element-toggleattribute

This was already implemented in Blink:
- https://bugs.chromium.org/p/chromium/issues/detail?id=854960

Edge expressed public support:
- https://github.com/whatwg/dom/issues/461#issuecomment-398206390

Gecko is working on it:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1469592

* dom/Element.cpp:
(WebCore::Element::toggleAttribute):
* dom/Element.h:
* dom/Element.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233475 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agocheck-webkit-style: Run the tool without SVN client.
Basuke.Suzuki@sony.com [Tue, 3 Jul 2018 20:44:59 +0000 (20:44 +0000)]
check-webkit-style: Run the tool without SVN client.
https://bugs.webkit.org/show_bug.cgi?id=187294

Reviewed by Daniel Bates.

When invoking check-webkit-style without SVN client, the exception was raised and terminated.
Using Git repository is acceptable workflow according to the wording on:
<https://webkit.org/getting-the-code/#checking-out-with-git>
and using Subversion is considered optional by following link:
<https://webkit.org/webkit-on-windows/#installing-developer-tools>.
This patch makes it so that people with only a Git checkout of WebKit that commit using
the commit-queue (or another machine with an SVN checkout) can run check-webkit-style.

* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN.in_working_directory):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233474 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[32-bit JSC tests] ASSERTION FAILED: !getDirect(offset) || !JSValue::encode(getDirect...
mark.lam@apple.com [Tue, 3 Jul 2018 19:25:54 +0000 (19:25 +0000)]
[32-bit JSC tests] ASSERTION FAILED: !getDirect(offset) || !JSValue::encode(getDirect(offset)).
https://bugs.webkit.org/show_bug.cgi?id=187255
<rdar://problem/41785257>

Reviewed by Saam Barati.

The 32-bit JIT::emit_op_create_this() needs to initialize uninitialized properties
too: basically, do what the 64-bit code is doing.  At present, this change only
serves to pacify an assertion.  It is not needed for correctness because the
concurrent GC is not used on 32-bit builds.

This issue is already covered by the slowMicrobenchmarks/rest-parameter-allocation-elimination.js
test.

* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_create_this):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoRemove old JSCTestsFactory
aakash_jain@apple.com [Tue, 3 Jul 2018 19:12:14 +0000 (19:12 +0000)]
Remove old JSCTestsFactory

Follow-up fix to r233471.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233472 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[ews-build] Add support for JSC-Tests-EWS
aakash_jain@apple.com [Tue, 3 Jul 2018 18:59:28 +0000 (18:59 +0000)]
[ews-build] Add support for JSC-Tests-EWS
https://bugs.webkit.org/show_bug.cgi?id=187201

Reviewed by Lucas Forschler.

* BuildSlaveSupport/ews-build/factories.py:
(JSCTestsFactory): Added JSCTestsFactory.
* BuildSlaveSupport/ews-build/steps.py:
(CompileJSCOnly): Command to compile JSC.
* BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-tests.
* BuildSlaveSupport/ews-build/config.json: Changed platform to jsc-only. This matches with build.webkit.org configuration.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233471 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[LFC] Add test-list file for regression testing
zalan@apple.com [Tue, 3 Jul 2018 18:51:33 +0000 (18:51 +0000)]
[LFC] Add test-list file for regression testing
https://bugs.webkit.org/show_bug.cgi?id=187296

Reviewed by Antti Koivisto.

run-webkit-tests --test-list=./Tools/LayoutReloaded/misc/LFC-passing-tests.txt

* LayoutReloaded/misc/LFC-passing-tests.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233470 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[LFC] Implement minimum/maximum content width logic.
zalan@apple.com [Tue, 3 Jul 2018 18:29:35 +0000 (18:29 +0000)]
[LFC] Implement minimum/maximum content width logic.
https://bugs.webkit.org/show_bug.cgi?id=187241

Reviewed by Antti Koivisto.

Compute the minimum/maximum content width if needed and cache the values on the formatting state.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
(WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
* layout/FormattingContext.h:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
(WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
(WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
(WebCore::Layout::shrinkToFitWidth): Deleted.
* layout/FormattingState.cpp:
(WebCore::Layout::FormattingState::FormattingState):
* layout/FormattingState.h:
(WebCore::Layout::FormattingState::setMinimumMaximumContentWidth):
(WebCore::Layout::FormattingState::clearMinimumMaximumContentWidth):
(WebCore::Layout::FormattingState::minimumMaximumContentWidth const):
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::establishedFormattingState):
* layout/LayoutContext.h:
* layout/Verification.cpp:
(WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::createFormattingState const):
(WebCore::Layout::BlockFormattingContext::minimumMaximumContentWidth const):
* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidthNeedsChildrenWidth):
(WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidth):
* layout/blockformatting/BlockFormattingState.cpp:
(WebCore::Layout::BlockFormattingState::BlockFormattingState):
* layout/blockformatting/BlockFormattingState.h:
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::createFormattingState const):
(WebCore::Layout::InlineFormattingContext::minimumMaximumContentWidth const):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingState.cpp:
(WebCore::Layout::InlineFormattingState::InlineFormattingState):
* layout/inlineformatting/InlineFormattingState.h:
* page/FrameViewLayoutContext.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233469 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoResource Load Statistics: Make WebsiteDataStore::getAllStorageAccessEntries() call...
wilander@apple.com [Tue, 3 Jul 2018 18:25:36 +0000 (18:25 +0000)]
Resource Load Statistics: Make WebsiteDataStore::getAllStorageAccessEntries() call the right network process instead of iterating over the process pools
https://bugs.webkit.org/show_bug.cgi?id=187277
<rdar://problem/41745510>

Reviewed by Chris Dumez.

Source/WebKit:

Existing tests use this code. The change is for correctness.

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _getAllStorageAccessEntriesFor:completionHandler:]):
    Now receives a WKWebView from its caller and gets the page ID from it.
(-[WKWebsiteDataStore _getAllStorageAccessEntries:]): Deleted.
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getAllStorageAccessEntries):
    Now gets a page ID from its caller and gets the right network process
    through it.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::getAllStorageAccessEntries):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233468 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[JSC] Move slowDownAndWasteMemory function to JSArrayBufferView
utatane.tea@gmail.com [Tue, 3 Jul 2018 17:50:12 +0000 (17:50 +0000)]
[JSC] Move slowDownAndWasteMemory function to JSArrayBufferView
https://bugs.webkit.org/show_bug.cgi?id=187290

Reviewed by Saam Barati.

slowDownAndWasteMemory is just overridden by typed arrays. Since they are limited,
we do not need to add this function to MethodTable: just dispatching it in JSArrayBufferView
is fine. And slowDownAndWasteMemory only requires the sizeof(element), which can be
easily calculated from JSType.
This patch removes slowDownAndWasteMemory from MethodTable, and moves it to JSArrayBufferView.

* runtime/ClassInfo.h:
* runtime/JSArrayBufferView.cpp:
(JSC::elementSize):
(JSC::JSArrayBufferView::slowDownAndWasteMemory):
* runtime/JSArrayBufferView.h:
* runtime/JSArrayBufferViewInlines.h:
(JSC::JSArrayBufferView::possiblySharedBuffer):
* runtime/JSCell.cpp:
(JSC::JSCell::slowDownAndWasteMemory): Deleted.
* runtime/JSCell.h:
* runtime/JSDataView.cpp:
(JSC::JSDataView::slowDownAndWasteMemory): Deleted.
* runtime/JSDataView.h:
* runtime/JSGenericTypedArrayView.h:
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::slowDownAndWasteMemory): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233467 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed, rolling out r233461.
jbedard@apple.com [Tue, 3 Jul 2018 16:50:57 +0000 (16:50 +0000)]
Unreviewed, rolling out r233461.

Assertions triggered during iOS 11 debug layout and API tests

Reverted changeset:

"[iOS] Add assert to catch improper use of WebCore::Timer in
UI Process"
https://bugs.webkit.org/show_bug.cgi?id=185330
https://trac.webkit.org/changeset/233461

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233466 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUpdate com.cmbchina.CMBSecurity.sb to make it functional
youenn@apple.com [Tue, 3 Jul 2018 16:20:00 +0000 (16:20 +0000)]
Update com.cmbchina.CMBSecurity.sb to make it functional
https://bugs.webkit.org/show_bug.cgi?id=187278

Reviewed by Brent Fulgham.

* Resources/PlugInSandboxProfiles/com.cmbchina.CMBSecurity.sb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233465 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUpdate Fullscreen anti-phishing alert text
jer.noble@apple.com [Tue, 3 Jul 2018 16:15:55 +0000 (16:15 +0000)]
Update Fullscreen anti-phishing alert text
https://bugs.webkit.org/show_bug.cgi?id=187199
<rdar://problem/41162543>

Reviewed by Brent Fulgham.

Source/WebCore:

* English.lproj/Localizable.strings:

Source/WebKit:

* UIProcess/ios/fullscreen/WKFullScreenViewController.mm:
(-[WKFullScreenViewController _showPhishingAlert]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233464 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoImport WPT infrastructure tests
commit-queue@webkit.org [Tue, 3 Jul 2018 15:21:07 +0000 (15:21 +0000)]
Import WPT infrastructure tests
https://bugs.webkit.org/show_bug.cgi?id=187095

Patch by Frederic Wang <fwang@igalia.com> on 2018-07-03
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* resources/resource-files.json:
* web-platform-tests/infrastructure/META.yml: Added.
* web-platform-tests/infrastructure/README.md: Added.
* web-platform-tests/infrastructure/assumptions/META.yml: Added.
* web-platform-tests/infrastructure/assumptions/ahem-expected.html: Added.
* web-platform-tests/infrastructure/assumptions/ahem-notref.html: Added.
* web-platform-tests/infrastructure/assumptions/ahem-ref-expected.html: Added.
* web-platform-tests/infrastructure/assumptions/ahem-ref.html: Added.
* web-platform-tests/infrastructure/assumptions/ahem.html: Added.
* web-platform-tests/infrastructure/assumptions/canvas-background-expected.html: Added.
* web-platform-tests/infrastructure/assumptions/canvas-background.html: Added.
* web-platform-tests/infrastructure/assumptions/html-elements-expected.txt: Added.
* web-platform-tests/infrastructure/assumptions/html-elements.html: Added.
* web-platform-tests/infrastructure/assumptions/initial-color-expected.html: Added.
* web-platform-tests/infrastructure/assumptions/initial-color.html: Added.
* web-platform-tests/infrastructure/assumptions/medium-font-size-expected.html: Added.
* web-platform-tests/infrastructure/assumptions/medium-font-size.html: Added.
* web-platform-tests/infrastructure/assumptions/min-font-size-expected.html: Added.
* web-platform-tests/infrastructure/assumptions/min-font-size.html: Added.
* web-platform-tests/infrastructure/assumptions/non-secure-context.any-expected.txt: Added.
* web-platform-tests/infrastructure/assumptions/non-secure-context.any.html: Added.
* web-platform-tests/infrastructure/assumptions/non-secure-context.any.js: Added.
(test):
* web-platform-tests/infrastructure/assumptions/non-secure-context.any.worker-expected.txt: Added.
* web-platform-tests/infrastructure/assumptions/non-secure-context.any.worker.html: Added.
* web-platform-tests/infrastructure/assumptions/tools/ahem-generate-table.py: Added.
(grouper):
(build_header):
(build_table):
* web-platform-tests/infrastructure/assumptions/tools/build.sh: Added.
* web-platform-tests/infrastructure/assumptions/tools/w3c-import.log: Added.
* web-platform-tests/infrastructure/assumptions/w3c-import.log: Added.
* web-platform-tests/infrastructure/browsers/firefox/prefs.html: Added.
* web-platform-tests/infrastructure/browsers/firefox/w3c-import.log: Added.
* web-platform-tests/infrastructure/expected-fail/failing-test.html: Added.
* web-platform-tests/infrastructure/expected-fail/timeout.html: Added.
* web-platform-tests/infrastructure/expected-fail/w3c-import.log: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/browsers/firefox/__dir__.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/browsers/firefox/prefs.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/browsers/firefox/w3c-import.log: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/expected-fail/failing-test.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/expected-fail/timeout.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/expected-fail/w3c-import.log: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/reftest_and_fail.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/reftest_cycle_fail.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/reftest_match_fail.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/reftest_mismatch_fail.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/reftest_ref_timeout.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/reftest_timeout.html.ini: Added.
* web-platform-tests/infrastructure/metadata/infrastructure/reftest/w3c-import.log: Added.
* web-platform-tests/infrastructure/reftest-wait-expected.html: Added.
* web-platform-tests/infrastructure/reftest-wait.html: Added.
* web-platform-tests/infrastructure/reftest/green-expected.html: Added.
* web-platform-tests/infrastructure/reftest/green-ref-expected.html: Added.
* web-platform-tests/infrastructure/reftest/green-ref.html: Added.
* web-platform-tests/infrastructure/reftest/green.html: Added.
* web-platform-tests/infrastructure/reftest/red.html: Added.
* web-platform-tests/infrastructure/reftest/reftest.https-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest.https.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_and_fail-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_and_fail.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_and_fail_0-ref-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_and_fail_0-ref.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_0-ref-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_0-ref.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_1-ref-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_1-ref.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_fail-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_fail.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_fail_0-ref-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_cycle_fail_0-ref.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_match-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_match.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_match_fail-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_match_fail.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_mismatch-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_mismatch.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_mismatch_fail-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_mismatch_fail.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_or_0-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_or_0.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_ref_timeout-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_ref_timeout.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_timeout-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_timeout.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_wait_0-expected.html: Added.
* web-platform-tests/infrastructure/reftest/reftest_wait_0.html: Added.
* web-platform-tests/infrastructure/reftest/w3c-import.log: Added.
* web-platform-tests/infrastructure/server/order-of-metas.any-expected.txt: Added.
* web-platform-tests/infrastructure/server/order-of-metas.any.html: Added.
* web-platform-tests/infrastructure/server/order-of-metas.any.js: Added.
(test):
* web-platform-tests/infrastructure/server/order-of-metas.any.worker-expected.txt: Added.
* web-platform-tests/infrastructure/server/order-of-metas.any.worker.html: Added.
* web-platform-tests/infrastructure/server/order-of-metas.window.js: Added.
(test):
* web-platform-tests/infrastructure/server/resources/expect-global.js: Added.
(test):
* web-platform-tests/infrastructure/server/resources/expect-seen-testharness.js: Added.
(test):
* web-platform-tests/infrastructure/server/resources/expect-title-meta.js: Added.
(self.GLOBAL.self.GLOBAL.isWindow):
* web-platform-tests/infrastructure/server/resources/w3c-import.log: Added.
* web-platform-tests/infrastructure/server/secure-context.https.any-expected.txt: Added.
* web-platform-tests/infrastructure/server/secure-context.https.any.html: Added.
* web-platform-tests/infrastructure/server/secure-context.https.any.js: Added.
(test):
* web-platform-tests/infrastructure/server/secure-context.https.any.worker-expected.txt: Added.
* web-platform-tests/infrastructure/server/secure-context.https.any.worker.html: Added.
* web-platform-tests/infrastructure/server/title.any-expected.txt: Added.
* web-platform-tests/infrastructure/server/title.any.html: Added.
* web-platform-tests/infrastructure/server/title.any.js: Added.
(test.t.GLOBAL.isWindow):
* web-platform-tests/infrastructure/server/title.any.worker-expected.txt: Added.
* web-platform-tests/infrastructure/server/title.any.worker.html: Added.
* web-platform-tests/infrastructure/server/w3c-import.log: Added.
* web-platform-tests/infrastructure/server/wpt-server-http.sub-expected.txt: Added.
* web-platform-tests/infrastructure/server/wpt-server-http.sub.html: Added.
* web-platform-tests/infrastructure/server/wpt-server-websocket.sub.html: Added.
* web-platform-tests/infrastructure/testdriver/click.html: Added.
* web-platform-tests/infrastructure/testdriver/send_keys.html: Added.
* web-platform-tests/infrastructure/testdriver/w3c-import.log: Added.
* web-platform-tests/infrastructure/w3c-import.log: Added.
* web-platform-tests/infrastructure/webdriver/tests/conftest.py: Added.
* web-platform-tests/infrastructure/webdriver/tests/test_load_file.py: Added.
(test_load):
* web-platform-tests/infrastructure/webdriver/tests/w3c-import.log: Added.

LayoutTests:

* TestExpectations: Mark known failures.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233463 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoREGRESSION (r232186): Hardware-accelerated CSS animations using steps() timing functi...
commit-queue@webkit.org [Tue, 3 Jul 2018 15:01:55 +0000 (15:01 +0000)]
REGRESSION (r232186): Hardware-accelerated CSS animations using steps() timing function no longer work
https://bugs.webkit.org/show_bug.cgi?id=186129

Patch by Frederic Wang <fwang@igalia.com> on 2018-07-03
Reviewed by Antoine Quint.

Source/WebCore:

When the WebAnimationsCSSIntegration flag is enabled, animating the transform property with
a steps() timing function no longer works. This is because the WebAnimation code wrongly
assumes that the transform property can always be accelerated (for counterexamples, see
GraphicsLayerCA::animationCanBeAccelerated). For consistency with AnimationBase, we make
WebAnimation fallback to non-accelerated mode when RenderBoxModelObject::startAnimation
fails. This addresses the regression previously mentioned.

Test: http/wpt/css/css-animations/start-animation-001.html

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Fallback to
non-accelerated mode if startAnimation failed.

LayoutTests:

Add a test to ensure that accelerated and non-accelerated animations are properly started
when WebAnimationsCSSIntegration is enabled. In particular, consider the case of animated
transform using steps() timing function.

* http/wpt/css/css-animations/start-animation-001-expected.html: Added.
* http/wpt/css/css-animations/start-animation-001.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233462 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[iOS] Add assert to catch improper use of WebCore::Timer in UI Process
ddkilzer@apple.com [Tue, 3 Jul 2018 10:41:37 +0000 (10:41 +0000)]
[iOS] Add assert to catch improper use of WebCore::Timer in UI Process
<https://webkit.org/b/185330>
<rdar://problem/32816079>

Reviewed by Darin Adler.

Source/WebCore:

* platform/RuntimeApplicationChecks.cpp:
(WebCore::s_webKitProcessType): Add. Global to track process
type.
(WebCore::setWebKitProcessType): Implement new function that is
called when initializing Web, Network, and Storage processes.
(WebCore::isInNetworkProcess): Add.
(WebCore::isInStorageProcess): Add.
(WebCore::isInWebProcess): Add.
- Check value in s_webKitProcessType to determine which process
  is currently running.
* platform/RuntimeApplicationChecks.h:
(WebCore::isInNetworkProcess): Add.
(WebCore::isInStorageProcess): Add.
(WebCore::isInWebProcess):
- Make available for all platforms.

* platform/Timer.cpp:
(WebCore::TimerBase::TimerBase): Add assert and os_log_fault.
This catches the unwanted behavior on iOS using isAllowed().
(WebCore::TimerBase::isAllowed): Add implementation.
* platform/Timer.h:
(WebCore::TimerBase::isAllowed): Add declaration.

* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::isInWebProcess): Delete.  Replace with method in
RuntimeApplicationChecks.cpp.

Source/WebKit:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::NetworkProcess):
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::StorageProcess):
* WebProcess/WebProcess.cpp:
(WebKit::m_nonVisibleProcessCleanupTimer):
- Call setWebKitProcessType() to se the global for the current
  process.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233461 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[iOS] Animations with Bézier timing function not suspended on UI process when animati...
fred.wang@free.fr [Tue, 3 Jul 2018 10:22:54 +0000 (10:22 +0000)]
[iOS] Animations with Bézier timing function not suspended on UI process when animation-play-state is set to "paused"
https://bugs.webkit.org/show_bug.cgi?id=170784

Source/WebKit:

Reviewed by Antoine Quint.

In order to pause a running animation, GraphicsLayerCA::pauseCAAnimationOnLayer calls
PlatformCALayer::addAnimationForKey, assuming it will replace the current animation.
This patch fixes PlatformCALayerRemote::addAnimationForKey to ensure this assumption holds.

* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::addAnimationForKey): If the animation was already sent to
the UI process, make sure it is properly updated.

LayoutTests:

Add a reftest to visually check pausing of transform animations.

Reviewed by Antoine Quint.

* http/wpt/css/css-animations/set-animation-play-state-to-paused-001-expected.html: Added.
* http/wpt/css/css-animations/set-animation-play-state-to-paused-001.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233460 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoLayoutTests/imported/mozilla:
graouts@webkit.org [Tue, 3 Jul 2018 08:34:38 +0000 (08:34 +0000)]
LayoutTests/imported/mozilla:
Unreviewed, rebaselining somes Web Animations test expectations.

* css-animations/test_animations-dynamic-changes-expected.txt:
* css-animations/test_document-get-animations-expected.txt:
* css-animations/test_keyframeeffect-getkeyframes-expected.txt: Added.

LayoutTests/imported/w3c:
Unreviewed, rebaselining a Web Animations test expectation.

* web-platform-tests/web-animations/interfaces/Animation/finished-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233459 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoCrash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c...
graouts@webkit.org [Tue, 3 Jul 2018 08:31:52 +0000 (08:31 +0000)]
Crash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html
https://bugs.webkit.org/show_bug.cgi?id=187145

Unreviewed. Forgot to remove the expectation change when fixing the bug in r233430.

* TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233458 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WPE][GTK] Another memory issue in xdgmime
mcatanzaro@igalia.com [Tue, 3 Jul 2018 07:05:58 +0000 (07:05 +0000)]
[WPE][GTK] Another memory issue in xdgmime
https://bugs.webkit.org/show_bug.cgi?id=187239

Reviewed by Carlos Garcia Campos.

Sync the end of xdg_mime_get_mime_type_for_file() with _xdg_mime_cache_get_mime_type_for_file()
to avoid a memory issue.

I'm pretty sure this code is never executed by either Chromium or WebKit, but I'm not
comfortable with leaving it broken.

* xdgmime/README.webkit:
* xdgmime/src/xdgmime.c:
(xdg_mime_get_mime_type_for_file):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233457 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoManifest.reset should clear static map for BugTracker and Bug objects.
dewei_zhu@apple.com [Tue, 3 Jul 2018 03:55:24 +0000 (03:55 +0000)]
Manifest.reset should clear static map for BugTracker and Bug objects.
https://bugs.webkit.org/show_bug.cgi?id=187186

Reviewed by Ryosuke Niwa

If static maps of BugTracker and Bug objects are not cleared up, updating singleton
of Bug object will fail assertion.

* public/v3/models/manifest.js: Clear static map for BugTracker and Bug.
(Manifest.reset):
* server-tests/api-manifest-tests.js: Added a unit test for this change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233456 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoFix a bug in range bisector that start commit may be counted twice.
dewei_zhu@apple.com [Tue, 3 Jul 2018 03:55:21 +0000 (03:55 +0000)]
Fix a bug in range bisector that start commit may be counted twice.
https://bugs.webkit.org/show_bug.cgi?id=187205

Reviewed by Darin Adler.

Range bisector counted start commit twice if start commit is the same as end commit.

* public/v3/commit-set-range-bisector.js:
(CommitSetRangeBisector.async.commitSetClosestToMiddleOfAllCommits):
* unit-tests/commit-set-range-bisector-tests.js: Added a unit test for this change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233455 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[CMake] Use JOB_POOLS to avoid memory-hungry linker processes running at the same...
aperez@igalia.com [Tue, 3 Jul 2018 01:07:19 +0000 (01:07 +0000)]
[CMake] Use JOB_POOLS to avoid memory-hungry linker processes running at the same time
https://bugs.webkit.org/show_bug.cgi?id=187254

Reviewed by Michael Catanzaro.

* Source/cmake/WebKitCommon.cmake: Set the maximum number of
concurrent link processes using job pools (four for release builds,
two otherwise) to avoid running out of memory during builds.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233454 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoRegular expressions with ".?" expressions at the start and the end match the entire...
sukolsak@gmail.com [Tue, 3 Jul 2018 01:03:19 +0000 (01:03 +0000)]
Regular expressions with ".?" expressions at the start and the end match the entire string
https://bugs.webkit.org/show_bug.cgi?id=119191

Reviewed by Michael Saboff.

Source/JavaScriptCore:

r90962 optimized regular expressions in the form of /.*abc.*/ by looking
for "abc" first and then processing the leading and trailing dot stars
to find the beginning and the end of the match. However, it erroneously
enabled this optimization for regular expressions whose leading or
trailing dots had quantifiers that were not of arbitrary length, e.g.,
/.?abc.*/, /.*abc.?/, /.{0,4}abc.*/, etc. This caused the expression to
match the entire string when it shouldn't. This patch disables the
optimization for those cases.

* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPatternConstructor::optimizeDotStarWrappedExpressions):

LayoutTests:

* fast/regex/dotstar-expected.txt:
* fast/regex/script-tests/dotstar.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233453 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoTighter limit for canvas memory use on iOS
antti@apple.com [Tue, 3 Jul 2018 00:51:03 +0000 (00:51 +0000)]
Tighter limit for canvas memory use on iOS
https://bugs.webkit.org/show_bug.cgi?id=187279
<rdar://problem/38420562>

Reviewed by Simon Fraser.

Source/WebCore:

We allowed 448MB of canvas buffer memory. This is still too much in some cases. Painting a large
canvas may also requires several other temporary canvas sized buffers getting us easily over
the process size limit.

* html/HTMLCanvasElement.cpp:
(WebCore::maxActivePixelMemory):

Drop to (ramSize() / 4) which computes to 224MB on 2GB devices.

LayoutTests:

* platform/ios-simulator/fast/canvas/canvas-crash-expected.txt:
* platform/ios-simulator/fast/canvas/canvas-skia-excessive-size-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoRegExp.exec returns wrong value with a long integer quantifier
sukolsak@gmail.com [Tue, 3 Jul 2018 00:49:48 +0000 (00:49 +0000)]
RegExp.exec returns wrong value with a long integer quantifier
https://bugs.webkit.org/show_bug.cgi?id=187042

Reviewed by Saam Barati.

JSTests:

* stress/regexp-large-quantifier.js: Added.
(testRegExp):
* stress/regress-159744.js:

Source/JavaScriptCore:

Prior to this patch, the Yarr parser checked for integer overflow when
parsing quantifiers in regular expressions by adding one digit at a time
to a number and checking if the result got larger. This is wrong;
The parser would fail to detect overflow when parsing, for example,
10,000,000,003 because (1000000000*10 + 3) % (2^32) = 1410065411 > 1000000000.

Another issue was that once it detected overflow, it stopped consuming
the remaining digits. Since it didn't find the closing bracket, it
parsed the quantifier as a normal string instead.

This patch fixes these issues by reading all the digits and checking for
overflow with Checked<unsigned, RecordOverflow>. If it overflows, it
returns the largest possible value (quantifyInfinite in this case). This
matches Chrome [1], Firefox [2], and Edge [3].

[1] https://chromium.googlesource.com/v8/v8.git/+/23222f0a88599dcf302ccf395883944620b70fd5/src/regexp/regexp-parser.cc#1042
[2] https://dxr.mozilla.org/mozilla-central/rev/aea3f3457f1531706923b8d4c595a1f271de83da/js/src/irregexp/RegExpParser.cpp#1310
[3] https://github.com/Microsoft/ChakraCore/blob/fc08987381da141bb686b5d0c71d75da96f9eb8a/lib/Parser/RegexParser.cpp#L1149

* yarr/YarrParser.h:
(JSC::Yarr::Parser::consumeNumber):

LayoutTests:

* fast/regex/overflow-expected.txt:
* fast/regex/script-tests/overflow.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233451 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAdd sandbox to microdone plugin
youenn@apple.com [Tue, 3 Jul 2018 00:34:42 +0000 (00:34 +0000)]
Add sandbox to microdone plugin
https://bugs.webkit.org/show_bug.cgi?id=187149
<rdar://problem/41538057>

Unreviewed.

* Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari.sb: Renamed from Source/WebKit/Resources/PlugInSandboxProfiles/cn.microdone.cmb.safari.
* WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233450 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAdjust now-incorrect animated resize logging after r232544
timothy_horton@apple.com [Tue, 3 Jul 2018 00:21:50 +0000 (00:21 +0000)]
Adjust now-incorrect animated resize logging after r232544
https://bugs.webkit.org/show_bug.cgi?id=187281
<rdar://problem/41645347>

Reviewed by Simon Fraser.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):
(-[WKWebView _didCompleteAnimatedResize]):
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
_beginAnimatedResizeWithUpdate: and _didCompleteAnimatedResize are
not strictly paired; we could instead track the SPI, but it's a bit
tricky since resizeWithContentHidden has an implicit endAnimatedResize.
Instead, just log if we still have a resizeAnimationView when we're
committing outside of an animated resize, which seems to be the original concern,
and point toward the possibility of unpaired begin/end.
Also fix logging that has the wrong method name.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233449 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoFix a leak in ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewCon...
wenson_hsieh@apple.com [Tue, 3 Jul 2018 00:17:54 +0000 (00:17 +0000)]
Fix a leak in ActionSheetTests.DismissingActionSheetShouldNotDismissPresentingViewController
https://bugs.webkit.org/show_bug.cgi?id=187280

Reviewed by Tim Horton.

Add a missing `adoptNS()`.

* TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233448 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Cocoa] Google Fonts doesn't work if the user has the requested font locally-installed
mmaxfield@apple.com [Tue, 3 Jul 2018 00:15:20 +0000 (00:15 +0000)]
[Cocoa] Google Fonts doesn't work if the user has the requested font locally-installed
https://bugs.webkit.org/show_bug.cgi?id=187228
<rdar://problem/40967280>

Reviewed by Brent Fulgham.

Source/WebCore:

This is due to the local() items in the src: descriptor in the @font-family blocks.

This is because of a behavior difference between CSSFontFaceSource::load() and CSSFontFaceSource::font().
load() is supposed to set the status() to Success iff the font can be used, and then CSSFontFaceSource::font()
is supposed to return the font itself to use. load() works by constructing a dummy FontDescription and
performing a system lookup (to see if the local font really exists). However, this dummy FontDescription
doesn't set the ShouldAllowUserInstalledFonts flag. Then, in CSSFontFaceSource::font(), a similar lookup is
performed, except this one has the original FontDescription (with the correct value of the
ShouldAllowUserInstalledFonts flag set. Therefore, the two functions disagree about the state of the flag.

When the CSSFontFaceSource's status gets set to Success, that means "this is the font face source that
represents the @font-face block" but when CSSFontFaceSource::font() returns nullptr, that means "The font face
source can't be used for some reason" so we then continue searching down the font-family list (and render the
text in Helvetica or whatever comes next).

The solution is simple - just set the ShouldAllowUserInstalledFonts flag correctly in the dummy
FontDescription.

Test: fast/text/user-installed-fonts/local.html

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::allowUserInstalledFonts const):
* css/CSSFontFace.h:
* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::load):

Tools:

The test only fails before the patch if the lookup for Helvetica2 is allowed to occur.

* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::allowedFontFamilySet):

LayoutTests:

* fast/text/user-installed-fonts/local-expected.html: Added.
* fast/text/user-installed-fonts/local.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233447 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoRepository fix after r233427 and r233443.
rniwa@webkit.org [Mon, 2 Jul 2018 23:45:22 +0000 (23:45 +0000)]
Repository fix after r233427 and r233443.
.:

* jstests: Removed.

JSTests:

Added back the test which got erroneously deleted in r233443.

* stress/instanceof-non-object-prototype.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233446 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agorun-benchmark should include the version number of MotionMark's results
rniwa@webkit.org [Mon, 2 Jul 2018 23:17:41 +0000 (23:17 +0000)]
run-benchmark should include the version number of MotionMark's results
https://bugs.webkit.org/show_bug.cgi?id=187274

Reviewed by Jon Lee.

Append the version number as a part of the suite name.

* Scripts/webkitpy/benchmark_runner/data/patches/webserver/MotionMark.patch:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233445 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUpdate com.apple.NPSafeInput.sb to make it functional
youenn@apple.com [Mon, 2 Jul 2018 23:15:31 +0000 (23:15 +0000)]
Update com.apple.NPSafeInput.sb to make it functional
https://bugs.webkit.org/show_bug.cgi?id=187276

Reviewed by Brent Fulgham.

* Resources/PlugInSandboxProfiles/com.apple.NPSafeInput.sb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233444 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoGenerate event and event target interface types directly instead of via macros
rniwa@webkit.org [Mon, 2 Jul 2018 22:54:32 +0000 (22:54 +0000)]
Generate event and event target interface types directly instead of via macros
https://bugs.webkit.org/show_bug.cgi?id=187215

Reviewed by Chris Dumez.

Made make_event_factory.pl directly generate EventInterface enum values and toJSNewlyCreated for Event,
and EventTargetInterface enum values and toJS for EventTarget. Removed the code to generate EventFactory::create
since it was never even compiled or used anywhere.

This patch faithfully replicates what the macro used to generate but we should consider always generating either
toJS or toJSNewlyCreated for both interfaces in the future.

No new tests since there should be no observable behavioral changes.

* DerivedSources.make: Generate EventTargetFactory.cpp, which is used to generate toJS function for EventTarget.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSEventCustom.cpp:
(WebCore::toJSNewlyCreated): Deleted. Now generated directly in EventFactory.cpp.
* bindings/js/JSEventTargetCustom.cpp:
(WebCore::JSEventTarget::toWrapped): Removed the use of TRY_TO_UNWRAP_WITH_INTERFACE.
(WebCore::toJS): Deleted. Now generated directly in EventFactory.cpp.
* bindings/scripts/InFilesCompiler.pm:
(generateInterfacesHeader): Use #pragma once. Generate enum values directly. Added the support for suffixing
each type name with namespace for EventTarget.
* dom/Event.h: Removed the declaration of EventInterface enum. It's now directly generated in EventInterfaces.h
* dom/EventNames.in: Generate toJSNewlyCreated.
* dom/EventTarget.h: Removed the declaration of EventTargetInterface as it's now done in EventTargetInterfaces.h.
* dom/EventTargetFactory.in: Generate toJS.
* dom/make_event_factory.pl:
(defaultParameters): Added two new options. factoryFunction specifies whether toJS or toJSNewlyCreated is generated,
and useNamespaceAsSuffix specifies whether each entry should be suffixed by the namespace (used by EventTarget).
(generateCode): Added a missing semicolon.
(generateImplementation): Removed the early exit for EventTarget since we now need to generate its toJS function.
Replaced the code to generate EventFactory::create by the one to generate toJS / toJSNewlyCreated.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233443 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoHTML widget displays blank when playing on page
zalan@apple.com [Mon, 2 Jul 2018 22:47:20 +0000 (22:47 +0000)]
HTML widget displays blank when playing on page
https://bugs.webkit.org/show_bug.cgi?id=187272
<rdar://problem/39317899>

Reviewed by Simon Fraser.

When a composited layer gains content (in this particular case, going from NoContentsLayer to ContentsLayerForMedia),
we need to size the associated graphics layer accordingly (NoContentsLayer means zero sized graphics layer).

Not testable on iOS.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233442 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoRefactor InlineTextBox::emphasisMarkExistsAndIsAbove()
ddkilzer@apple.com [Mon, 2 Jul 2018 22:27:42 +0000 (22:27 +0000)]
Refactor InlineTextBox::emphasisMarkExistsAndIsAbove()
<https://webkit.org/b/187204>

Reviewed by Darin Adler.

No new tests since there is no change in behavior.

Refactor emphasisMarkExistsAndIsAbove() to return a
std::optional<bool> instead of returning a bool and taking a
std::optional<bool> argument.  The state returned is now:
- std::nullopt => emphasis mark doesn't exist or is suppressed.
- false => emphasis mark exists and is not suppressed, but is not above.
- true => emphasis mark exists and is not suppressed, and is above.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::placeBoxesInBlockDirection):
(WebCore::InlineFlowBox::addTextBoxVisualOverflow):
(WebCore::InlineFlowBox::computeOverAnnotationAdjustment const):
(WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const):
- Update for refactored method.  Remove some redundant checks
  for TextEmphasisMark::None that already happen in
  emphasisMarkExistsAndIsAbove().
* rendering/InlineTextBox.cpp:
(WebCore::emphasisPositionHasNeitherLeftNorRight): Delete.
- Replaced by an OptionSet<TextEmphasisPosition>.
(WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
- Refactor as described above.
(WebCore::InlineTextBox::paintMarkedTextForeground):
- Update for refactored method.
* rendering/InlineTextBox.h:
(WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
- Update for new method signature.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233441 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUpdate com.cfca.npSecEditCtl.MAC.BOC.plugin.sb to make it functional
youenn@apple.com [Mon, 2 Jul 2018 22:20:46 +0000 (22:20 +0000)]
Update com.cfca.npSecEditCtl.MAC.BOC.plugin.sb to make it functional
https://bugs.webkit.org/show_bug.cgi?id=187261

Reviewed by Brent Fulgham.

* Resources/PlugInSandboxProfiles/com.cfca.npSecEditCtl.MAC.BOC.plugin.sb:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WK1] editing/spelling/markers.html is failing on recent builds of macOS Mojave
wenson_hsieh@apple.com [Mon, 2 Jul 2018 22:04:51 +0000 (22:04 +0000)]
[WK1] editing/spelling/markers.html is failing on recent builds of macOS Mojave
https://bugs.webkit.org/show_bug.cgi?id=187253

Reviewed by Tim Horton.

Tools:

Enhances and refactors LayoutTestSpellChecker, which was introduced in r233412.

* DumpRenderTree/TestRunner.cpp:
(setSpellCheckerResultsCallback):

Rename setSpellCheckerTextReplacements to setSpellCheckerResults.

(TestRunner::staticFunctions):
(setSpellCheckerTextReplacementsCallback): Deleted.
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setSpellCheckerResults):
(TestRunner::setSpellCheckerTextReplacements): Deleted.
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setSpellCheckerResults):
(TestRunner::setSpellCheckerTextReplacements): Deleted.
* TestRunnerShared/cocoa/LayoutTestSpellChecker.h:
* TestRunnerShared/cocoa/LayoutTestSpellChecker.mm:
(-[LayoutTestTextCheckingResult initWithType:range:replacement:details:]):
(-[LayoutTestTextCheckingResult grammarDetails]):
(-[LayoutTestSpellChecker reset]):
(-[LayoutTestSpellChecker results]):
(-[LayoutTestSpellChecker setResults:]):
(-[LayoutTestSpellChecker setResultsFromJSObject:inContext:]):

Add support for passing in a list of grammar correction detail ranges. Necessary for simulating grammar errors.

(-[LayoutTestSpellChecker checkString:range:types:options:inSpellDocumentWithTag:orthography:wordCount:]):

Tweaked to always call the superclass method. This ensures that we set the `orthography` and `wordCount`
outpointers if applicable.

(-[LayoutTestSpellChecker requestCheckingOfString:range:types:options:inSpellDocumentWithTag:completionHandler:]):

Added support for simulating asynchronous spell checking.

(-[LayoutTestTextCheckingResult initWithType:range:replacement:]): Deleted.
(-[LayoutTestSpellChecker replacements]): Deleted.
(-[LayoutTestSpellChecker setReplacements:]): Deleted.
(-[LayoutTestSpellChecker setReplacementsFromJSObject:inContext:]): Deleted.

LayoutTests:

In recent builds of macOS Mojave, NSSpellChecker returns both grammar and spelling errors when asked to analyze
the string "I have a issue.". While arguably correct, the change causes this existing layout test to fail due
to one of the calls to `verifyUnexpectedMarkers` expecting either grammar markers and not spelling markers, or
vice versa.

To fix this, we can leverage the mechanism added in r233412 to simulate different results from the platform
spellchecker, such that the test now exercises all combinations of grammar and spelling corrections observed on
each macOS platform, regardless of the actual platform where the test is being run.

This patch also enhances the capabilities of `LayoutTestSpellChecker`. See `Tools/ChangeLog` for more details.

* editing/spelling/markers-expected.txt:
* editing/spelling/markers.html:
* editing/spelling/text-replacement-after-typing-to-word.html:

Adjusted for a renamed TestRunner method.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233439 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAnother unreviewed followup to:
beidson@apple.com [Mon, 2 Jul 2018 22:02:30 +0000 (22:02 +0000)]
Another unreviewed followup to:
Crash notifying observers of responsiveness state change

* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView typeCharacter:]): Move this back to the Mac-only category, as we won't be running this
  test on iOS for other reasons.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed GTK gardening
mcatanzaro@igalia.com [Mon, 2 Jul 2018 21:59:47 +0000 (21:59 +0000)]
Unreviewed GTK gardening

* platform/gtk/TestExpectations:
* platform/gtk/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoEnable copy paste on iOS apps for Mac
megan_gardner@apple.com [Mon, 2 Jul 2018 21:52:18 +0000 (21:52 +0000)]
Enable copy paste on iOS apps for Mac
https://bugs.webkit.org/show_bug.cgi?id=187194
<rdar://problem/41451148>

Reviewed by Darin Adler.

Difficult to test this platform.

UIKit doesn't support itemProviders for iOS apps for Mac, so we need to revert to the
older way of setting a dictionary of objects and keys for items. Not everything is
availble in this form, and we haven't cleaned up our itemProvider code yet, so we
need to case some things out for now. Hopefully in the future, this will be implmented
and can just work as expected, but for now, this is the best workaround.

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::registerItemToPasteboard):
(WebCore::PlatformPasteboard::write):
(WebCore::PlatformPasteboard::readURL):
* platform/ios/WebItemProviderPasteboard.h:
* platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderRegistrationInfoList itemProvider]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoVideo sometimes flickers when playing to AppleTV
eric.carlson@apple.com [Mon, 2 Jul 2018 21:49:49 +0000 (21:49 +0000)]
Video sometimes flickers when playing to AppleTV
https://bugs.webkit.org/show_bug.cgi?id=187193
<rdar://problem/40153865>

Reviewed by Jer Noble and Youenn Fablet.
Source/WebCore:

No new tests, existing test updated.

Delay 100ms before changing the iOS audio session category because it is an expensive and
potentially disruptive operation, and changing an audio or video element configuration
can result in several quick, ultimately unnecessary, category changes.

* platform/audio/PlatformMediaSession.cpp:
(WebCore::PlatformMediaSession::clientWillBeginPlayback): Add logging.

* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): Initialize timer.
(WebCore::PlatformMediaSessionManager::removeSession): Deactivate audio session when there
are no sessions.
(WebCore::PlatformMediaSessionManager::updateSessionStateTimerFired): New, update session now.
(WebCore::PlatformMediaSessionManager::updateSessionState): Add parameter.
* platform/audio/PlatformMediaSessionManager.h:

* platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
(PlatformMediaSessionManager::updateSessionState): Defer update if it isn't supposed to happen
immediately.

* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::setCategory): Drive-by: setting the audio category to nil is a noop,
so don't waste time doing it.
(WebCore::AudioSession::tryToSetActive): Allow other apps to resume playback when we deactivate
the audio session.

* platform/Timer.h:
(WebCore::DeferrableOneShotTimer): Add WTF_MAKE_FAST_ALLOCATED so it can be used in a unique_ptr.

LayoutTests:

* platform/mac/media/audio-session-category-audio-autoplay.html: Update as audio category
doesn't change immediately.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233435 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoClean up some spellchecking code
wenson_hsieh@apple.com [Mon, 2 Jul 2018 20:56:53 +0000 (20:56 +0000)]
Clean up some spellchecking code
https://bugs.webkit.org/show_bug.cgi?id=187238

Reviewed by Tim Horton.

A few minor tweaks to modernize some spellchecking code. No change in behavior.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired):
* editing/Editor.cpp:
(WebCore::Editor::markMisspellingsAfterTypingToWord):

Use move semantics when passing Ranges to markAllMisspellingsAndBadGrammarInRanges.

(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):

Change this to take RefPtr<Range>&& instead of Range*.

(WebCore::Editor::markMisspellingsAndBadGrammar):

Remove an unnecessary call to `RefPtr::get()`.

* editing/Editor.h:
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
(WebCore::TextCheckingParagraph::checkingStart const):
(WebCore::TextCheckingParagraph::checkingEnd const):
(WebCore::TextCheckingParagraph::checkingLength const):
(WebCore::TextCheckingParagraph::automaticReplacementStart const):
(WebCore::TextCheckingParagraph::automaticReplacementLength const):

Currently, all of these cached range offsets are `int`s, and use a value of -1 to denote that their values are
missing and must be recomputed. Instead, make these `std::optional`s and let `std::nullopt` represent the
missing value.

* editing/TextCheckingHelper.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed followup to:
beidson@apple.com [Mon, 2 Jul 2018 20:54:55 +0000 (20:54 +0000)]
Unreviewed followup to:
Crash notifying observers of responsiveness state change

* TestWebKitAPI/Tests/WebKit/ResponsivenessTimerCrash.mm: Need the C-SPI for this test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233433 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoCrash notifying observers of responsiveness state change
beidson@apple.com [Mon, 2 Jul 2018 20:52:18 +0000 (20:52 +0000)]
Crash notifying observers of responsiveness state change
<rdar://problem/41267796> and https://bugs.webkit.org/show_bug.cgi?id=187262

Reviewed by Tim Horton.

Source/WebKit:

* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::callObserverCallback): Copy the container ahead of time.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/ResponsivenessTimerCrash.mm: Added.
(-[RTObserver observeValueForKeyPath:ofObject:change:context:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView typeCharacter:]):
(-[TestWKWebView hostWindow]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233432 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoRemove InitWebCoreThreadSystemInterface() in WKProcessPool _initWithConfiguration
sihui_liu@apple.com [Mon, 2 Jul 2018 20:50:17 +0000 (20:50 +0000)]
Remove InitWebCoreThreadSystemInterface() in WKProcessPool _initWithConfiguration
https://bugs.webkit.org/show_bug.cgi?id=187252

Reviewed by Dan Bernstein.

Clean up after <rdar://problem/15256572>.

* UIProcess/API/Cocoa/WKProcessGroup.mm:
(-[WKProcessGroup initWithInjectedBundleURL:]):
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _initWithConfiguration:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233431 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoCrash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c...
graouts@webkit.org [Mon, 2 Jul 2018 20:46:14 +0000 (20:46 +0000)]
Crash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html
https://bugs.webkit.org/show_bug.cgi?id=187145

Reviewed by Dean Jackson.

Ensure we have a resolved time value before trying to use it.

* animation/WebAnimation.cpp:
(WebCore::WebAnimation::timeToNextRequiredTick const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233430 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Web Animations] Crash in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
graouts@webkit.org [Mon, 2 Jul 2018 20:45:29 +0000 (20:45 +0000)]
[Web Animations] Crash in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
https://bugs.webkit.org/show_bug.cgi?id=187139

Reviewed by Dean Jackson.

Ensure we have a resolved time value before trying to use it.

* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233429 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WPE][GTK] flatpakutils.py should respect set-webkit-configuration build type
mcatanzaro@igalia.com [Mon, 2 Jul 2018 19:02:18 +0000 (19:02 +0000)]
[WPE][GTK] flatpakutils.py should respect set-webkit-configuration build type
https://bugs.webkit.org/show_bug.cgi?id=187218

Reviewed by Philippe Normand.

Using the webkitpy Config module, if the build type is not passed on the command line, we
read it from WebKitBuild/Configuration and respect it.

* flatpak/flatpakutils.py:
(WebkitFlatpak.__init__):
(WebkitFlatpak.clean_args):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233428 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoInstanceOf IC should do generic if the prototype is not an object.
keith_miller@apple.com [Mon, 2 Jul 2018 18:04:54 +0000 (18:04 +0000)]
InstanceOf IC should do generic if the prototype is not an object.
https://bugs.webkit.org/show_bug.cgi?id=187250

Reviewed by Mark Lam.

JSTests:

* stress/instanceof-non-object-prototype.js: Added.
(let):
(test):
(i.catch):

Source/JavaScriptCore:

The old code was wrong for two reasons. First, the AccessCase expected that
the prototype value would be non-null. Second, we would end up returning
false instead of throwing an exception.

* jit/Repatch.cpp:
(JSC::tryCacheInstanceOf):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233427 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoBuiltins and host functions should get their own structures.
mark.lam@apple.com [Mon, 2 Jul 2018 17:51:21 +0000 (17:51 +0000)]
Builtins and host functions should get their own structures.
https://bugs.webkit.org/show_bug.cgi?id=187211
<rdar://problem/41646336>

Reviewed by Saam Barati.

JSTests:

* stress/regress-187211.js: Added.

Source/JavaScriptCore:

JSFunctions do lazy reification of properties, but ordinary functions applies
different rules of property reification than builtin and host functions.  Hence,
we should give builtins and host functions their own structures.

* runtime/JSFunction.cpp:
(JSC::JSFunction::selectStructureForNewFuncExp):
(JSC::JSFunction::create):
(JSC::JSFunction::getOwnPropertySlot):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::hostFunctionStructure const):
(JSC::JSGlobalObject::arrowFunctionStructure const):
(JSC::JSGlobalObject::sloppyFunctionStructure const):
(JSC::JSGlobalObject::strictFunctionStructure const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233426 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoReject getUserMedia promise if capture fails
youenn@apple.com [Mon, 2 Jul 2018 17:29:03 +0000 (17:29 +0000)]
Reject getUserMedia promise if capture fails
https://bugs.webkit.org/show_bug.cgi?id=187190

Reviewed by Eric Carlson.

In case PendingActivationMediaStream is notified of a change,
Check whether any track failed to capture.
If so, reject the promise.
Add more release logging in error case.

Covered by manual testing.

* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
(WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
(WebCore::UserMediaRequest::mediaStreamIsReady):
(WebCore::UserMediaRequest::mediaStreamDidFail):
* Modules/mediastream/UserMediaRequest.h:
* platform/mediastream/MediaStreamPrivate.h:
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::captureFailed):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setupCaptureSession):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233425 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[GTK] [l10n] Updated Ukrainian translation of WebKitGTK+
commit-queue@webkit.org [Mon, 2 Jul 2018 17:16:38 +0000 (17:16 +0000)]
[GTK] [l10n] Updated Ukrainian translation of WebKitGTK+
https://bugs.webkit.org/show_bug.cgi?id=187231

Patch by Yuri Chornoivan <yurchor@ukr.net> on 2018-07-02
Rubber-stamped by Michael Catanzaro.

* uk.po:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233424 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoREGRESSION(r233381): Double WebResourceLoadStatisticsStore destructor invocation
zandobersek@gmail.com [Mon, 2 Jul 2018 15:27:28 +0000 (15:27 +0000)]
REGRESSION(r233381): Double WebResourceLoadStatisticsStore destructor invocation
https://bugs.webkit.org/show_bug.cgi?id=187247

Reviewed by Chris Dumez.

* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
Don't call postTask() to dispatch this task, as that keeps a reference
to this WebResourceLoadStatisticsStore object and thus causes problems
when invoked from the destructor in the form of a second destructor
invocation that ends up crashing the process. Blocking nature of this
call should be enough to avoid WebResourceLoadStatisticsStore lifetime
issues.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233423 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoDelete display link when closing page or the WebContent process has crashed.
pvollan@apple.com [Mon, 2 Jul 2018 14:35:16 +0000 (14:35 +0000)]
Delete display link when closing page or the WebContent process has crashed.
https://bugs.webkit.org/show_bug.cgi?id=186895

Reviewed by Brent Fulgham.

If there is a running display link in the UI process, there is no need to keep it around if the
page is being closed or the WebContent process has crashed.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::resetStateAfterProcessExited):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233422 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WPE] Add touch support to WindowViewBackend
zandobersek@gmail.com [Mon, 2 Jul 2018 11:51:40 +0000 (11:51 +0000)]
[WPE] Add touch support to WindowViewBackend
https://bugs.webkit.org/show_bug.cgi?id=187245

Reviewed by Carlos Garcia Campos.

Add touch input support to the WindowViewBackend implementation,
plugging into the Wayland protocol in order to get properly notified
about these events, and then dispatching them against the appropriate
wpe_view_backend object so that WebKit can process them.

* wpe/backends/ViewBackend.cpp:
(WPEToolingBackends::ViewBackend::dispatchInputTouchEvent):
* wpe/backends/ViewBackend.h:
* wpe/backends/WindowViewBackend.cpp:
* wpe/backends/WindowViewBackend.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233421 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Linux] Fix memory leak in WTF::forEachLine()
aboya@igalia.com [Mon, 2 Jul 2018 11:41:30 +0000 (11:41 +0000)]
[Linux] Fix memory leak in WTF::forEachLine()
https://bugs.webkit.org/show_bug.cgi?id=187174

Reviewed by Žan Doberšek.

* wtf/linux/MemoryFootprintLinux.cpp:
(WTF::forEachLine):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233420 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed WPE gardening.
zandobersek@gmail.com [Mon, 2 Jul 2018 11:30:52 +0000 (11:30 +0000)]
Unreviewed WPE gardening.

Adjust or add a few test expectations. Remove a bad text baseline for
one W3C Fetch test, add a proper text baseline for another.

* platform/wpe/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/headers: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/api/headers/header-values-expected.txt: Added.
* platform/wpe/imported/w3c/web-platform-tests/fetch/security: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233419 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoWTF's internal std::optional implementation should abort() on bad optional access
fred.wang@free.fr [Mon, 2 Jul 2018 10:12:57 +0000 (10:12 +0000)]
WTF's internal std::optional implementation should abort() on bad optional access
https://bugs.webkit.org/show_bug.cgi?id=186536

Unreviewed test gardening.

Patch by Frederic Wang <fwang@igalia.com> on 2018-07-02

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233418 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoWTF's internal std::optional implementation should abort() on bad optional access
commit-queue@webkit.org [Mon, 2 Jul 2018 07:56:47 +0000 (07:56 +0000)]
WTF's internal std::optional implementation should abort() on bad optional access
https://bugs.webkit.org/show_bug.cgi?id=186536

Patch by Frederic Wang <fwang@igalia.com> on 2018-07-02
Reviewed by Michael Catanzaro.

Source/WTF:

Currently, some ports built with recent compilers will cause the program to abort when one
tries to access the value of an unset std:optional (i.e. std::nullopt) as specified by C++17.
However, most ports still use WTF's internal std::optional implementation, which does not
verify illegal access. Hence it's not possible for developers working on these ports to
detect issues like bugs #186189, #186535, #186752, #186753, #187139, #187145 or #187243.
WTF's version of std::optional was introduced in bug #164199 but it was not possible to
verify the availability of the value inside constexpr member functions because the assert
might involve asm declarations. This commit introduces a new
RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT macro (a simplified version of RELEASE_ASSERT that can
be used in constexpr context) and uses it in WTF's implementation of std::optional.

* wtf/Assertions.h: Define RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT as a version of
RELEASE_ASSERT that can be used in constexpr context (in particular avoids asm declarations).
* wtf/Optional.h:
(std::optional::operator ->): Add an assert to ensure the optional value is available.
(std::optional::operator *): Ditto.
(std::optional::value const): Ditto.
(std::optional::value): Ditto.
(std::optional<T::value const): Ditto.

LayoutTests:

* TestExpectations: Mark two tests as crashing (bug #187145 and bug #187243).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233417 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[GTK] ASSERTION FAILED: url == m_string in UserAgentQuirks test
commit-queue@webkit.org [Mon, 2 Jul 2018 07:49:28 +0000 (07:49 +0000)]
[GTK] ASSERTION FAILED: url == m_string in UserAgentQuirks test
https://bugs.webkit.org/show_bug.cgi?id=186838

This URL constructor expects canonicalized input, so fix the passed URL. I missed
this one some weeks ago since I had an older checkout.

Patch by Rob Buis <rbuis@igalia.com> on 2018-07-02
Reviewed by Michael Catanzaro.

* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233416 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WTF] RandomDevice should be initialized inside std::call_once
utatane.tea@gmail.com [Mon, 2 Jul 2018 04:24:33 +0000 (04:24 +0000)]
[WTF] RandomDevice should be initialized inside std::call_once
https://bugs.webkit.org/show_bug.cgi?id=186017

Reviewed by Darin Adler.

While Linux ports uses mutex-guarded static variables, Mac ports do not.
So we should guard static variables' initialization by using std::call_once.
This patch does it for RandomDevice.

* wtf/OSRandomSource.cpp:
(WTF::cryptographicallyRandomValuesFromOS):
* wtf/RandomDevice.h: Small fix for OS(FUCHSIA).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233415 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WK2] fast/parser/document-open-in-unload.html makes the following test crash
Hironori.Fujii@sony.com [Mon, 2 Jul 2018 01:52:14 +0000 (01:52 +0000)]
[WK2] fast/parser/document-open-in-unload.html makes the following test crash
https://bugs.webkit.org/show_bug.cgi?id=98345
<rdar://problem/12474923>

Reviewed by Ryosuke Niwa.

Source/WebCore:

m_documentLoader can become null in the middle of
FrameLoader::commitProvisionalLoad by stopping the loading.

No new tests (Covered by existing tests).

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad): Do null check of m_documentLoader.

LayoutTests:

* platform/wk2/TestExpectations: Unskipped fast/parser/document-open-in-unload.html.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233414 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Cocoa] LastResort in the font family list causes emoji with joiners to be rendered...
mmaxfield@apple.com [Mon, 2 Jul 2018 01:36:43 +0000 (01:36 +0000)]
[Cocoa] LastResort in the font family list causes emoji with joiners to be rendered as multiple .notdef characters
https://bugs.webkit.org/show_bug.cgi?id=187209
<rdar://problem/40920785>

Reviewed by Darin Adler.

Source/WebCore:

Inside our complex text codepath, we perform our own font fallback, which
includes a function that asks "can this font support this grapheme cluster?"
Because of the mechanics of how fonts work, the implementation of this
function is "Does the font's cmap table support every character of the
cluster?" We were using Font::glyphForCharacter() to determine this; however,
this function maps certain control characters to the zero width space
character (with the intention that these control characters shouldn't be
visible in the fast text codepath). That replacement, however, was causing
us to get false negatives, because Apple Color Emoji doesn't support zero
width space. Therefore, Apple Color Emoji was looking like it didn't support
emoji combining sequences.

The best solution to this would be to get Font::glyphForCharacter() to stop
performing these replacements (see https://bugs.webkit.org/show_bug.cgi?id=187166).
However, that is too risky of a change to be making right now. Instead,
a more localized solution is to implement a version of "Does the font's cmap
table support every character of the cluster" that doesn't perform the
substitutions. This patch does exactly that, and uses a bit vector to cache
the results. In order to not have a giant bit vector, we take the old code
path if we know the substitutions won't affect us (and uses ASSERT()s to
validate this) so the bit vector only holds at maximum 3 words of storage.

Test: fast/text/emoji-with-joiner.html

* platform/graphics/Font.cpp:
(WebCore::codePointSupportIndex):
(WebCore::createAndFillGlyphPage):
(WebCore::Font::platformSupportsCodePoint const):
(WebCore::Font::supportsCodePoint const):
(WebCore::Font::canRenderCombiningCharacterSequence const):
* platform/graphics/Font.h:
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformSupportsCodePoint const):

Source/WTF:

* wtf/unicode/CharacterNames.h:

LayoutTests:

* fast/text/emoji-with-joiner-expected.txt: Added.
* fast/text/emoji-with-joiner.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233413 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[macOS] Text replacements that end with symbols are expanded immediately
wenson_hsieh@apple.com [Mon, 2 Jul 2018 00:47:47 +0000 (00:47 +0000)]
[macOS] Text replacements that end with symbols are expanded immediately
https://bugs.webkit.org/show_bug.cgi?id=187225
<rdar://problem/41112433>

Reviewed by Darin Adler.

Source/WebCore:

In shipping Safari, enabling grammar correction causes text shortcuts that end with symbols or punctuation marks
to immediately trigger when typing; normally, when grammar correction is off, this is only triggered after the
user has additionally inserted a punctuation mark or whitespace character after the replaced text.

This bug happens because enabling grammar checking causes the spell checking range to expand to the range of the
full sentence, so any text checking results that replace an existing range are triggered as long as they end
anywhere in the sentence. In contrast, when grammar checking is disabled, the spell checking range is limited to
the nearest adjacent word, which prevents text replacement from occurring elsewhere in the sentence.

However, after r232530, we now always expand the spell checking range to the extent of the sentence when a word
is typed regardless of whether grammar checking is enabled, which means that the issue described above now
happens everywhere. To fix this recent regression and the existing bug, we:

-   Augment our spellchecking codepaths to include a new automatic text replacement range, alongside
    spellchecking and paragraph ranges.
-   Let this automatic text replacement range be the range of the adjacent word in the case where the user has
    finished typing a word.
-   When marking and replacing text checking results, consult this new automatic text replacement instead of the
    spellchecking range.

This keeps the behavior grammar and sentence retro correction results intact, while limiting the scope in which
text replacement results are applied.

Test: editing/spelling/text-replacement-after-typing-to-word.html

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::timerFired):
* editing/Editor.cpp:
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::markMisspellingsAfterTypingToWord):

Pass in the adjacent word range for the `automaticReplacementRange`, instead of the spell checking range (which
may be extended to the full range of the sentence).

(WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):

Add an `automaticReplacementRange` argument to markAllMisspellingsAndBadGrammarInRanges, and adjust call sites
to pass in a range (generally the same as the spell checking range, but in the case where a word has been typed,
this is a narrower range).

(WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
(WebCore::Editor::markAndReplaceFor):

When replacing text, only allow text replacement in the automatic replacement range rather than the spell
checking range.

(WebCore::Editor::markMisspellingsAndBadGrammar):
* editing/Editor.h:
* editing/SpellChecker.cpp:
(WebCore::SpellCheckRequest::SpellCheckRequest):

Add a new version of this constructor that takes a single Range representing both the spellchecking range and
the automatic text replacement range, for convenience.

(WebCore::SpellCheckRequest::create):
* editing/SpellChecker.h:

Add plumbing for the automatic replacement range.

(WebCore::SpellCheckRequest::automaticReplacementRange const):
* editing/TextCheckingHelper.cpp:

Add plumbing for the automatic replacement range, and new helpers to locate the range as offsets within the
text checking paragraph range.

(WebCore::TextCheckingParagraph::TextCheckingParagraph):
(WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
(WebCore::TextCheckingParagraph::automaticReplacementStart const):
(WebCore::TextCheckingParagraph::automaticReplacementLength const):
* editing/TextCheckingHelper.h:

Tools:

Adds testing support for mocking NSSpellChecker's text checking results. See below for more details, and the new
layout test for an example of its usage.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TestRunner.cpp:
(setSpellCheckerTextReplacementsCallback):

Add bindings support in TestRunner to specify a set of text replacement mappings. Each entry in the dictionary
maps a string representing an input to the NSSpellChecker to some information describing the spell checking
result that LayoutTestSpellChecker will return.

(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):

Restore the original shared NSSpellchecker before transitioning to the next layout test, if needed.

* DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm: Removed.
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setSpellCheckerLoggingEnabled):
(TestRunner::setSpellCheckerTextReplacements):

These testRunner methods ensure that `-[NSSpellChecker sharedSpellChecker]` is swizzled to return our mock
LayoutTestSpellChecker instance before calling into it.

* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setSpellCheckerTextReplacements):
* TestRunnerShared/cocoa/LayoutTestSpellChecker.h: Renamed from Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.h.
* TestRunnerShared/cocoa/LayoutTestSpellChecker.mm: Added.

Moved DumpRenderTreeSpellChecker to LayoutTestSpellChecker, and made it compile for both WebKitTestRunner
(modern WebKit) and DumpRenderTree (legacy WebKit) by putting it in TestRunnerShared.

(existingGlobalLayoutTestSpellChecker):
(ensureGlobalLayoutTestSpellChecker):
(stringForCorrectionResponse):
(nsTextCheckingType):
(-[LayoutTestTextCheckingResult initWithType:range:replacement:]):
(-[LayoutTestTextCheckingResult range]):
(-[LayoutTestTextCheckingResult resultType]):
(-[LayoutTestTextCheckingResult replacementString]):
(-[LayoutTestTextCheckingResult description]):

LayoutTestTextCheckingResult represents a fake NSTextCheckingResult containing spell checking results supplied
by the layout test.

(+[LayoutTestSpellChecker installIfNecessary]):
(+[LayoutTestSpellChecker uninstallAndReset]):

Helper methods to begin and end swizzling the shared NSSpellChecker.

(-[LayoutTestSpellChecker reset]):

Resets the state of the LayoutTestSpellChecker (this entails clearing the fake replacements dictionary and
turning off logging for recorded spellchecking responses).

(-[LayoutTestSpellChecker replacements]):
(-[LayoutTestSpellChecker setReplacements:]):
(-[LayoutTestSpellChecker setReplacementsFromJSObject:inContext:]):

Helper method to take a `JSObjectRef` supplied by the test runner and transform it into a map of spell checking
string inputs to LayoutTestTextCheckingResults.

(-[LayoutTestSpellChecker checkString:range:types:options:inSpellDocumentWithTag:orthography:wordCount:]):

Consult the text replacement map and bail early if a match is found, before calling into real NSSpellChecker
logic to perform spellchecking.

(-[LayoutTestSpellChecker recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:]):

Reimplement the original functionality in DumpRenderTreeSpellChecker to make `-recordResponse:…` print to stdout
by overriding the method and printing if the `-spellCheckerLoggingEnabled` property has been set to YES.

* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:

LayoutTests:

Adds a layout test to check that if a user has configured a text replacement that ends with punctuation, then:
1. Typing that text replacement won't immediately trigger replacement.
2. Text replacement is triggered after pressing enter.

* editing/spelling/text-replacement-after-typing-to-word-expected.txt: Added.
* editing/spelling/text-replacement-after-typing-to-word.html: Added.
* platform/ios/TestExpectations:
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233412 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[WPE][GTK] Fix retrieving backtrace from within flatpak sandbox in test runner
commit-queue@webkit.org [Sun, 1 Jul 2018 23:51:40 +0000 (23:51 +0000)]
[WPE][GTK] Fix retrieving backtrace from within flatpak sandbox in test runner
https://bugs.webkit.org/show_bug.cgi?id=187232

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-07-01
Reviewed by Michael Catanzaro.

The place where host tmp folder is mounted changed to /run/host/ we
need to take that into account.

Also explicitely close temporary files as relying on garbage collection to
remove them is a bad idea.

Also minor optimization avoiding to compile regex for each backtrace
retrieval.

* Scripts/webkitpy/port/linux_get_crash_log.py:
(GDBCrashLogGenerator):
(GDBCrashLogGenerator._get_tmp_file_name):
(GDBCrashLogGenerator._get_trace_from_systemd):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoJavaScriptCore: Fix clang static analyzer warnings: Assigned value is garbage or...
ddkilzer@apple.com [Sun, 1 Jul 2018 22:38:04 +0000 (22:38 +0000)]
JavaScriptCore: Fix clang static analyzer warnings: Assigned value is garbage or undefined
<https://webkit.org/b/187233>

Reviewed by Mark Lam.

* b3/air/AirEliminateDeadCode.cpp:
(JSC::B3::Air::eliminateDeadCode): Initialize `changed`.
* parser/ParserTokens.h:
(JSC::JSTextPosition::JSTextPosition): Add struct member
initialization. Simplify default constructor.
(JSC::JSTokenLocation::JSTokenData): Move largest struct in the
union to the beginning to make it easy to zero out all fields.
(JSC::JSTokenLocation::JSTokenLocation): Add struct member
initialization.  Simplify default constructor.  Note that
`endOffset` was not being initialized previously.
(JSC::JSTextPosition::JSToken): Add struct member initialization
where necessary.
* runtime/IntlObject.cpp:
(JSC::MatcherResult): Add struct member initialization.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Cocoa] Improve ARC compatibility of more code in JavaScriptCore
darin@apple.com [Sun, 1 Jul 2018 18:23:52 +0000 (18:23 +0000)]
[Cocoa] Improve ARC compatibility of more code in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=186973

Reviewed by Dan Bernstein.

Source/JavaScriptCore:

* API/JSContext.mm:
(WeakContextRef::WeakContextRef): Deleted.
(WeakContextRef::~WeakContextRef): Deleted.
(WeakContextRef::get): Deleted.
(WeakContextRef::set): Deleted.

* API/JSContextInternal.h: Removed unneeded header guards since this is
an Objective-C++ header. Removed unused WeakContextRef class. Removed declaration
of method -[JSContext initWithGlobalContextRef:] and JSContext property wrapperMap
since neither is used outside the class implementation.

* API/JSManagedValue.mm:
(-[JSManagedValue initWithValue:]): Use a bridging cast.
(-[JSManagedValue dealloc]): Ditto.
(-[JSManagedValue didAddOwner:]): Ditto.
(-[JSManagedValue didRemoveOwner:]): Ditto.
(JSManagedValueHandleOwner::isReachableFromOpaqueRoots): Ditto.
(JSManagedValueHandleOwner::finalize): Ditto.
* API/JSValue.mm:
(+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]): Ditto.
(+[JSValue valueWithNewErrorFromMessage:inContext:]): Ditto.
(-[JSValue valueForProperty:]): Ditto.
(-[JSValue setValue:forProperty:]): Ditto.
(-[JSValue deleteProperty:]): Ditto.
(-[JSValue hasProperty:]): Ditto.
(-[JSValue invokeMethod:withArguments:]): Ditto.
(valueToObjectWithoutCopy): Ditto. Also removed unneeded explicit type names.
(valueToArray): Ditto.
(valueToDictionary): Ditto.
(objectToValueWithoutCopy): Ditto.
(objectToValue): Ditto.
* API/JSVirtualMachine.mm:
(+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]): Ditto.
(+[JSVMWrapperCache wrapperForJSContextGroupRef:]): Ditto.
(-[JSVirtualMachine isOldExternalObject:]): Ditto.
(-[JSVirtualMachine addManagedReference:withOwner:]): Ditto.
(-[JSVirtualMachine removeManagedReference:withOwner:]): Ditto.
(-[JSVirtualMachine contextForGlobalContextRef:]): Ditto.
(-[JSVirtualMachine addContext:forGlobalContextRef:]): Ditto.
(scanExternalObjectGraph): Ditto.
(scanExternalRememberedSet): Ditto.
* API/JSWrapperMap.mm:
(makeWrapper): Ditto.
(-[JSObjCClassInfo wrapperForObject:inContext:]): Ditto.
(-[JSWrapperMap objcWrapperForJSValueRef:inContext:]): Ditto.
(tryUnwrapObjcObject): Ditto.
* API/ObjCCallbackFunction.mm:
(blockSignatureContainsClass): Ditto.
(objCCallbackFunctionForMethod): Switched from retain to CFRetain, but not
sure we will be keeping this the same way under ARC.
(objCCallbackFunctionForBlock): Use a bridging cast.

* API/ObjcRuntimeExtras.h:
(protocolImplementsProtocol): Use a more specific type that includes the
explicit __unsafe_unretained for copied protocol lists.
(forEachProtocolImplementingProtocol): Ditto.

* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::convertNSNullToNil): Added to replace the CONVERT_NSNULL_TO_NIL macro.
(Inspector::RemoteInspector::receivedSetupMessage): Use convertNSNullToNil.

* inspector/remote/cocoa/RemoteInspectorXPCConnection.mm: Moved the
CFXPCBridge SPI to a header named CFXPCBridgeSPI.h.
(auditTokenHasEntitlement): Deleted. Moved to Entitlements.h/cpp in WTF.
(Inspector::RemoteInspectorXPCConnection::handleEvent): Use WTF::hasEntitlement.
(Inspector::RemoteInspectorXPCConnection::sendMessage): Use a bridging cast.

Source/WebKit:

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::hasEntitlement): Use WTF::hasEntitlement.

* Shared/mac/SandboxUtilities.h: Removed connectedProcessHasEntitlement since
we can now use WTF::hasEntitlement instead.
* Shared/mac/SandboxUtilities.mm: Ditto.

* StorageProcess/ios/StorageProcessIOS.mm:
(WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement): Use
WTF::hasEntitlement.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::parentProcessHasServiceWorkerEntitlement): Ditto.

Source/WTF:

* WTF.xcodeproj/project.pbxproj: Added CFXPCBridgeSPI.h, fixed a few
other small problems in the project file, and let Xcode fix a few too.

* wtf/cocoa/Entitlements.h: Added hasEntitlement function with overloads
for an audit token and an XPC connection.
* wtf/cocoa/Entitlements.mm:
(WTF::hasEntitlement): Added, with overloads for a SecTask, an audit token,
and an XPC connection.
(WTF::processHasEntitlement): Refactored to use the function above.

* wtf/spi/cocoa/CFXPCBridgeSPI.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoPort JavaScriptCore to OS(FUCHSIA)
abarth@webkit.org [Sun, 1 Jul 2018 06:52:34 +0000 (06:52 +0000)]
Port JavaScriptCore to OS(FUCHSIA)
https://bugs.webkit.org/show_bug.cgi?id=187223

Reviewed by Daniel Bates.

.:

* Source/cmake/OptionsJSCOnly.cmake: Add back ICU.

Source/JavaScriptCore:

* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::cacheFlush): Call zx_cache_flush to flush cache.
* runtime/MachineContext.h: Fuchsia has the same mcontext_t as glibc.
(JSC::MachineContext::stackPointerImpl):
(JSC::MachineContext::framePointerImpl):
(JSC::MachineContext::instructionPointerImpl):
(JSC::MachineContext::argumentPointer<1>):
(JSC::MachineContext::llintInstructionPointer):

Source/WTF:

* wtf/Platform.h: Fuchsia uses mcontext_t to provide machine context.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233408 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agotest-webkitpy never rebuilds lldbWebKitTester
dbates@webkit.org [Sun, 1 Jul 2018 06:00:27 +0000 (06:00 +0000)]
test-webkitpy never rebuilds lldbWebKitTester
https://bugs.webkit.org/show_bug.cgi?id=187229

Reviewed by David Kilzer.

Have test-webkitpy always call script build-lldbwebkittester to build lldbWebKitTester, if needed.

Currently test-webkitpy only calls script build-lldbwebkittester if lldbWebKitTester does not
exist in the build products directory for the active configuration (e.g. Debug); => we do not
build lldbWebKitTester again if its source changes (say, as a result of hacking on lldbWebKitTester).
Instead we should have test-webkitpy unconditionally call build-lldbwebkittester to ensure
that we have an up-to-date build of lldbWebKitTester.

* Scripts/webkitpy/test/main.py:
(Tester._run_tests):
(_find_lldb_webkit_tester): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233407 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoFollow-up: Fix clang static analyzer warnings: Garbage return value
ddkilzer@apple.com [Sun, 1 Jul 2018 02:12:26 +0000 (02:12 +0000)]
Follow-up: Fix clang static analyzer warnings: Garbage return value
<https://webkit.org/b/187224>

Address review feedback from Eric Carlson.

* platform/mediastream/MediaConstraints.h:
(WebCore::NumericConstraint::valueForCapabilityRange const):
- Use brace initialization for more local variables.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233406 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAsan false positive: stack use after scope under WebCore::ApplyPropertyBorderImageMod...
mcatanzaro@igalia.com [Sun, 1 Jul 2018 01:49:50 +0000 (01:49 +0000)]
Asan false positive: stack use after scope under WebCore::ApplyPropertyBorderImageModifier in WebCore::Length::Length(WebCore::Length&&)
https://bugs.webkit.org/show_bug.cgi?id=186980
<rdar://problem/41409838>

Reviewed by Oliver Hunt.

We believe that we have found a bug in GCC's address sanitizer. It is blocking work on other
issues, so work around it by changing a temporary into a local variable.

* css/StyleBuilderCustom.h:
(WebCore::ApplyPropertyBorderImageModifier::applyInitialValue):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233405 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoFix off-by-one error in xdg_mime_get_simple_globs
mcatanzaro@igalia.com [Sun, 1 Jul 2018 01:15:38 +0000 (01:15 +0000)]
Fix off-by-one error in xdg_mime_get_simple_globs
https://bugs.webkit.org/show_bug.cgi?id=186554

Reviewed by Daniel Bates.

We have an off-by-one error here in some code that was added for WebKit. (This is not an
issue with upstream xdgmime.)

No new tests. This problem is caught by TestDownloads, but only when running with ASan
enabled.

* xdgmime/src/xdgmimecache.c:
(get_simple_globs):
* xdgmime/src/xdgmimeglob.c:
(get_simple_globs):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233404 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoFix clang static analyzer warnings: Garbage return value
ddkilzer@apple.com [Sun, 1 Jul 2018 00:06:38 +0000 (00:06 +0000)]
Fix clang static analyzer warnings: Garbage return value
<https://webkit.org/b/187224>

Reviewed by Eric Carlson.

Source/JavaScriptCore:

* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::lineNumberForBytecodeOffset):
- Use brace initialization for local variables.
* debugger/DebuggerCallFrame.cpp:
(class JSC::LineAndColumnFunctor):
- Use class member initialization for member variables.

Source/WebCore:

* platform/mediastream/MediaConstraints.h:
(WebCore::NumericConstraint::valueForCapabilityRange const):
- Use brace initialization for local variables.

Source/WebKit:

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::changeCount):
(WebKit::WebPlatformStrategies::addTypes):
(WebKit::WebPlatformStrategies::setTypes):
(WebKit::WebPlatformStrategies::setBufferForType):
(WebKit::WebPlatformStrategies::setPathnamesForType):
(WebKit::WebPlatformStrategies::setStringForType):
(WebKit::WebPlatformStrategies::getNumberOfFiles):
(WebKit::WebPlatformStrategies::getPasteboardItemsCount):
(WebKit::WebPlatformStrategies::writeCustomData):
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::WebEditorClient::substitutionsPanelIsShowing):
- Use brace initialization for local variables.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233403 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[CMake] build-webkit should be able to enable address sanitizer
mcatanzaro@igalia.com [Sat, 30 Jun 2018 21:07:50 +0000 (21:07 +0000)]
[CMake] build-webkit should be able to enable address sanitizer
https://bugs.webkit.org/show_bug.cgi?id=187222

Reviewed by Daniel Bates.

If 'set-webkit-configuration --asan' has been run, then build-webkit should pass
-DENABLE_ADDRESS_SANITIZER=ON to CMake, so that it actually does something.

This also works for build-jsc.

* Scripts/webkitdirs.pm:
(generateBuildSystemFromCMakeProject):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233402 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoPort WTF to OS(FUCHSIA)
abarth@webkit.org [Sat, 30 Jun 2018 20:53:56 +0000 (20:53 +0000)]
Port WTF to OS(FUCHSIA)
https://bugs.webkit.org/show_bug.cgi?id=187221

Reviewed by Yusuke Suzuki.

* wtf/FastMalloc.cpp: Fuchsia does not have resource.h
(WTF::fastMallocStatistics): Skip collecting stats without resource.h
* wtf/InlineASM.h: Fuchsia uses ELF
* wtf/Platform.h: Define OS(FUCHSIA) as an OS(UNIX) variant
* wtf/RandomDevice.cpp: Call zx_cprng_draw for crypographic randomness
(WTF::RandomDevice::cryptographicallyRandomValues):
* wtf/ThreadingPthreads.cpp: Fuchsia does not have pthread_setschedparam
(WTF::Thread::changePriority):
* wtf/unix/CPUTimeFuchsia.cpp: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233401 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed, add missing PLATFORM(COCOA) guard after r233207
mcatanzaro@igalia.com [Sat, 30 Jun 2018 18:44:34 +0000 (18:44 +0000)]
Unreviewed, add missing PLATFORM(COCOA) guard after r233207
https://bugs.webkit.org/show_bug.cgi?id=186788
<rdar://problem/41094167>

* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleExtendClassesForParameterCoder):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233400 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[LFC] Do not add the containing block's offset while computing the out-of-flow static...
zalan@apple.com [Sat, 30 Jun 2018 18:07:43 +0000 (18:07 +0000)]
[LFC] Do not add the containing block's offset while computing the out-of-flow static position.
https://bugs.webkit.org/show_bug.cgi?id=187202

Reviewed by Antti Koivisto.

The static position for an out-of-flow elements is
1. the distance from the parent's border box.
2. climbing up on the containing block chain and offset the containers until we reach the out-of-flow element's containing block.

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
(WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233399 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[LFC] If the top and bottom margins of a box are adjoining, then it is possible for...
zalan@apple.com [Sat, 30 Jun 2018 18:06:22 +0000 (18:06 +0000)]
[LFC] If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
https://bugs.webkit.org/show_bug.cgi?id=187220

Reviewed by Antti Koivisto.

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::isMarginBottomCollapsedThrough):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233398 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[LFC] Adjust final out-of-flow position with the computed margin value.
zalan@apple.com [Sat, 30 Jun 2018 18:04:58 +0000 (18:04 +0000)]
[LFC] Adjust final out-of-flow position with the computed margin value.
https://bugs.webkit.org/show_bug.cgi?id=187219

Reviewed by Antti Koivisto.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
(WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233397 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAdded a missing availability attribute.
mitz@apple.com [Sat, 30 Jun 2018 17:11:36 +0000 (17:11 +0000)]
Added a missing availability attribute.

* WebProcess/InjectedBundle/API/mac/WKWebProcessPlugIn.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233396 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoMake check_flatpak() not verbose when only trying to run command inside flatpak
commit-queue@webkit.org [Sat, 30 Jun 2018 14:24:22 +0000 (14:24 +0000)]
Make check_flatpak() not verbose when only trying to run command inside flatpak
https://bugs.webkit.org/show_bug.cgi?id=187187

Patch by Thibault Saunier <tsaunier@igalia.com> on 2018-06-30
Reviewed by Michael Catanzaro.

* flatpak/flatpakutils.py:
(run_in_sandbox_if_available):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233395 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Web Animations] Make WPT test at timing-model/timelines/document-timelines.html...
graouts@webkit.org [Sat, 30 Jun 2018 13:43:26 +0000 (13:43 +0000)]
[Web Animations] Make WPT test at timing-model/timelines/document-timelines.html pass reliably
https://bugs.webkit.org/show_bug.cgi?id=186507
<rdar://problem/41000257>

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Record WPT test progressions.

* web-platform-tests/web-animations/timing-model/timelines/document-timelines-expected.txt:

Source/WebCore:

The Web Animations spec, along with the HTML5 event loop spec, specify some assumptions on the time reported by
document.timeline.currentTime:

- it should only increase once per frame
- it should have the same value as the timestamp passed to requestAnimationFrame() callbacks

The WPT test at web-platform-tests/web-animations/timing-model/timelines/document-timelines.html relies on these
assumptions to be true so that we check that the start time of a new animation is not the same as the timeline time
when it was created, since it will be in the "play-pending" state for a frame.

In order to support this, we add two new methods on DocumentAnimationScheduler. First, when a scheduled display update
fires, we record the timestamp and expose it via lastTimestamp() such that DocumentTimeline and ScriptedAnimationController
can use the same value when updating animations. Then, to know whether code is run as a result of a display update, we
expose isFiring().

Now, within DocumentTimeline::currentTime(), we can cache the current time this way:

- if we're in the middle of a display update, use the value returned by lastTimestamp().
- otherwise, compute what would have been the ideal number of frames (at 60fps or less if throttled) and add those to
the lastTimestamp() value.

Then, we remove this cached current time when both currently-running JavaScript has completed and all animation update
code has completed by waiting on the invalidation task to run.

* animation/DocumentAnimationScheduler.cpp:
(WebCore::DocumentAnimationScheduler::displayRefreshFired):
* animation/DocumentAnimationScheduler.h:
(WebCore::DocumentAnimationScheduler::lastTimestamp):
(WebCore::DocumentAnimationScheduler::isFiring const):
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::currentTime):
(WebCore::DocumentTimeline::performInvalidationTask):
(WebCore::DocumentTimeline::maybeClearCachedCurrentTime):
* animation/DocumentTimeline.h:
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::serviceScriptedAnimations):
(WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):

LayoutTests:

This test now passes reliably.

* TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233394 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Web Animations] Make imported/mozilla/css-transitions/test_event-dispatch.html pass...
graouts@webkit.org [Sat, 30 Jun 2018 13:04:59 +0000 (13:04 +0000)]
[Web Animations] Make imported/mozilla/css-transitions/test_event-dispatch.html pass reliably
https://bugs.webkit.org/show_bug.cgi?id=183843

Unreviewed.

This test is no longer flaky, the fix for webkit.org/b/183834 fixed the issue.

* platform/ios/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233393 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed, rolling out r233391.
commit-queue@webkit.org [Sat, 30 Jun 2018 07:08:01 +0000 (07:08 +0000)]
Unreviewed, rolling out r233391.
https://bugs.webkit.org/show_bug.cgi?id=187217

This patch broke Windows ports (Requested by fredw on
#webkit).

Reverted changeset:

"WTF's internal std::optional implementation should abort() on
bad optional access"
https://bugs.webkit.org/show_bug.cgi?id=186536
https://trac.webkit.org/changeset/233391

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoWTF's internal std::optional implementation should abort() on bad optional access
commit-queue@webkit.org [Sat, 30 Jun 2018 06:42:04 +0000 (06:42 +0000)]
WTF's internal std::optional implementation should abort() on bad optional access
https://bugs.webkit.org/show_bug.cgi?id=186536

Patch by Frederic Wang <fwang@igalia.com> on 2018-06-29
Reviewed by Michael Catanzaro.

Source/WTF:

Currently, some ports built with recent compilers will cause the program to abort when one
tries to access the value of an unset std:optional (i.e. std::nullopt) as specified by C++17.
However, most ports still use WTF's internal std::optional implementation, which does not
verify illegal access. Hence it's not possible for developers working on these ports to
detect issues like bugs #186189, #186535, #186752, #186753, #187139 or #187145. WTF's version
of std::optional was introduced in bug #164199 but it was not possible to verify the
availability of the value inside constexpr member functions because the assert might involve
asm declarations. This commit introduces a new RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT macro
(a simplified version of RELEASE_ASSERT that can be used in constexpr context) and uses it in
WTF's implementation of std::optional.

* wtf/Assertions.h: Define RELEASE_ASSERT_UNDER_CONSTEXPR_CONTEXT as a version of
RELEASE_ASSERT that can be used in constexpr context (in particular avoids asm declarations).
* wtf/Optional.h:
(std::optional::operator ->): Add an assert to ensure the optional value is available.
(std::optional::operator *): Ditto.
(std::optional::value const): Ditto.
(std::optional::value): Ditto.
(std::optional<T::value const): Ditto.

LayoutTests:

* TestExpectations: Mark one WebAnimations test as crashing (bug #187145).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233391 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoCrash under WebCore::AXObjectCache::handleMenuItemSelected
n_wang@apple.com [Sat, 30 Jun 2018 05:40:44 +0000 (05:40 +0000)]
Crash under WebCore::AXObjectCache::handleMenuItemSelected
https://bugs.webkit.org/show_bug.cgi?id=186918
<rdar://problem/41365984>

Reviewed by Chris Fleizach.

Source/WebCore:

When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
But we did not remove the corresponding entry from the m_deferredFocusedNodeChange list. It would
then lead to a crash if we try to access the deleted node from m_deferredFocusedNodeChange.
Fixed it by removing the entry if the newly focused node is being destroyed.

Test: accessibility/accessibility-crash-focused-element-change.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::remove):

LayoutTests:

* accessibility/accessibility-crash-focused-element-change-expected.txt: Added.
* accessibility/accessibility-crash-focused-element-change.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233390 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoREGRESSION (r232806): Facebook login fields have blue fill background instead of...
antti@apple.com [Sat, 30 Jun 2018 03:02:24 +0000 (03:02 +0000)]
REGRESSION (r232806): Facebook login fields have blue fill background instead of white
https://bugs.webkit.org/show_bug.cgi?id=187207
Source/WebCore:

<rdar://problem/41606349>

Reviewed by Tim Horton.

This happens because a 'prefers-dark-interface' media query on UA sheet always evaluates to true in dark mode.

Tests: fast/forms/input-background-ua-media-query.html

* css/MediaQueryEvaluator.cpp:
(WebCore::prefersDarkInterfaceEvaluate):

Make prefers-dark-interface media query match only when using system appearance.

LayoutTests:

Reviewed by Tim Horton.

* fast/forms/input-background-ua-media-query-expected.html: Added.
* fast/forms/input-background-ua-media-query.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agobuild-webkit: Perl "use of uninitialized value $previousContents"
dbates@webkit.org [Sat, 30 Jun 2018 02:12:45 +0000 (02:12 +0000)]
build-webkit: Perl "use of uninitialized value $previousContents"
https://bugs.webkit.org/show_bug.cgi?id=185776

Reviewed by Michael Catanzaro.

Fixes an issue where reading an empty cached argument file would cause
Perl "uninitialized value" warnings of the form:
    Use of uninitialized value $previousContents in chomp at C:/WebKit-BuildWorker/wincairo-wkl-debug/build/Tools/Scripts/webkitdirs.pm line 1969.
    Use of uninitialized value $previousContents in string ne at C:/WebKit-BuildWorker/wincairo-wkl-debug/build/Tools/Scripts/webkitdirs.pm line 1972.

* Scripts/webkitdirs.pm:
(isCachedArgumentfileOutOfDate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233388 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoREGRESSION (r230921): Cannot log in to forums.swift.org using GitHub account
dbates@webkit.org [Sat, 30 Jun 2018 02:11:01 +0000 (02:11 +0000)]
REGRESSION (r230921): Cannot log in to forums.swift.org using GitHub account
https://bugs.webkit.org/show_bug.cgi?id=187197
<rdar://problem/40420821>

Reviewed by Brent Fulgham.

Source/WebCore:

Fixes an issue where a Same-Site cookies are not sent with any child window load if the
load is cross-origin with respect to the window's opener. One example where this issue
manifest itself was in the GitHub sign in flow on forums.swift.org.

Currently we always consider the origin of the window's opener (if we have one) when
determining whether a frame load request is same-origin and hence should send Same-Site
cookies when performing the request. So, when page A.com opens a child window to B.com and
then a person clicks a hyperlink or submits a form to B.com/b2 then we do not send Same-
Site cookies with the request to B.com/b2 (because its origin, B.com, is cross-origin
with its opener, A.com). But we should send Same-Site cookies with the request to B.com/b2
because it is same-origin with the page that initiated the request, B.com. Instead of
always considering the origin the window's opener for every frame load we should only
consider it for the first non-empty document load.

Tests: http/tests/cookies/same-site/fetch-in-about-blank-popup.html
       http/tests/cookies/same-site/post-from-cross-site-popup.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::addExtraFieldsToRequest):

LayoutTests:

Add tests to ensure that Same-Site cookies are sent in a subsequent same-origin form submission
from a child window that is cross-origin with its opener. Also add a test to ensure that Same-Site
cookies are visible to an about:blank pop-up window (as about:blank is Same-Site with its opener
by definition of being same-origin with it).

* http/tests/cookies/same-site/fetch-in-about-blank-popup-expected.txt: Added.
* http/tests/cookies/same-site/fetch-in-about-blank-popup.html: Added.
* http/tests/cookies/same-site/post-from-cross-site-popup-expected.txt: Added.
* http/tests/cookies/same-site/post-from-cross-site-popup.html: Added.
* http/tests/cookies/same-site/resources/post-from-popup.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233387 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoPerl uninitialized value $isEnabled when running build-jsc using a CMake build
dbates@webkit.org [Sat, 30 Jun 2018 02:06:23 +0000 (02:06 +0000)]
Perl uninitialized value $isEnabled when running build-jsc using a CMake build
https://bugs.webkit.org/show_bug.cgi?id=187208

Reviewed by Tim Horton.

Share logic for computing the feature flags to enable in CMake with both script
build-webkit and script build-jsc instead of duplicating it. This also fixes a
bug in the version of this logic in build-jsc that was inadvertently not updated
in r222394. In r222394 we removed the notion of a default value for a feature flag
listed in webkitperl::FeatureList.

We keep the current behavior of build-jsc and leave it up to the build system
to determine whether to enable or disable ENABLE_EXPERIMENTAL_FEATURES.

* Scripts/build-jsc:
(buildMyProject):
(cMakeArgsFromFeatures): Deleted.
* Scripts/build-webkit:
(cMakeArgsFromFeatures): Deleted; moved to webkitdirs.pm.
* Scripts/webkitdirs.pm:
(cmakeArgsFromFeatures): Moved code from script build-webkit so that it can be shared
with build-jsc.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233386 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAdd -apple-color-filter and system appearance toggles to MiniBrowser
timothy_horton@apple.com [Sat, 30 Jun 2018 01:20:02 +0000 (01:20 +0000)]
Add -apple-color-filter and system appearance toggles to MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=187210

Reviewed by Simon Fraser.

* MiniBrowser/mac/AppDelegate.m:
(defaultConfiguration):
* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController toggleAppleColorFilterEnabled:]):
(-[SettingsController appleColorFilterEnabled]):
(-[SettingsController toggleUseSystemAppearance:]):
(-[SettingsController useSystemAppearance]):
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]):
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233385 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoResource Load Statistics: Make network process calls only for the process pool that...
wilander@apple.com [Sat, 30 Jun 2018 01:07:38 +0000 (01:07 +0000)]
Resource Load Statistics: Make network process calls only for the process pool that the page belongs to
https://bugs.webkit.org/show_bug.cgi?id=187206
<rdar://problem/41659160>

Reviewed by Chris Dumez.

Instead of iterating over all process pools, we should resolve which
process pool the page belongs to and call the network process only for
that pool. This is especially important since we use WTFMove for the
completion handlers.

This patch also renames "callback" to "completionHandler" for
the functions touched.

A FIXME comment is added to WebsiteDataStore::getAllStorageAccessEntries()
where we currently don't have a page ID to do the lookup with.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies):
(WebKit::WebsiteDataStore::hasStorageAccessForFrameHandler):
(WebKit::WebsiteDataStore::getAllStorageAccessEntries):
(WebKit::WebsiteDataStore::grantStorageAccessHandler):
(WebKit::WebsiteDataStore::hasStorageAccess):
(WebKit::WebsiteDataStore::requestStorageAccess):
(WebKit::WebsiteDataStore::grantStorageAccess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233384 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoUnreviewed. Try to fix Windows build after r233377
sbarati@apple.com [Sat, 30 Jun 2018 00:55:57 +0000 (00:55 +0000)]
Unreviewed. Try to fix Windows build after r233377

* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createExecutable):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233383 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoSkip media/picture-in-picture-interruption.html on iOS since it relies on 'runWithKey...
ryanhaddad@apple.com [Sat, 30 Jun 2018 00:43:37 +0000 (00:43 +0000)]
Skip media/picture-in-picture-interruption.html on iOS since it relies on 'runWithKeyDown'.
https://bugs.webkit.org/show_bug.cgi?id=187181

Unreviewed test gardening.

* platform/ios/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233382 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoAdd utility methods to WebResourceLoadStatisticsStore to hop back and forth between...
cdumez@apple.com [Sat, 30 Jun 2018 00:35:29 +0000 (00:35 +0000)]
Add utility methods to WebResourceLoadStatisticsStore to hop back and forth between threads
https://bugs.webkit.org/show_bug.cgi?id=187200

Reviewed by Brent Fulgham.

Add utility methods to WebResourceLoadStatisticsStore to hop back and forth between threads,
in order the simplify the code a little bit.

* UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
(WebKit::ResourceLoadStatisticsMemoryStore::ResourceLoadStatisticsMemoryStore):
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::setNotifyPagesWhenDataRecordsWereScanned):
(WebKit::WebResourceLoadStatisticsStore::setShouldClassifyResourcesBeforeDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsStore::setShouldSubmitTelemetry):
(WebKit::WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore):
(WebKit::WebResourceLoadStatisticsStore::postTask):
(WebKit::WebResourceLoadStatisticsStore::postTaskReply):
(WebKit::WebResourceLoadStatisticsStore::flushAndDestroyPersistentStore):
(WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
(WebKit::WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing):
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
(WebKit::WebResourceLoadStatisticsStore::hasStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener):
(WebKit::WebResourceLoadStatisticsStore::grantStorageAccess):
(WebKit::WebResourceLoadStatisticsStore::performDailyTasks):
(WebKit::WebResourceLoadStatisticsStore::submitTelemetry):
(WebKit::WebResourceLoadStatisticsStore::logFrameNavigation):
(WebKit::WebResourceLoadStatisticsStore::logUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::clearUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::setLastSeen):
(WebKit::WebResourceLoadStatisticsStore::setPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::setVeryPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder):
(WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo):
(WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource):
(WebKit::WebResourceLoadStatisticsStore::setGrandfathered):
(WebKit::WebResourceLoadStatisticsStore::isGrandfathered):
(WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom):
(WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo):
(WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom):
(WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate):
(WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains):
(WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains):
(WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset):
(WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemory):
(WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent):
(WebKit::WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
(WebKit::WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree):
(WebKit::WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval):
(WebKit::WebResourceLoadStatisticsStore::setGrandfatheringTime):
(WebKit::WebResourceLoadStatisticsStore::setMaxStatisticsEntries):
(WebKit::WebResourceLoadStatisticsStore::setPruneEntriesDownTo):
(WebKit::WebResourceLoadStatisticsStore::resetParametersToDefaultValues):
* UIProcess/WebResourceLoadStatisticsStore.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementat...
darin@apple.com [Sat, 30 Jun 2018 00:23:43 +0000 (00:23 +0000)]
[Cocoa] reduce unnecessary use of .mm source files in WTF, spruce up some implementation details
https://bugs.webkit.org/show_bug.cgi?id=186924

Reviewed by Anders Carlsson.

* WTF.xcodeproj/project.pbxproj: Update for file and directory renames, file type changes,
and deletions.

* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::holdOff): Deleted empty placeholder; this one is not needed.

* wtf/PlatformMac.cmake: Update for file and directory renames, file type changes,
and deletions.

* wtf/cocoa/CPUTimeCocoa.cpp: Renamed from Source/WTF/wtf/cocoa/CPUTimeCocoa.mm.

* wtf/text/cocoa/StringImplCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringImplMac.mm.
Also removed an unneeded include.

* wtf/text/cocoa/StringViewCocoa.mm: Renamed from Source/WTF/wtf/text/mac/StringViewObjC.mm.

* wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp: Renamed from
Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233380 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months ago[macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
commit-queue@webkit.org [Sat, 30 Jun 2018 00:06:25 +0000 (00:06 +0000)]
[macOS] Do not crash if there is an attempt to copy a file URL to the clipboard
https://bugs.webkit.org/show_bug.cgi?id=187183

Patch by Aditya Keerthi <akeerthi@apple.com> on 2018-06-29
Reviewed by Wenson Hsieh.

Source/WebKit:

r210683 introduced logic to prevent file URLs from being copied to the clipboard
in unexpected cases. The current logic always crashes the WebProcess if
webProcessProxy->checkURLReceivedFromWebProcess returns false. Instead of
crashing, we can fail silently and not copy anything to the clipboard.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::setPasteboardPathnamesForType): Removed call to markCurrentlyDispatchedMessageAsInvalid() which was causing the process to crash.

Tools:

Added a 'runSingly' option to the TestOptions struct. Setting this option to true
will force a new PlatformWebView to be created before running a test. This ensures
that any state set by previous tests are not preserved.

One example of the importance of having this ability is in the case where we want
to test functionality that deals with read access to files. If a test were to
load a valid file URL, universal read access will be granted in WebProcessProxy.
This prevents us from testing cases that rely on us not have universal read
access. Now, if we write the test using the 'runSingly' option, any state set
by previous tests is cleared. Consequently, our test will behave as expected.

* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions const):
* WebKitTestRunner/TestController.cpp:
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):

LayoutTests:

Added a test to ensure that the WebProcess does not crash if we attempt to copy a
file URL to the clipboard. The test also ensures the clipboard content remains
unchanged.

* TestExpectations:
* http/tests/security/pasteboard-file-url-expected.txt: Added.
* http/tests/security/pasteboard-file-url.html: Added.
* platform/mac-wk2/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233379 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoDon't use tracePoints in JS/Wasm entry
sbarati@apple.com [Sat, 30 Jun 2018 00:05:36 +0000 (00:05 +0000)]
Don't use tracePoints in JS/Wasm entry
https://bugs.webkit.org/show_bug.cgi?id=187196

Reviewed by Mark Lam.

This puts VM entry and Wasm entry tracePoints behind a runtime
option. This is a ~4x speedup on a soon to be released Wasm
benchmark. tracePoints should basically never run more than 50
times a second. Entering the VM and entering Wasm are user controlled,
and can happen hundreds of thousands of times in a second. Depending
on how the Wasm/JS code is structured, this can be disastrous for
performance.

* runtime/Options.h:
* runtime/VMEntryScope.cpp:
(JSC::VMEntryScope::VMEntryScope):
(JSC::VMEntryScope::~VMEntryScope):
* wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::compileFunctions):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233378 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 months agoWe shouldn't recurse into the parser when gathering metadata about various function...
sbarati@apple.com [Fri, 29 Jun 2018 23:40:25 +0000 (23:40 +0000)]
We shouldn't recurse into the parser when gathering metadata about various function offsets
https://bugs.webkit.org/show_bug.cgi?id=184074
<rdar://problem/37165897>

Reviewed by Mark Lam.

JSTests:

* microbenchmarks/try-get-by-id-basic.js:
(const.bench.f.const.fooPlusBar.createBuiltin):
* microbenchmarks/try-get-by-id-polymorphic.js:
(fooPlusBar.createBuiltin):
* stress/array-push-with-force-exit.js:
* stress/dont-crash-on-stack-overflow-when-parsing-builtin.js: Added.
(f):
* stress/dont-crash-on-stack-overflow-when-parsing-default-constructor.js: Added.
(foo):
(prototype.runNearStackLimit):
* stress/is-constructor.js:
* stress/tailCallForwardArguments.js:
(putFuncToPrivateName.createBuiltin):

Source/JavaScriptCore:

Prior to this patch, when we made a builtin, we had to make an UnlinkedFunctionExecutable
for that builtin. This required calling into the parser. However, the parser
may throw a stack overflow. We were not able to recover from that. The only
reason we called into the parser here is that we were gathering text offsets
and various metadata for things in the builtin function. This patch writes a
mini parser that figures this information out without calling into the full
parser. (I've also added a debug assert that verifies the mini parser stays in
sync with the full parser.) The result of this is that BuiltinExecutbles::createExecutable
always succeeds.

* builtins/AsyncFromSyncIteratorPrototype.js:
(globalPrivate.createAsyncFromSyncIterator):
(globalPrivate.AsyncFromSyncIteratorConstructor):
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createExecutable):
* builtins/GlobalOperations.js:
(globalPrivate.getter.overriddenName.string_appeared_here.speciesGetter):
(globalPrivate.speciesConstructor):
(globalPrivate.copyDataProperties):
(globalPrivate.copyDataPropertiesNoExclusions):
* builtins/PromiseOperations.js:
(globalPrivate.newHandledRejectedPromise):
* builtins/RegExpPrototype.js:
(globalPrivate.hasObservableSideEffectsForRegExpMatch):
(globalPrivate.hasObservableSideEffectsForRegExpSplit):
* builtins/StringPrototype.js:
(globalPrivate.hasObservableSideEffectsForStringReplace):
(globalPrivate.getDefaultCollator):
* parser/Nodes.cpp:
(JSC::FunctionMetadataNode::FunctionMetadataNode):
(JSC::FunctionMetadataNode::operator== const):
(JSC::FunctionMetadataNode::dump const):
* parser/Nodes.h:
* parser/Parser.h:
(JSC::parse):
* parser/ParserError.h:
(JSC::ParserError::type const):
* parser/ParserTokens.h:
(JSC::JSTextPosition::operator== const):
(JSC::JSTextPosition::operator!= const):
* parser/SourceCode.h:
(JSC::SourceCode::operator== const):
(JSC::SourceCode::operator!= const):
(JSC::SourceCode::subExpression const):
(JSC::SourceCode::subExpression): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233377 268f45cc-cd09-0410-ab3c-d52691b4dbfc