2021-04-26 Russell Epstein Cherry-pick r271368. rdar://problem/77160704 Keep newly created IDBIndex objects in deleted map when IDBTransaction is aborted https://bugs.webkit.org/show_bug.cgi?id=220489 Patch by Sihui Liu on 2021-01-11 Reviewed by Youenn Fablet. Source/WebCore: When an upgrade transaction is aborted, we move objects from m_deletedIndexes to m_referencedIndexes to revert the index deletion operation. When updating m_referencedIndexes, we did not check whether key already exists. Therefore, some indexes in m_referencedIndexes would be replaced and destroyed (since m_referencedIndexes holds unique pointers) when the index is still referenced by JS. Tests: storage/indexeddb/modern/abort-index-info-private.html storage/indexeddb/modern/abort-index-info.html * Modules/indexeddb/IDBObjectStore.cpp: (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): LayoutTests: * storage/indexeddb/modern/abort-index-info-expected.txt: Added. * storage/indexeddb/modern/abort-index-info-private-expected.txt: Added. * storage/indexeddb/modern/abort-index-info-private.html: Added. * storage/indexeddb/modern/abort-index-info.html: Added. * storage/indexeddb/modern/resources/abort-index-info.js: Added. (prepareDatabase): (versionChangeSuccessCallback.secondRequest.onerror): (versionChangeSuccessCallback): (secondUpgradeNeeded): (checkState): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271368 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2021-01-11 Sihui Liu Keep newly created IDBIndex objects in deleted map when IDBTransaction is aborted https://bugs.webkit.org/show_bug.cgi?id=220489 Reviewed by Youenn Fablet. * storage/indexeddb/modern/abort-index-info-expected.txt: Added. * storage/indexeddb/modern/abort-index-info-private-expected.txt: Added. * storage/indexeddb/modern/abort-index-info-private.html: Added. * storage/indexeddb/modern/abort-index-info.html: Added. * storage/indexeddb/modern/resources/abort-index-info.js: Added. (prepareDatabase): (versionChangeSuccessCallback.secondRequest.onerror): (versionChangeSuccessCallback): (secondUpgradeNeeded): (checkState): 2019-07-01 Alan Coon Cherry-pick r244621. rdar://problem/52492610 PeatyG: Re-land fixes for 3 PeatyF Security Critical that accidentally got reverted in G. git-svn-id: https://svn.webkit.org/repository/webkit/branches/safari-607-branch@244621 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-06-12 Null Cherry-pick r246040. rdar://problem/51656856 [JSC] JSObject::attemptToInterceptPutByIndexOnHole should use getPrototype instead of getPrototypeDirect https://bugs.webkit.org/show_bug.cgi?id=198477 Reviewed by Saam Barati. Source/JavaScriptCore: JSObject::attemptToInterceptPutByIndexOnHole uses getPrototypeDirect, but it should use getPrototype to handle getPrototype methods in derived JSObject classes correctly. * runtime/JSArrayInlines.h: (JSC::JSArray::pushInline): * runtime/JSObject.cpp: (JSC::JSObject::putByIndex): (JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype): (JSC::JSObject::attemptToInterceptPutByIndexOnHole): (JSC::JSObject::putByIndexBeyondVectorLength): LayoutTests: Ensure that JSWindow::getPrototype is used. * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put-expected.txt: Added. * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html: Added. * http/tests/security/resources/cross-frame-iframe-for-object-getPrototypeOf-in-put-test.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246040 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-06-03 Yusuke Suzuki [JSC] JSObject::attemptToInterceptPutByIndexOnHole should use getPrototype instead of getPrototypeDirect https://bugs.webkit.org/show_bug.cgi?id=198477 Reviewed by Saam Barati. Ensure that JSWindow::getPrototype is used. * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put-expected.txt: Added. * http/tests/security/cross-frame-access-object-getPrototypeOf-in-put.html: Added. * http/tests/security/resources/cross-frame-iframe-for-object-getPrototypeOf-in-put-test.html: Added. 2019-05-30 Kocsen Chung Apply patch. rdar://problem/50753927 Add test coverage for https://bugs.webkit.org/show_bug.cgi?id=196730 Reviewed by Ryosuke Niwa. Tools: Add support for testRunner.abortModal() in macOS's WebKitTestRunner in order to match DumpRenderTree. * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::abortModal): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::runModal): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): * WebKitTestRunner/gtk/TestControllerGtk.cpp: (WTR::TestController::abortModal): * WebKitTestRunner/ios/TestControllerIOS.mm: (WTR::TestController::abortModal): * WebKitTestRunner/mac/TestControllerMac.mm: (WTR::TestController::abortModal): * WebKitTestRunner/win/TestControllerWin.cpp: (WTR::TestController::abortModal): LayoutTests: * http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt: Added. * http/tests/security/showModalDialog-sync-cross-origin-page-load.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@244898 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-02 Chris Dumez Add test coverage for https://bugs.webkit.org/show_bug.cgi?id=196730 Reviewed by Ryosuke Niwa. * http/tests/security/showModalDialog-sync-cross-origin-page-load-expected.txt: Added. * http/tests/security/showModalDialog-sync-cross-origin-page-load.html: Added. 2019-05-30 Kocsen Chung Cherry-pick r245664. rdar://problem/51264774 Subselectors not searched when determining property whitelist for selector https://bugs.webkit.org/show_bug.cgi?id=198147 Reviewed by Zalan Bujtas. Source/WebCore: This can cause marker elements get style they shouldn't. Test: fast/lists/marker-style-subselector-whitelist.html * css/RuleSet.cpp: (WebCore::determinePropertyWhitelistType): Check subselectors too. LayoutTests: * fast/lists/marker-style-subselector-whitelist-expected.txt: Added. * fast/lists/marker-style-subselector-whitelist.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245664 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-22 Antti Koivisto Subselectors not searched when determining property whitelist for selector https://bugs.webkit.org/show_bug.cgi?id=198147 Reviewed by Zalan Bujtas. * fast/lists/marker-style-subselector-whitelist-expected.txt: Added. * fast/lists/marker-style-subselector-whitelist.html: Added. 2019-05-30 Kocsen Chung Cherry-pick r245538. rdar://problem/50753927 Fix security check in ScriptController::canAccessFromCurrentOrigin() https://bugs.webkit.org/show_bug.cgi?id=196730 Reviewed by Ryosuke Niwa. Source/WebCore: Fix security check in ScriptController::canAccessFromCurrentOrigin() when there is no current JS exec state. Instead of returning true unconditionally, we now fall back to using the accessing document's origin for the security check. The new behavior is aligned with Blink: https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/html/html_frame_element_base.cc?rcl=d3f22423d512b45466f1694020e20da9e0c6ee6a&l=62 This fix is based on a patch from Sergei Glazunov . Test: http/tests/security/showModalDialog-sync-cross-origin-page-load2.html * bindings/js/ScriptController.cpp: (WebCore::ScriptController::canAccessFromCurrentOrigin): * bindings/js/ScriptController.h: * html/HTMLFrameElementBase.cpp: (WebCore::HTMLFrameElementBase::isURLAllowed const): LayoutTests: Add layout test coverage. * http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt: Added. * http/tests/security/showModalDialog-sync-cross-origin-page-load2.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245538 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-20 Chris Dumez Fix security check in ScriptController::canAccessFromCurrentOrigin() https://bugs.webkit.org/show_bug.cgi?id=196730 Reviewed by Ryosuke Niwa. Add layout test coverage. * http/tests/security/showModalDialog-sync-cross-origin-page-load2-expected.txt: Added. * http/tests/security/showModalDialog-sync-cross-origin-page-load2.html: Added. 2019-05-30 Kocsen Chung Cherry-pick r245509. rdar://problem/51264845 Wait to get frame until after layout has been run https://bugs.webkit.org/show_bug.cgi?id=197999 Reviewed by Alex Christensen. Source/WebCore: The current frame can change when layout runs, so don't bother retrieving the frame until the final layout pass is complete. Test: fast/dom/window-inner-width-crash.html * page/DOMWindow.cpp: (WebCore::DOMWindow::innerHeight const): Move frame access past the layout operation. (WebCore::DOMWindow::innerWidth const): Ditto. (WebCore::DOMWindow::scrollX const): Ditto. (WebCore::DOMWindow::scrollY const): Ditto. LayoutTests: * fast/dom/window-inner-width-crash-expected.txt: Added. * fast/dom/window-inner-width-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245509 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-19 Brent Fulgham Wait to get frame until after layout has been run https://bugs.webkit.org/show_bug.cgi?id=197999 Reviewed by Alex Christensen. * fast/dom/window-inner-width-crash-expected.txt: Added. * fast/dom/window-inner-width-crash.html: Added. 2019-05-30 Kocsen Chung Cherry-pick r245361. rdar://problem/51264842 Do not create a shape object outside of the layout context https://bugs.webkit.org/show_bug.cgi?id=197926 Reviewed by Simon Fraser. Source/WebCore: ShapeOutside objects are used to compute line constrains during layout (in a strict sense, they are part of the layout context and should only be mutated during layout). If we don't create one during layout, we probably don't need to know its geometry during paint (or any other non-layout activity) either. Test: fast/block/float/float-with-shape-outside-crash.html * rendering/FloatingObjects.cpp: (WebCore::ComputeFloatOffsetForLineLayoutAdapter::updateOffsetIfNeeded): (WebCore::ComputeFloatOffsetForLineLayoutAdapter::updateOffsetIfNeeded): * rendering/shapes/ShapeOutsideInfo.cpp: (WebCore::ShapeOutsideInfo::computeDeltasForContainingBlockLine): LayoutTests: * fast/block/float/float-with-shape-outside-crash-expected.txt: Added. * fast/block/float/float-with-shape-outside-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245361 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-15 Zalan Bujtas Do not create a shape object outside of the layout context https://bugs.webkit.org/show_bug.cgi?id=197926 Reviewed by Simon Fraser. * fast/block/float/float-with-shape-outside-crash-expected.txt: Added. * fast/block/float/float-with-shape-outside-crash.html: Added. 2019-05-30 Kocsen Chung Cherry-pick r245300. rdar://problem/51264763 Do not try to issue repaint while the render tree is being destroyed. https://bugs.webkit.org/show_bug.cgi?id=197461 Reviewed by Simon Fraser. Source/WebCore: Test: http/tests/svg/crash-on-reload-with-filter.html We don't need to compute repaint rects when the render tree is getting torn down. We'll issue a full repaint at some point. Also during full render tree destruction the inline tree state is undefined. We should avoid accessing it. * rendering/svg/RenderSVGResourceContainer.cpp: (WebCore::RenderSVGResourceContainer::markAllClientLayersForInvalidation): LayoutTests: * http/tests/svg/crash-on-reload-with-filter-expected.txt: Added. * http/tests/svg/crash-on-reload-with-filter.html: Added. * http/tests/svg/resources/finishTest.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245300 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-14 Zalan Bujtas Do not try to issue repaint while the render tree is being destroyed. https://bugs.webkit.org/show_bug.cgi?id=197461 Reviewed by Simon Fraser. * http/tests/svg/crash-on-reload-with-filter-expected.txt: Added. * http/tests/svg/crash-on-reload-with-filter.html: Added. * http/tests/svg/resources/finishTest.html: Added. 2019-05-30 Kocsen Chung Cherry-pick r244950. rdar://problem/51265731 TypedArrays should not store properties that are canonical numeric indices https://bugs.webkit.org/show_bug.cgi?id=197228 Reviewed by Saam Barati. JSTests: * stress/array-species-config-array-constructor.js: (test): * stress/put-direct-index-broken-2.js: * stress/typed-array-canonical-numeric-index-string.js: Added. (makeTest.assert): (makeTest): (const.testInvalidIndices.makeTest.set assert): (const.testInvalidIndices.makeTest): (const.makeTestValidIndex.configurable.set assert): (const.makeTestValidIndex.configurable): * stress/typedarray-access-monomorphic-neutered.js: (checkNoException): (testNoException): (testFTLNoException): * stress/typedarray-access-neutered.js: (testNoException): * stress/typedarray-getownproperty-not-configurable.js: (foo): * test262/expectations.yaml: Source/JavaScriptCore: According to the spec[1]: - TypedArrays should not perform an ordinary GetOwnProperty/SetOwnProperty if the index is a CanonicalNumericIndexString, but invalid according to IntegerIndexedElementGet and similar functions. I.e., there are a few properties that should not be set in a TypedArray, like NaN, Infinity and -0. - On DefineOwnProperty, the out-of-bounds check should be performed before validating the property descriptor. - On GetOwnProperty, the returned descriptor for numeric properties should have writable set to true. [1]: https://www.ecma-international.org/ecma-262/9.0/index.html#sec-integer-indexed-exotic-objects-defineownproperty-p-desc * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView::getOwnPropertySlot): (JSC::JSGenericTypedArrayView::put): (JSC::JSGenericTypedArrayView::defineOwnProperty): (JSC::JSGenericTypedArrayView::getOwnPropertySlotByIndex): (JSC::JSGenericTypedArrayView::putByIndex): * runtime/PropertyName.h: (JSC::isCanonicalNumericIndexString): LayoutTests: * fast/canvas/canvas-ImageData-behaviour-expected.txt: * fast/canvas/canvas-ImageData-behaviour.js: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244950 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-04 Tadeu Zagallo TypedArrays should not store properties that are canonical numeric indices https://bugs.webkit.org/show_bug.cgi?id=197228 Reviewed by Saam Barati. * fast/canvas/canvas-ImageData-behaviour-expected.txt: * fast/canvas/canvas-ImageData-behaviour.js: 2019-05-30 Kocsen Chung Cherry-pick r244892. rdar://problem/50753927 Setting a frame's src to a javascript URL should not run it synchronously https://bugs.webkit.org/show_bug.cgi?id=197466 Reviewed by Darin Adler. Source/WebCore: When an iframe's src attribute is set to a javascript URL, whether when parsing or later on via JS, we now execute the URL's JavaScript asynchronously. We used to execute it synchronously, which was a source of bugs and also did not match other browsers. I have verified that our new behavior is aligned with both Firefox and Chrome. Note that for backward-compatibility and interoperability with Blink (https://bugs.chromium.org/p/chromium/issues/detail?id=923585), the "javascript:''" URL will still run synchronously. We should consider dropping this quirk at some point. Test: fast/dom/frame-src-javascript-url-async.html * loader/NavigationScheduler.cpp: (WebCore::ScheduledLocationChange::ScheduledLocationChange): (WebCore::ScheduledLocationChange::~ScheduledLocationChange): (WebCore::NavigationScheduler::scheduleLocationChange): * loader/NavigationScheduler.h: (WebCore::NavigationScheduler::scheduleLocationChange): * loader/SubframeLoader.cpp: (WebCore::SubframeLoader::requestFrame): LayoutTests: * fast/dom/frame-src-javascript-url-async-expected.txt: Added. * fast/dom/frame-src-javascript-url-async.html: Added. Add layout test coverage for the fact that the javascript URL is executed asynchronously whether set during parsing or later via JS. Also makes sure that executing the javascript URL asynchronously does not replace the frame's window. This test passes in both Chrome and Firefox. * imported/blink/fast/frames/navigation-in-pagehide.html: Re-sync this test from the Blink repository. * fast/dom/Element/id-in-frameset-expected.txt: * fast/dom/Element/id-in-frameset.html: * fast/dom/insertedIntoDocument-iframe-expected.txt: * fast/dom/javascript-url-exception-isolation-expected.txt: * fast/dom/javascript-url-exception-isolation.html: * fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt: * fast/dom/resources/javascript-url-crash-function-iframe.html: * fast/frames/adopt-from-created-document.html: * fast/frames/out-of-document-iframe-has-child-frame.html: * fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html: * fast/loader/javascript-url-iframe-remove-on-navigate.html: * fast/loader/unload-mutation-crash.html: * fast/parser/resources/set-parent-to-javascript-url.html: * fast/parser/xml-error-adopted.xml: * http/tests/navigation/lockedhistory-iframe-expected.txt: * http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-javascript-url-iframe-in-iframe-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-allowed-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-by-default-src-star-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-expected.txt: * http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-sub-frame-2-level.html: * http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-sub-frame.html: * http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-from-javscript-url.html: * imported/blink/loader/iframe-sync-loads-expected.txt: * js/dom/call-base-resolution.html: * platform/wk2/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-javascript-url-iframe-in-iframe-expected.txt: Update / Rebaseline existing tests to reflect behavior change. I ran those tests in Firefox and Chrome to confirm that our behavior is indeed aligned. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244892 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-02 Chris Dumez Setting a frame's src to a javascript URL should not run it synchronously https://bugs.webkit.org/show_bug.cgi?id=197466 Reviewed by Darin Adler. * fast/dom/frame-src-javascript-url-async-expected.txt: Added. * fast/dom/frame-src-javascript-url-async.html: Added. Add layout test coverage for the fact that the javascript URL is executed asynchronously whether set during parsing or later via JS. Also makes sure that executing the javascript URL asynchronously does not replace the frame's window. This test passes in both Chrome and Firefox. * imported/blink/fast/frames/navigation-in-pagehide.html: Re-sync this test from the Blink repository. * fast/dom/Element/id-in-frameset-expected.txt: * fast/dom/Element/id-in-frameset.html: * fast/dom/insertedIntoDocument-iframe-expected.txt: * fast/dom/javascript-url-exception-isolation-expected.txt: * fast/dom/javascript-url-exception-isolation.html: * fast/dom/no-assert-for-malformed-js-url-attribute-expected.txt: * fast/dom/resources/javascript-url-crash-function-iframe.html: * fast/frames/adopt-from-created-document.html: * fast/frames/out-of-document-iframe-has-child-frame.html: * fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html: * fast/loader/javascript-url-iframe-remove-on-navigate.html: * fast/loader/unload-mutation-crash.html: * fast/parser/resources/set-parent-to-javascript-url.html: * fast/parser/xml-error-adopted.xml: * http/tests/navigation/lockedhistory-iframe-expected.txt: * http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-javascript-url-iframe-in-iframe-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-allowed-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-by-default-src-star-expected.txt: * http/tests/security/contentSecurityPolicy/javascript-url-blocked-expected.txt: * http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-sub-frame-2-level.html: * http/tests/security/javascriptURL/xss-ALLOWED-from-javascript-url-sub-frame.html: * http/tests/security/javascriptURL/xss-ALLOWED-to-javascript-url-from-javscript-url.html: * imported/blink/loader/iframe-sync-loads-expected.txt: * js/dom/call-base-resolution.html: * platform/wk2/http/tests/security/contentSecurityPolicy/block-all-mixed-content/insecure-image-in-javascript-url-iframe-in-iframe-expected.txt: Update / Rebaseline existing tests to reflect behavior change. I ran those tests in Firefox and Chrome to confirm that our behavior is indeed aligned. 2019-05-23 Ryan Haddad Land test changes for rdar://problem/51086725. * inspector/runtime/parse-expected.txt: * inspector/runtime/parse.html: 2019-05-16 Shawn Roberts quicklook/numbers.html is an ImageOnlyFailure https://bugs.webkit.org/show_bug.cgi?id=191711 Unreviewed test gardening. * platform/ios-simulator-wk2/TestExpectations: Updating expectations for branch 2019-05-14 Kocsen Chung Cherry-pick r245158. rdar://problem/50753914 Do not mix inline and block level boxes. https://bugs.webkit.org/show_bug.cgi?id=197462 Reviewed by Antti Koivisto. Source/WebCore: This patch tightens the remove-anonymous-wrappers logic by checking if the removal would produce an inline-block sibling mix. When a block level box is removed from the tree, we check if after the removal the anonymous sibling block boxes are still needed or whether we can removed them as well (and have only inline level child boxes). In addition to checking if the container is anonymous and is part of a continuation, we also need to check if collapsing it (and by that moving its children one level up) would cause a inline-block box mix. Test: fast/ruby/continuation-and-column-spanner-crash.html * rendering/updating/RenderTreeBuilder.cpp: (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded): * rendering/updating/RenderTreeBuilderContinuation.cpp: (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy): LayoutTests: * fast/ruby/continuation-and-column-spanner-crash-expected.txt: Added. * fast/ruby/continuation-and-column-spanner-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245158 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-05-08 Zalan Bujtas Do not mix inline and block level boxes. https://bugs.webkit.org/show_bug.cgi?id=197462 Reviewed by Antti Koivisto. * fast/ruby/continuation-and-column-spanner-crash-expected.txt: Added. * fast/ruby/continuation-and-column-spanner-crash.html: Added. 2019-05-14 Kocsen Chung Cherry-pick r239742. rdar://problem/50753925 Prevent cross-site top-level navigations from third-party iframes https://bugs.webkit.org/show_bug.cgi?id=193076 Reviewed by Alex Christensen. Source/WebCore: Prevent cross-site top-level navigations from third-party iframes if the following conditions are met: 1. Its tries to navigate the top-level page cross-site (different eTDL+1) 2. The user has never interacted with the third-party iframe or any of its subframes This experiment's intent is to block suspicious main-frame navigations by third-party content. The feature is behind a runtime experimental feature flag, on by default. Tests: http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html http/tests/security/block-top-level-navigations-by-third-party-iframes.html * dom/Document.cpp: (WebCore::printNavigationErrorMessage): (WebCore::Document::canNavigate): (WebCore::Document::canNavigateInternal): (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking): * dom/Document.h: * dom/UserGestureIndicator.cpp: * page/DOMWindow.cpp: (WebCore::DOMWindow::setLocation): * page/DOMWindow.h: * page/Frame.h: * page/Location.cpp: (WebCore::Location::replace): (WebCore::Location::setLocation): * page/Settings.yaml: Source/WebKit: Add experimental feature flag, on by default. * Shared/WebPreferences.yaml: LayoutTests: Add layout test coverage. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin-expected.txt: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation-expected.txt: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation-expected.txt: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html: Added. * http/tests/security/block-top-level-navigations-by-third-party-iframes-expected.txt: Added. * http/tests/security/block-top-level-navigations-by-third-party-iframes.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-failure-page.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-success-page-same-origin.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-success-page-with-previous-user-gesture.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-success-page-with-user-gesture.html: Added. * http/tests/security/resources/should-have-loaded.html: Added. * http/tests/security/resources/should-not-have-loaded.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239742 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-08 Chris Dumez Prevent cross-site top-level navigations from third-party iframes https://bugs.webkit.org/show_bug.cgi?id=193076 Reviewed by Alex Christensen. Add layout test coverage. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin-expected.txt: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation-expected.txt: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation-expected.txt: Added. * http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html: Added. * http/tests/security/block-top-level-navigations-by-third-party-iframes-expected.txt: Added. * http/tests/security/block-top-level-navigations-by-third-party-iframes.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-failure-page.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-success-page-same-origin.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-success-page-with-previous-user-gesture.html: Added. * http/tests/security/resources/navigate-top-level-frame-to-success-page-with-user-gesture.html: Added. * http/tests/security/resources/should-have-loaded.html: Added. * http/tests/security/resources/should-not-have-loaded.html: Added. 2019-04-10 Alan Coon Cherry-pick r243841. rdar://problem/49725678 -apple-trailing-word is needed for browser detection https://bugs.webkit.org/show_bug.cgi?id=196575 Unreviewed. PerformanceTests: * MotionMark/resources/debug-runner/motionmark.css: (#intro .start-benchmark p): Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: This is an unreviewed partial revert of r243819. Turns out there are some websites which use this property to do browser detection. So, we need to continue to parse the property, but we don't need the property to do anything. Test: fast/text/trailing-word-detection.html * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator TrailingWord const): * css/CSSProperties.json: * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::trailingWord const): (WebCore::RenderStyle::setTrailingWord): (WebCore::RenderStyle::initialTrailingWord): * rendering/style/RenderStyleConstants.h: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: * fast/text/trailing-word-detection-expected.txt: Added. * fast/text/trailing-word-detection.html: Added. * platform/gtk/TestExpectations: * platform/win/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243841 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-04-03 Myles C. Maxfield -apple-trailing-word is needed for browser detection https://bugs.webkit.org/show_bug.cgi?id=196575 Unreviewed. * fast/text/trailing-word-detection-expected.txt: Added. * fast/text/trailing-word-detection.html: Added. * platform/gtk/TestExpectations: * platform/win/TestExpectations: 2019-04-10 Alan Coon Cherry-pick r243819. rdar://problem/49725678 Remove support for -apple-trailing-word https://bugs.webkit.org/show_bug.cgi?id=196525 Reviewed by Zalan Bujtas. This CSS property is nonstandard and not used. .: * Source/cmake/WebKitFeatures.cmake: Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: * Configurations/FeatureDefines.xcconfig: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::operator TrailingWord const): Deleted. * css/CSSProperties.json: * css/CSSValueKeywords.in: * css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): * rendering/SimpleLineLayoutCoverage.cpp: (WebCore::SimpleLineLayout::printReason): * rendering/SimpleLineLayoutCoverage.h: * rendering/line/BreakingContext.h: (WebCore::BreakingContext::BreakingContext): (WebCore::BreakingContext::lineBreak): (WebCore::BreakingContext::clearLineBreakIfFitsOnLine): (WebCore::BreakingContext::commitLineBreakClear): (WebCore::BreakingContext::commitLineBreakAtCurrentWidth): (WebCore::BreakingContext::handleBR): (WebCore::BreakingContext::handleFloat): (WebCore::BreakingContext::handleText): (WebCore::BreakingContext::handleEndOfLine): (WebCore::BreakingContext::InlineIteratorHistory::InlineIteratorHistory): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::push): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::update): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::renderer const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::offset const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::atTextParagraphSeparator const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::previousInSameNode const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::get const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::current const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::historyLength const): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::moveTo): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::increment): Deleted. (WebCore::BreakingContext::InlineIteratorHistory::clear): Deleted. (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord): Deleted. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::trailingWord const): Deleted. (WebCore::RenderStyle::setTrailingWord): Deleted. (WebCore::RenderStyle::initialTrailingWord): Deleted. * rendering/style/RenderStyleConstants.h: * rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * rendering/style/StyleRareInheritedData.h: Source/WebCore/PAL: * Configurations/FeatureDefines.xcconfig: Source/WebInspectorUI: * UserInterface/Models/CSSKeywordCompletions.js: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Tools: * Scripts/webkitperl/FeatureList.pm: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: LayoutTests: * fast/text/trailing-word-expected.html: Removed. * fast/text/trailing-word.html: Removed. * platform/gtk/TestExpectations: * platform/mac/fast/text/trailing-word-parse-expected.txt: Removed. * platform/mac/fast/text/trailing-word-parse.html: Removed. * platform/win/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243819 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-04-03 Myles C. Maxfield Remove support for -apple-trailing-word https://bugs.webkit.org/show_bug.cgi?id=196525 Reviewed by Zalan Bujtas. This CSS property is nonstandard and not used. * fast/text/trailing-word-expected.html: Removed. * fast/text/trailing-word.html: Removed. * platform/gtk/TestExpectations: * platform/mac/fast/text/trailing-word-parse-expected.txt: Removed. * platform/mac/fast/text/trailing-word-parse.html: Removed. * platform/win/TestExpectations: 2019-04-09 Alan Coon Cherry-pick r243828. rdar://problem/49725673 Documents can be destroyed before their CSSFontFaceSet is destroyed https://bugs.webkit.org/show_bug.cgi?id=195830 Reviewed by Darin Adler. Source/WebCore: CSSFontFaceSet has a raw pointer to its owning document. JS can keep the CSSFontFaceSet alive (by using FontFaceSet) and can destroy the document at any time. When the document is destroyed, the link between the two objects needs to be severed. Test: fast/text/font-face-set-destroy-document.html * css/CSSFontFace.cpp: (WebCore::CSSFontFace::CSSFontFace): * css/CSSFontFace.h: * css/CSSFontFaceSet.cpp: (WebCore::CSSFontFaceSet::CSSFontFaceSet): (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): * css/CSSFontFaceSet.h: * css/CSSFontSelector.cpp: (WebCore::CSSFontSelector::CSSFontSelector): (WebCore::CSSFontSelector::addFontFaceRule): * css/CSSFontSelector.h: * css/FontFace.cpp: (WebCore::FontFace::FontFace): LayoutTests: * fast/text/font-face-set-destroy-document-expected.html: Added. * fast/text/font-face-set-destroy-document.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243828 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-04-03 Myles C. Maxfield Documents can be destroyed before their CSSFontFaceSet is destroyed https://bugs.webkit.org/show_bug.cgi?id=195830 Reviewed by Darin Adler. * fast/text/font-face-set-destroy-document-expected.html: Added. * fast/text/font-face-set-destroy-document.html: Added. 2019-04-09 Alan Coon Cherry-pick r243786. rdar://problem/49725702 REGRESSION (r238266): Exchange 2013 Outlook Web Access displays partially blank page when creating new e-mail https://bugs.webkit.org/show_bug.cgi?id=196522 Source/WebCore: rdar://problem/49472941 Reviewed by Zalan Bujtas. In this content a layer is composited to clip descendants, and has negative z-order children, so we compute that it "paints into ancestor", and has a foreground layer. This combination doesn't make sense, and when the layer becomes scrollable, we end up with bad paint phases on layers, and fail to paint the contents. Fix by ensuring that a layer has its own backing store if it requires a foreground layer by virtue of having negative z-order children. Test: compositing/backing/foreground-layer-no-paints-into-ancestor.html * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::requiresOwnBackingStore const): LayoutTests: Reviewed by Zalan Bujtas. * compositing/backing/foreground-layer-no-paints-into-ancestor-expected.html: Added. * compositing/backing/foreground-layer-no-paints-into-ancestor.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243786 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-04-02 Simon Fraser REGRESSION (r238266): Exchange 2013 Outlook Web Access displays partially blank page when creating new e-mail https://bugs.webkit.org/show_bug.cgi?id=196522 Reviewed by Zalan Bujtas. * compositing/backing/foreground-layer-no-paints-into-ancestor-expected.html: Added. * compositing/backing/foreground-layer-no-paints-into-ancestor.html: Added. 2019-04-09 Alan Coon Cherry-pick r243660. rdar://problem/49725670 [Simple line layout] Turn off inline boxtree generation for multiline content https://bugs.webkit.org/show_bug.cgi?id=196404 Reviewed by Simon Fraser. Source/WebCore: Currently simple line layout can't provide the correct line breaking context to the inline tree when the boxtree is generated using the simple line runs. This patch limits the generation of such trees to single lines. Multiline content will go through the "let's layout this content again" codepath. This patch fixes disappearing content on Questar. Test: fast/text/simple-line-layout-and-multiline-inlineboxtree.html * rendering/SimpleLineLayoutFunctions.cpp: (WebCore::SimpleLineLayout::canUseForLineBoxTree): LayoutTests: * fast/text/simple-line-layout-and-multiline-inlineboxtree-expected.html: Added. * fast/text/simple-line-layout-and-multiline-inlineboxtree.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243660 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-29 Zalan Bujtas [Simple line layout] Turn off inline boxtree generation for multiline content https://bugs.webkit.org/show_bug.cgi?id=196404 Reviewed by Simon Fraser. * fast/text/simple-line-layout-and-multiline-inlineboxtree-expected.html: Added. * fast/text/simple-line-layout-and-multiline-inlineboxtree.html: Added. 2019-04-09 Alan Coon Cherry-pick r243605. rdar://problem/49725707 [SimpleLineLayout] Disable SLL when text-underline-position is not auto. https://bugs.webkit.org/show_bug.cgi?id=196338 Reviewed by Daniel Bates. Source/WebCore: Disable simple line layout unconditionally on non-auto text-underline-position content. We don't support it yet. Test: fast/text/simple-line-layout-with-text-underline-position.html * rendering/SimpleLineLayout.cpp: (WebCore::SimpleLineLayout::canUseForStyle): LayoutTests: * fast/text/simple-line-layout-with-text-underline-position-expected.html: Added. * fast/text/simple-line-layout-with-text-underline-position.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243605 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-28 Zalan Bujtas [SimpleLineLayout] Disable SLL when text-underline-position is not auto. https://bugs.webkit.org/show_bug.cgi?id=196338 Reviewed by Daniel Bates. * fast/text/simple-line-layout-with-text-underline-position-expected.html: Added. * fast/text/simple-line-layout-with-text-underline-position.html: Added. 2019-04-09 Alan Coon Cherry-pick r241931. rdar://problem/49725665 Fix the test failure following r241918 (https://bugs.webkit.org/show_bug.cgi?id=194906) For some reason strict cookies are sent via HTTP in WK1 and not in WK2. Will investigate in . This sub-test failure occurs with and without the patch. As the primary purpose of this test was to ensure correctness for Same Site lax cookies, I've amended the test and test result for now. * http/tests/cookies/same-site/user-load-cross-site-redirect-expected.txt: * http/tests/cookies/same-site/user-load-cross-site-redirect.php: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241931 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-21 Daniel Bates Fix the test failure following r241918 (https://bugs.webkit.org/show_bug.cgi?id=194906) For some reason strict cookies are sent via HTTP in WK1 and not in WK2. Will investigate in . This sub-test failure occurs with and without the patch. As the primary purpose of this test was to ensure correctness for Same Site lax cookies, I've amended the test and test result for now. * http/tests/cookies/same-site/user-load-cross-site-redirect-expected.txt: * http/tests/cookies/same-site/user-load-cross-site-redirect.php: 2019-04-09 Alan Coon Cherry-pick r241918. rdar://problem/49725665 Same Site Lax cookies are not sent with cross-site redirect from client-initiated load https://bugs.webkit.org/show_bug.cgi?id=194906 Reviewed by Brent Fulgham. Source/WebCore: Ensure that a request for a top-level navigation is annotated as such regardless of whether the request has a computed Same Site policy. "New loads" initiated by a the client (Safari) either by API or a human either explicitly typing a URL in the address bar or Command + clicking a hyperlink to open it in a new window/tab are always considered Same Site. This is by definition from the spec. [1] as we aren't navigating from an existing page. (Command + click should be thought of as a convenience to the user from having to copy the hyperlink's URL, create a new window, and paste the URL into the address bar). Currently the frame loader marks a request as a top-level navigation if and only if the request does not have a pre-computed Same Site policy. However, "New loads" have a pre-computed Same Site policy. So, these loads would never be marked as a top-level navigation by the frame loading code. Therefore, if the "new load" turned out to be a cross-site redirect then WebKit would incorrectly tell the networking stack that the load was a cross-site, non-top-level navigation, and per the Same Site spec [2], the networking stack would not send Same Site Lax cookies. Instead, WebKit should unconditionally ensure that requests are marked as a top-level navigation, if applicable. [1] See Note for (1) in [2] Test: http/tests/cookies/same-site/user-load-cross-site-redirect.php * loader/FrameLoader.cpp: (WebCore::FrameLoader::addExtraFieldsToRequest): Unconditionally update the request's top- level navigation bit. * platform/network/ResourceRequestBase.cpp: (WebCore::ResourceRequestBase::setAsIsolatedCopy): Unconditionally copy a request's top- level navigation bit. LayoutTests: Add a test that is representative of a user loading a cross-site page that redirects to a page that expects Same Site Lax cookies. * http/tests/cookies/same-site/user-load-cross-site-redirect-expected.txt: Added. * http/tests/cookies/same-site/user-load-cross-site-redirect.php: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241918 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-21 Daniel Bates Same Site Lax cookies are not sent with cross-site redirect from client-initiated load https://bugs.webkit.org/show_bug.cgi?id=194906 Reviewed by Brent Fulgham. Add a test that is representative of a user loading a cross-site page that redirects to a page that expects Same Site Lax cookies. * http/tests/cookies/same-site/user-load-cross-site-redirect-expected.txt: Added. * http/tests/cookies/same-site/user-load-cross-site-redirect.php: Added. 2019-04-04 Ryan Haddad Cherry-pick r243768. rdar://problem/49539493 [Mojave] Layout test fast/text/complex-initial-advance.html is failing https://bugs.webkit.org/show_bug.cgi?id=196512 Unreviewed test gardening. * platform/mac/TestExpectations: Mark test as failing. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@243768 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-04-02 Ryan Haddad [Mojave] Layout test fast/text/complex-initial-advance.html is failing https://bugs.webkit.org/show_bug.cgi?id=196512 Unreviewed test gardening. * platform/mac/TestExpectations: Mark test as failing. 2019-04-04 Ryan Haddad Cherry-pick r241307. rdar://problem/49610758 AX: Fix flaky accessibility/loading-iframe-sends-notification.html https://bugs.webkit.org/show_bug.cgi?id=194546 Reviewed by Zalan Bujtas. This test was relying on timing between load events being sent and accessibility events being sent. We don't need to do that, we can more directly test this interplay. * accessibility/loading-iframe-sends-notification-expected.txt: * accessibility/loading-iframe-sends-notification.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@241307 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-12 Chris Fleizach AX: Fix flaky accessibility/loading-iframe-sends-notification.html https://bugs.webkit.org/show_bug.cgi?id=194546 Reviewed by Zalan Bujtas. This test was relying on timing between load events being sent and accessibility events being sent. We don't need to do that, we can more directly test this interplay. * accessibility/loading-iframe-sends-notification-expected.txt: * accessibility/loading-iframe-sends-notification.html: 2019-04-02 Kocsen Chung Cherry-pick r240492. rdar://problem/49539128 webkitpy: Implement device type specific expected results (Gardening) https://bugs.webkit.org/show_bug.cgi?id=192162 Unreviewed test gardening. * platform/ios/TestExpectations: Remove non-existant directories. * platform/mac/TestExpectations: Ditto. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240492 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-25 Jonathan Bedard webkitpy: Implement device type specific expected results (Gardening) https://bugs.webkit.org/show_bug.cgi?id=192162 Unreviewed test gardening. * platform/ios/TestExpectations: Remove non-existant directories. * platform/mac/TestExpectations: Ditto. 2019-04-02 Kocsen Chung Cherry-pick r240157. rdar://problem/49539128 webkitpy: Implement device type specific expected results (Follow-up fix) https://bugs.webkit.org/show_bug.cgi?id=192162 Unreviewed test gardening. * tiled-drawing/ios/iphone7: Removed. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240157 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-18 Jonathan Bedard webkitpy: Implement device type specific expected results (Follow-up fix) https://bugs.webkit.org/show_bug.cgi?id=192162 Unreviewed test gardening. * tiled-drawing/ios/iphone7: Removed. 2019-04-02 Kocsen Chung Cherry-pick r240150. rdar://problem/49539128 webkitpy: Implement device type specific expected results (Part 2) https://bugs.webkit.org/show_bug.cgi?id=192162 Rubber-stamped by Aakash Jain. Tools: This change uses device_type to select a different set of TestExpectation files based on the type of device running tests. This requires multiple baseline search paths to be used in a single instantiation of run-webkit-tests. Note that while multiple baseline search paths are used, any single test will only ever be run on a single device type. * Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py: (LayoutTestFinder.find_tests): Pass device_type through. * Scripts/webkitpy/layout_tests/controllers/layout_test_finder_unittest.py: (LayoutTestFinderTests.test_touched_but_skipped_test): Allow device_type to be passed in. * Scripts/webkitpy/layout_tests/controllers/manager.py: (Manager.__init__): Make _expectations an OrderedDict indexed by device_type, add current_device_type. (Manager._collect_tests): Pass device type to test finder. (Manager._needs_web_platform_test): (Manager._prepare_lists): Index _expectations by device type. (Manager._test_input_for_file): (Manager._test_is_slow): Ditto. (Manager._test_should_dump_jsconsolelog_in_stderr): (Manager._test_should_dump_jsconsolelog_in_stderr): Ditto. (Manager._get_test_inputs): (Manager._update_worker_count): (Manager._set_up_run): Use current_device_type instead of passing device_type in. (Manager.run): Re-write function to gather and parse expectations from multiple baseline search paths. In the event that a test can be run on multiple device types, the first device in the device type list which is eligible will be the one which runs the test. (Manager._run_test_subset): (Manager._run_tests): Index _expectations by current_device_type. (Manager._print_expectation_line_for_test): Ditto. (Manager._print_expectations_for_subset): Ditto. (Manager.print_expectations): Re-write function to gather and parse expectations from multiple baseline search paths. Unlike run, this function will behave the same regardless of what devices are available. (Manager._custom_device_for_test): Deleted. * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py: (ManagerTest.test_uses_custom_device): Deleted. (ManagerTest.test_uses_custom_device.get_manager): Deleted. * Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py: (JSONLayoutResultsGenerator.__init__): Pass expectations as a dictionary indexed by device type. (JSONLayoutResultsGenerator._insert_failure_summaries): The number of fixable tests must take into consideration all of the expectations. * Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py: (FakePort.skipped_layout_tests): Allow device_type to be passed in. * Scripts/webkitpy/layout_tests/models/test_expectations.py: (TestExpectations.__init__): Allow device_type to be passed through. (TestExpectations.parse_all_expectations): Pick expectations_dict by device type. * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Allow device_type to be passed in. * Scripts/webkitpy/layout_tests/models/test_run_results.py: (summarize_results): * Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py: (summarized_results): Expectations are stored in a dictionary indexed by device_type. When determining the expectation a test ran with, one must check all expectations to find the first non-skip expectation. * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py: (RunTest.test_device_type_test_division): (RunTest): (RunTest.test_device_type_specific_listing): * Scripts/webkitpy/port/base.py: (Port): Add default values for DEVICE_TYPE and DEFAULT_DEVICE_TYPES. (Port.supported_device_types): The result of this function will change based on what devices are available. * Scripts/webkitpy/port/device_port.py: (DevicePort._device_type_with_version): Replace DEFAULT_DEVICE_TYPE with DEVICE_TYPE. (DevicePort.default_child_processes): DEVICE_TYPE is a general type, so the built-in comparison of the DeviceType object can be used. (DevicePort.supported_device_types): Generates a list of device types determined by the available devices, if there are any, or the DEFAULT_DEVICE_TYPES of the port. * Scripts/webkitpy/port/ios.py: (IOSPort): Change DEFAULT_DEVICE_TYPE to DEVICE_TYPE. * Scripts/webkitpy/port/ios_simulator.py: (IOSSimulatorPort): Set the DEFAULT_DEVICE_TYPES to the devices currently used to run layout tests. * Scripts/webkitpy/port/watch.py: (WatchPort): Change DEFAULT_DEVICE_TYPE to DEVICE_TYPE. * Scripts/webkitpy/port/watch_simulator.py: (WatchSimulatorPort): Set the DEFAULT_DEVICE_TYPES to the device currently used to run layout tests. * Scripts/webkitpy/xcode/device_type.py: (DeviceType): (DeviceType.__hash__): Allow DeviceType to be used as a dictionary index. LayoutTests: Move iPad and iPhone 7 tests to their respective platform specific directories. * TestExpectations: * fast/events/touch/ios/iphone7: Removed. * fast/forms/ios/ipad: Removed. * fast/text-autosizing/ios/ipad: Removed. * fast/viewport/ios/ipad: Removed. * media/controls/ipad: Removed. * media/modern-media-controls/media-documents/ipad: Removed. * media/modern-media-controls/pip-support/ipad: Removed. * platform/ios-wk1/TestExpectations: * platform/ios/TestExpectations: * platform/ipad: Added. * platform/ipad/fast: Added. * platform/ipad/fast/forms: Added. * platform/ipad/fast/forms/choose-select-option-expected.txt: Added. * platform/ipad/fast/forms/choose-select-option.html: Added. * platform/ipad/fast/forms/focus-input-via-button-expected.txt: Added. * platform/ipad/fast/forms/focus-input-via-button.html: Added. * platform/ipad/fast/forms/multiple-select-updates-renderer-expected.txt: Added. * platform/ipad/fast/forms/multiple-select-updates-renderer.html: Added. * platform/ipad/fast/forms/select-form-run-twice-expected.txt: Added. * platform/ipad/fast/forms/select-form-run-twice.html: Added. * platform/ipad/fast/forms/select-with-title-expected.txt: Added. * platform/ipad/fast/forms/select-with-title.html: Added. * platform/ipad/fast/forms/unfocus-inside-fixed-hittest-expected.txt: Added. * platform/ipad/fast/forms/unfocus-inside-fixed-hittest.html: Added. * platform/ipad/fast/text-autosizing: Added. * platform/ipad/fast/text-autosizing/programmatic-text-size-adjust-expected.txt: Added. * platform/ipad/fast/text-autosizing/programmatic-text-size-adjust.html: Added. * platform/ipad/fast/text-autosizing/text-size-adjust-inline-style-expected.html: Added. * platform/ipad/fast/text-autosizing/text-size-adjust-inline-style.html: Added. * platform/ipad/fast/viewport: Added. * platform/ipad/fast/viewport/empty-meta-expected.txt: Added. * platform/ipad/fast/viewport/empty-meta.html: Added. * platform/ipad/fast/viewport/meta-viewport-ignored-expected.txt: Added. * platform/ipad/fast/viewport/meta-viewport-ignored.html: Added. * platform/ipad/fast/viewport/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport-expected.txt: Added. * platform/ipad/fast/viewport/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport.html: Added. * platform/ipad/fast/viewport/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport-expected.txt: Added. * platform/ipad/fast/viewport/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport.html: Added. * platform/ipad/fast/viewport/width-is-device-width-expected.txt: Added. * platform/ipad/fast/viewport/width-is-device-width.html: Added. * platform/ipad/media: Added. * platform/ipad/media/controls: Added. * platform/ipad/media/controls/close-page-with-picture-in-picture-video-assertion-failure-expected.txt: Added. * platform/ipad/media/controls/close-page-with-picture-in-picture-video-assertion-failure.html: Added. * platform/ipad/media/controls/resources: Added. * platform/ipad/media/controls/resources/picture-in-picture.html: Added. * platform/ipad/media/modern-media-controls: Added. * platform/ipad/media/modern-media-controls/media-documents: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-audio-ios-sizing-expected.txt: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html: Added. * platform/ipad/media/modern-media-controls/pip-support: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-enabled-expected.txt: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-enabled.html: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-tap-expected.txt: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-tap.html: Added. * platform/iphone-7: Added. * platform/iphone-7/fast: Added. * platform/iphone-7/fast/events: Added. * platform/iphone-7/fast/events/touch: Added. * platform/iphone-7/fast/events/touch/force-press-event-expected.txt: Added. * platform/iphone-7/fast/events/touch/force-press-event.html: Added. * platform/iphone-7/fast/events/touch/force-press-on-link-expected.txt: Added. * platform/iphone-7/fast/events/touch/force-press-on-link.html: Added. * platform/iphone-7/fast/events/touch/prevent-default-touchmove-prevents-scrolling-expected.txt: Added. * platform/iphone-7/fast/events/touch/prevent-default-touchmove-prevents-scrolling.html: Added. * platform/iphone-7/tiled-drawing: Added. * platform/iphone-7/tiled-drawing/compositing-layers-deep-color-expected.txt: Added. * platform/iphone-7/tiled-drawing/compositing-layers-deep-color.html: Added. * platform/mac-wk2/TestExpectations: * platform/mac/TestExpectations: * tiled-drawing/ios: Removed. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240150 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-01-18 Jonathan Bedard webkitpy: Implement device type specific expected results (Part 2) https://bugs.webkit.org/show_bug.cgi?id=192162 Rubber-stamped by Aakash Jain. Move iPad and iPhone 7 tests to their respective platform specific directories. * TestExpectations: * fast/events/touch/ios/iphone7: Removed. * fast/forms/ios/ipad: Removed. * fast/text-autosizing/ios/ipad: Removed. * fast/viewport/ios/ipad: Removed. * media/controls/ipad: Removed. * media/modern-media-controls/media-documents/ipad: Removed. * media/modern-media-controls/pip-support/ipad: Removed. * platform/ios-wk1/TestExpectations: * platform/ios/TestExpectations: * platform/ipad: Added. * platform/ipad/fast: Added. * platform/ipad/fast/forms: Added. * platform/ipad/fast/forms/choose-select-option-expected.txt: Added. * platform/ipad/fast/forms/choose-select-option.html: Added. * platform/ipad/fast/forms/focus-input-via-button-expected.txt: Added. * platform/ipad/fast/forms/focus-input-via-button.html: Added. * platform/ipad/fast/forms/multiple-select-updates-renderer-expected.txt: Added. * platform/ipad/fast/forms/multiple-select-updates-renderer.html: Added. * platform/ipad/fast/forms/select-form-run-twice-expected.txt: Added. * platform/ipad/fast/forms/select-form-run-twice.html: Added. * platform/ipad/fast/forms/select-with-title-expected.txt: Added. * platform/ipad/fast/forms/select-with-title.html: Added. * platform/ipad/fast/forms/unfocus-inside-fixed-hittest-expected.txt: Added. * platform/ipad/fast/forms/unfocus-inside-fixed-hittest.html: Added. * platform/ipad/fast/text-autosizing: Added. * platform/ipad/fast/text-autosizing/programmatic-text-size-adjust-expected.txt: Added. * platform/ipad/fast/text-autosizing/programmatic-text-size-adjust.html: Added. * platform/ipad/fast/text-autosizing/text-size-adjust-inline-style-expected.html: Added. * platform/ipad/fast/text-autosizing/text-size-adjust-inline-style.html: Added. * platform/ipad/fast/viewport: Added. * platform/ipad/fast/viewport/empty-meta-expected.txt: Added. * platform/ipad/fast/viewport/empty-meta.html: Added. * platform/ipad/fast/viewport/meta-viewport-ignored-expected.txt: Added. * platform/ipad/fast/viewport/meta-viewport-ignored.html: Added. * platform/ipad/fast/viewport/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport-expected.txt: Added. * platform/ipad/fast/viewport/viewport-overriden-by-minimum-effective-width-if-ignore-meta-viewport.html: Added. * platform/ipad/fast/viewport/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport-expected.txt: Added. * platform/ipad/fast/viewport/viewport-unchanged-by-minimum-effective-width-if-not-ignore-meta-viewport.html: Added. * platform/ipad/fast/viewport/width-is-device-width-expected.txt: Added. * platform/ipad/fast/viewport/width-is-device-width.html: Added. * platform/ipad/media: Added. * platform/ipad/media/controls: Added. * platform/ipad/media/controls/close-page-with-picture-in-picture-video-assertion-failure-expected.txt: Added. * platform/ipad/media/controls/close-page-with-picture-in-picture-video-assertion-failure.html: Added. * platform/ipad/media/controls/resources: Added. * platform/ipad/media/controls/resources/picture-in-picture.html: Added. * platform/ipad/media/modern-media-controls: Added. * platform/ipad/media/modern-media-controls/media-documents: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-audio-ios-sizing-expected.txt: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt: Added. * platform/ipad/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html: Added. * platform/ipad/media/modern-media-controls/pip-support: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-enabled-expected.txt: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-enabled.html: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-tap-expected.txt: Added. * platform/ipad/media/modern-media-controls/pip-support/pip-support-tap.html: Added. * platform/iphone-7: Added. * platform/iphone-7/fast: Added. * platform/iphone-7/fast/events: Added. * platform/iphone-7/fast/events/touch: Added. * platform/iphone-7/fast/events/touch/force-press-event-expected.txt: Added. * platform/iphone-7/fast/events/touch/force-press-event.html: Added. * platform/iphone-7/fast/events/touch/force-press-on-link-expected.txt: Added. * platform/iphone-7/fast/events/touch/force-press-on-link.html: Added. * platform/iphone-7/fast/events/touch/prevent-default-touchmove-prevents-scrolling-expected.txt: Added. * platform/iphone-7/fast/events/touch/prevent-default-touchmove-prevents-scrolling.html: Added. * platform/iphone-7/tiled-drawing: Added. * platform/iphone-7/tiled-drawing/compositing-layers-deep-color-expected.txt: Added. * platform/iphone-7/tiled-drawing/compositing-layers-deep-color.html: Added. * platform/mac-wk2/TestExpectations: * platform/mac/TestExpectations: * tiled-drawing/ios: Removed. 2019-03-27 Alan Coon Cherry-pick r242943. rdar://problem/49307995 Cleanup inline boxes when list marker gets blockified https://bugs.webkit.org/show_bug.cgi?id=195746 Reviewed by Antti Koivisto. Source/WebCore: Normally when an element gets blockified (inline -> block) we destroy its renderer and construct a new one (RenderInline -> RenderBlock). During this process the associated inline boxtree gets destroyed as well. Since RenderListMarker is just a generic RenderBox, the blockifying change does not require a new renderer. This patch takes care of destroying the inline boxtree when the marker gains block display type. Test: fast/block/float/list-marker-is-float-crash.html * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::styleDidChange): LayoutTests: * fast/block/float/list-marker-is-float-crash-expected.txt: Added. * fast/block/float/list-marker-is-float-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242943 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-14 Zalan Bujtas Cleanup inline boxes when list marker gets blockified https://bugs.webkit.org/show_bug.cgi?id=195746 Reviewed by Antti Koivisto. * fast/block/float/list-marker-is-float-crash-expected.txt: Added. * fast/block/float/list-marker-is-float-crash.html: Added. 2019-03-27 Alan Coon Cherry-pick r243506. rdar://problem/49307987 vertexAttribPointer must restrict offset parameter https://bugs.webkit.org/show_bug.cgi?id=196261 Reviewed by Antoine Quint. Source/WebCore: This WebGL function should fail if the offset parameter is not within [0, max 32-bit int]. Test: fast/canvas/webgl/vertexAttribPointer-with-bad-offset.html * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::vertexAttribPointer): LayoutTests: Add a test where the offset parameter is out of bounds. * fast/canvas/webgl/vertexAttribPointer-with-bad-offset-expected.txt: Added. * fast/canvas/webgl/vertexAttribPointer-with-bad-offset.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243506 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-26 Dean Jackson vertexAttribPointer must restrict offset parameter https://bugs.webkit.org/show_bug.cgi?id=196261 Reviewed by Antoine Quint. Add a test where the offset parameter is out of bounds. * fast/canvas/webgl/vertexAttribPointer-with-bad-offset-expected.txt: Added. * fast/canvas/webgl/vertexAttribPointer-with-bad-offset.html: Added. 2019-03-27 Alan Coon Cherry-pick r243331. rdar://problem/49308068 Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer. https://bugs.webkit.org/show_bug.cgi?id=195919 Reviewed by Brent Fulgham. Source/WebCore: When the container is injected too early, we might end up removing it as part of the collapsing logic while the text renderer is being removed (replaced with the first letter + remaining text). Test: fast/css/first-letter-and-float-crash.html * rendering/updating/RenderTreeBuilderFirstLetter.cpp: (WebCore::RenderTreeBuilder::FirstLetter::createRenderers): LayoutTests: * fast/css/first-letter-and-float-crash-expected.txt: Added. * fast/css/first-letter-and-float-crash.html: Added. * platform/mac/TestExpectations: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243331 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-21 Zalan Bujtas Do not insert the first-letter anonymous container until after we've constructed the first-letter renderer. https://bugs.webkit.org/show_bug.cgi?id=195919 Reviewed by Brent Fulgham. * fast/css/first-letter-and-float-crash-expected.txt: Added. * fast/css/first-letter-and-float-crash.html: Added. * platform/mac/TestExpectations: 2019-03-27 Alan Coon Cherry-pick r242919. rdar://problem/49307949 Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow https://bugs.webkit.org/show_bug.cgi?id=195701 Reviewed by Simon Fraser. Source/WebCore: It's safer to use existing RenderBox functions to get sibling boxes. Test: fast/ruby/crash-when-paginated-ruby.html * rendering/RenderMultiColumnFlow.cpp: (WebCore::RenderMultiColumnFlow::nextColumnSetOrSpannerSiblingOf): (WebCore::RenderMultiColumnFlow::previousColumnSetOrSpannerSiblingOf): LayoutTests: * fast/ruby/crash-when-paginated-ruby-expected.txt: Added. * fast/ruby/crash-when-paginated-ruby.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242919 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-13 Zalan Bujtas Use RenderBox::previousSiblingBox/nextSiblingBox in RenderMultiColumnFlow https://bugs.webkit.org/show_bug.cgi?id=195701 Reviewed by Simon Fraser. * fast/ruby/crash-when-paginated-ruby-expected.txt: Added. * fast/ruby/crash-when-paginated-ruby.html: Added. 2019-03-27 Alan Coon Cherry-pick r242917. rdar://problem/49307956 Fix an edge case where HTMLFormElement::removeFormElement is invoked twice with the same element https://bugs.webkit.org/show_bug.cgi?id=195663 Reviewed by Ryosuke Niwa. Source/WebCore: Currently, it's possible for HTMLFormControlElement's destructor to be reentrant. This may happen if the form control element is ref'd while carrying out its destructor's logic. This may happen in two places in HTMLFormControlElement (didChangeForm and resetDefaultButton), both of which actually don't require ensuring a protected reference to the form control element since they should never result in any script execution. To fix the bug, convert these strong references into raw pointers, and add ScriptDisallowedScope to ensure that we don't change these codepaths in the future, such that they trigger arbitrary script execution. Test: fast/forms/remove-associated-element-after-gc.html * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::didChangeForm): * html/HTMLFormElement.cpp: (WebCore::HTMLFormElement::resetDefaultButton): LayoutTests: Add a layout test to exercise the scenario described in the WebCore ChangeLog. * fast/forms/remove-associated-element-after-gc-expected.txt: Added. * fast/forms/remove-associated-element-after-gc.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242917 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-13 Wenson Hsieh Fix an edge case where HTMLFormElement::removeFormElement is invoked twice with the same element https://bugs.webkit.org/show_bug.cgi?id=195663 Reviewed by Ryosuke Niwa. Add a layout test to exercise the scenario described in the WebCore ChangeLog. * fast/forms/remove-associated-element-after-gc-expected.txt: Added. * fast/forms/remove-associated-element-after-gc.html: Added. 2019-03-18 Kocsen Chung Apply patch. rdar://problem/48839387 2019-03-18 John Wilander Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration (branch patch) https://bugs.webkit.org/show_bug.cgi?id=195711 Reviewed by Brent Fulgham. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html: Added. * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html: 2019-03-13 Babak Shafiei Cherry-pick r242749. rdar://problem/48839358 [macOS] Dispatching reentrant "contextmenu" events may cause crashes https://bugs.webkit.org/show_bug.cgi?id=195571 Reviewed by Andy Estes. Source/WebCore: Make ContextMenuController::handleContextMenuEvent robust against reentrancy by guarding it with a boolean flag. As demonstrated in the test case, it is currently possible to force WebKit into a bad state by dispatching a synthetic "contextmenu" event from within the scope of one of the "before(copy|cut|paste)" events triggered as a result of handling a context menu event. Test: fast/events/contextmenu-reentrancy-crash.html * page/ContextMenuController.cpp: (WebCore::ContextMenuController::handleContextMenuEvent): * page/ContextMenuController.h: LayoutTests: Add a test to verify that triggering reentrant "contextmenu" events from script does not cause a crash. * fast/events/contextmenu-reentrancy-crash-expected.txt: Added. * fast/events/contextmenu-reentrancy-crash.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242749 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-11 Wenson Hsieh [macOS] Dispatching reentrant "contextmenu" events may cause crashes https://bugs.webkit.org/show_bug.cgi?id=195571 Reviewed by Andy Estes. Add a test to verify that triggering reentrant "contextmenu" events from script does not cause a crash. * fast/events/contextmenu-reentrancy-crash-expected.txt: Added. * fast/events/contextmenu-reentrancy-crash.html: Added. 2019-03-13 Babak Shafiei Cherry-pick r242587. rdar://problem/48839354 Crash when attempting to change input type while dismissing datalist suggestions https://bugs.webkit.org/show_bug.cgi?id=195384 Reviewed by Brent Fulgham. Source/WebCore: When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly reference its active datalist suggestions picker. Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html * platform/DataListSuggestionPicker.h: Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h). Source/WebKit: See WebCore ChangeLog for more details. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setActiveDataListSuggestionPicker): (WebKit::WebPage::didSelectDataListOption): (WebKit::WebPage::didCloseSuggestions): * WebProcess/WebPage/WebPage.h: Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr. LayoutTests: Add a new layout test to exercise this scenario. * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added. * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242587 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-06 Wenson Hsieh Crash when attempting to change input type while dismissing datalist suggestions https://bugs.webkit.org/show_bug.cgi?id=195384 Reviewed by Brent Fulgham. Add a new layout test to exercise this scenario. * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added. * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added. 2019-03-13 Babak Shafiei Cherry-pick r242515. rdar://problem/48839275 SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList https://bugs.webkit.org/show_bug.cgi?id=195333 Reviewed by Simon Fraser. Source/WebCore: Because the SVG1.1 specs states that the newItem should be removed from its original list before adding it to another list, SVGPathSegList.insertItemBefore() should fail if the new item belongs to an animating animPathSegList since it is read-only. Test: svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg * svg/SVGPathSegList.cpp: (WebCore::SVGPathSegList::processIncomingListItemValue): LayoutTests: * svg/dom/SVGPathSegList-insert-from-animating-animPathSegList-expected.txt: Added. * svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242515 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-03-05 Said Abou-Hallawa SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList https://bugs.webkit.org/show_bug.cgi?id=195333 Reviewed by Simon Fraser. * svg/dom/SVGPathSegList-insert-from-animating-animPathSegList-expected.txt: Added. * svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg: Added. 2019-03-13 Babak Shafiei Cherry-pick r241608. rdar://problem/48839277 [WebVTT] Inline WebVTT styles should start with '::cue' https://bugs.webkit.org/show_bug.cgi?id=194227 Reviewed by Eric Carlson. Source/WebCore: The original fix in r241203 is not sufficient, since it only checks if the CSS string starts with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that all selectors starts with '::cue'. Test: media/track/track-cue-css.html * html/track/WebVTTParser.cpp: (WebCore::WebVTTParser::checkAndStoreStyleSheet): LayoutTests: Add invalid 'STYLE' blocks which the WebVTT parser should reject. * media/track/captions-webvtt/css-styling.vtt: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241608 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2019-02-15 Per Arne Vollan [WebVTT] Inline WebVTT styles should start with '::cue' https://bugs.webkit.org/show_bug.cgi?id=194227 Reviewed by Eric Carlson. Add invalid 'STYLE' blocks which the WebVTT parser should reject. * media/track/captions-webvtt/css-styling.vtt: 2019-03-01 Babak Shafiei Cherry-pick r242248. rdar://problem/48503715 [iOS] Dark flash when opening Google AMP pages https://bugs.webkit.org/show_bug.cgi?id=195193 rdar://problem/48326442 Reviewed by Zalan Bujtas. Source/WebCore: After the incremental compositing updates changes, it was possible for a change in the size of an overflow:hidden element to fail to update the "ancestor clipping layer" geometry on a composited descendant that is not a descendant in z-order. When Google search results create the