WebKit.git
90 min agoMake CacheStorageEngineCaches's decodeCachesNames() more robust against bad input... master
cdumez@apple.com [Sat, 24 Aug 2019 16:02:52 +0000 (16:02 +0000)]
Make CacheStorageEngineCaches's decodeCachesNames() more robust against bad input data
https://bugs.webkit.org/show_bug.cgi?id=201102

Reviewed by Antti Koivisto.

Use Vector::tryReserveCapacity() instead of Vector::reserveInitialCapacity() in CacheStorage::decodeCachesNames()
since the size is read from disk and thus cannot be trusted. If the size is too large, reserveInitialCapacity()
would end up crashing the network process. Now, we merely discard the data if tryReserveCapacity() fails because
the size is too large.

* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::decodeCachesNames):

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

3 hours ago[LFC][TFC] Add section renderers to the layout tree (THEAD/TBODY/TFOOT)
zalan@apple.com [Sat, 24 Aug 2019 13:36:29 +0000 (13:36 +0000)]
[LFC][TFC] Add section renderers to the layout tree (THEAD/TBODY/TFOOT)
https://bugs.webkit.org/show_bug.cgi?id=201114
<rdar://problem/54664992>

Reviewed by Antti Koivisto.

Section renderers (THEAD/TBODY/TFOOT) are direct children of the RenderTable. Let's include them in the layout tree as well.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createTableStructure):
(WebCore::Layout::outputInlineRuns):

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

3 hours ago[LFC] Box::isAnonymous() can not rely on the lack of ElementType.
zalan@apple.com [Sat, 24 Aug 2019 13:34:50 +0000 (13:34 +0000)]
[LFC] Box::isAnonymous() can not rely on the lack of ElementType.
https://bugs.webkit.org/show_bug.cgi?id=201106
<rdar://problem/54660287>

Reviewed by Antti Koivisto.

Add bool m_isAnonymous member to mark anonymous layout boxes. Anonymous boxes are not rare enough to include this variable in RareData.

* layout/layouttree/LayoutBox.h:
(WebCore::Layout::Box::setIsAnonymous):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):

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

4 hours agoImplement layout system independent text box iterator
antti@apple.com [Sat, 24 Aug 2019 13:31:50 +0000 (13:31 +0000)]
Implement layout system independent text box iterator
https://bugs.webkit.org/show_bug.cgi?id=201076

Reviewed by Zalan Bujtas.

Add a generic way to traverse line layout without caring about the details of the underlying layout system.

This patch adds basic support for traversing text boxes and uses it to remove layout path specific branches in RenderTreeAsText.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
(WebCore::writeTextBox):
(WebCore::write):
(WebCore::writeTextRun): Deleted.
(WebCore::writeSimpleLine): Deleted.
* rendering/line/LineLayoutInterfaceTextBoxes.cpp: Added.
(WebCore::LineLayoutInterface::TextBox::rect const):
(WebCore::LineLayoutInterface::TextBox::logicalRect const):
(WebCore::LineLayoutInterface::TextBox::hasHyphen const):
(WebCore::LineLayoutInterface::TextBox::isLeftToRightDirection const):
(WebCore::LineLayoutInterface::TextBox::dirOverride const):
(WebCore::LineLayoutInterface::TextBox::text const):
(WebCore::LineLayoutInterface::TextBoxIterator::TextBoxIterator):
(WebCore::LineLayoutInterface::TextBoxIterator::traverseNext):
(WebCore::LineLayoutInterface::TextBoxIterator::operator== const):
(WebCore::LineLayoutInterface::simpleLineRunResolverForText):
(WebCore::LineLayoutInterface::rangeForText):
(WebCore::LineLayoutInterface::TextBoxRange::TextBoxRange):
(WebCore::LineLayoutInterface::textBoxes):
* rendering/line/LineLayoutInterfaceTextBoxes.h: Added.
(WebCore::LineLayoutInterface::TextBox::TextBox):
(WebCore::LineLayoutInterface::TextBoxIterator::operator++):
(WebCore::LineLayoutInterface::TextBoxIterator::operator!= const):
(WebCore::LineLayoutInterface::TextBoxIterator::operator* const):
(WebCore::LineLayoutInterface::TextBoxRange::begin const):
(WebCore::LineLayoutInterface::TextBoxRange::end const):

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

4 hours ago[LFC][BFC] Non-inline formatting context(table, grid etc) root container should not...
zalan@apple.com [Sat, 24 Aug 2019 13:24:29 +0000 (13:24 +0000)]
[LFC][BFC] Non-inline formatting context(table, grid etc) root container should not collapse through.
https://bugs.webkit.org/show_bug.cgi?id=201099
<rdar://problem/54658946>

Reviewed by Antti Koivisto.

I didn't manage to find it in the spec, but surely formatting contexts like table, grid and flex should behave like
block so that their vertical margins are not adjoining, when they have at least one inflow child.

* layout/blockformatting/BlockMarginCollapse.cpp:
(WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):

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

4 hours ago[LFC] Add THEAD/TBODY/TFOOT output to Layout::showLayoutTree
zalan@apple.com [Sat, 24 Aug 2019 13:17:03 +0000 (13:17 +0000)]
[LFC] Add THEAD/TBODY/TFOOT output to Layout::showLayoutTree
https://bugs.webkit.org/show_bug.cgi?id=201113
<rdar://problem/54664134>

Reviewed by Antti Koivisto.

* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputLayoutBox):

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

4 hours ago[LFC] Remove redundant Layout::Box::ElementType::TableRowGroup
zalan@apple.com [Sat, 24 Aug 2019 13:16:41 +0000 (13:16 +0000)]
[LFC] Remove redundant Layout::Box::ElementType::TableRowGroup
https://bugs.webkit.org/show_bug.cgi?id=201112
<rdar://problem/54663833>

Reviewed by Antti Koivisto.

Use Layout::Box::ElementType::TableBodyGroup instead.

* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::isPaddingApplicable const):
* layout/layouttree/LayoutBox.h:
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutBox):

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

14 hours agoRenderLayerModelObject should not call private RenderLayer functions
simon.fraser@apple.com [Sat, 24 Aug 2019 03:31:55 +0000 (03:31 +0000)]
RenderLayerModelObject should not call private RenderLayer functions
https://bugs.webkit.org/show_bug.cgi?id=201111

Reviewed by Zalan Bujtas.

Make RenderLayerModelObject no longer a friend class of RenderLayer, giving it a public
willRemoveChildWithBlendMode() function to call. Also make the UpdateLayerPositionsFlag
enum private, providing a updateLayerPositionsAfterStyleChange() for RenderLayerModelObject,
and changing the arguments of updateLayerPositionsAfterLayout() for FrameView.

No behavior change.

* page/FrameView.cpp:
(WebCore::FrameView::didLayout):
(WebCore::updateLayerPositionFlags): Deleted.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterStyleChange):
(WebCore::RenderLayer::updateLayerPositionsAfterLayout):
(WebCore::RenderLayer::willRemoveChildWithBlendMode):
* rendering/RenderLayer.h:
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange):

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

15 hours agoImplement StaticRange constructor
rniwa@webkit.org [Sat, 24 Aug 2019 02:22:28 +0000 (02:22 +0000)]
Implement StaticRange constructor
https://bugs.webkit.org/show_bug.cgi?id=201055

Reviewed by Wenson Hsieh.

LayoutTests/imported/w3c:

Added a test from https://github.com/web-platform-tests/wpt/pull/18619
with my review comment addressed.

* web-platform-tests/dom/interfaces-expected.txt: Rebaselined.
* web-platform-tests/dom/ranges/StaticRange-constructor-expected.txt: Added.
* web-platform-tests/dom/ranges/StaticRange-constructor.html: Added.

Source/WebCore:

Added the constructor to StaticRange per https://github.com/whatwg/dom/pull/778.

Test: imported/w3c/web-platform-tests/dom/ranges/StaticRange-constructor.html

* dom/StaticRange.cpp:
(WebCore::isDocumentTypeOrAttr):
(WebCore::StaticRange::create):
* dom/StaticRange.h:
* dom/StaticRange.idl:

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

16 hours agoWeb Inspector: create additional command line api functions for other console methods
drousso@apple.com [Sat, 24 Aug 2019 00:46:56 +0000 (00:46 +0000)]
Web Inspector: create additional command line api functions for other console methods
https://bugs.webkit.org/show_bug.cgi?id=200971

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Expose all `console.*` functions in the command line API, since they're all already able to
be referenced via the `console` object.

Provide a simpler interface for other injected scripts to modify the command line API.

* inspector/InjectedScriptModule.cpp:
(Inspector::InjectedScriptModule::ensureInjected):

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype.inspectObject):
(InjectedScript.prototype.addCommandLineAPIGetter): Added.
(InjectedScript.prototype.addCommandLineAPIMethod): Added.
(InjectedScript.prototype.hasInjectedModule): Added.
(InjectedScript.prototype.injectModule):
(InjectedScript.prototype._evaluateOn):
(InjectedScript.CommandLineAPI): Added.
(InjectedScript.prototype.module): Deleted.
(InjectedScript.prototype._savedResult): Deleted.
(bind): Deleted.
(BasicCommandLineAPI): Deleted.
(clear): Deleted.
(table): Deleted.
(profile): Deleted.
(profileEnd): Deleted.
(keys): Deleted.
(values): Deleted.
(queryInstances): Deleted.
(queryObjects): Deleted.
(queryHolders): Deleted.

Source/WebCore:

Expose all `console.*` functions in the command line API, since they're all already able to
be referenced via the `console` object.

Provide a simpler interface for other injected scripts to modify the command line API.

* inspector/CommandLineAPIModuleSource.js:
(injectedScript._inspectObject): Added.
(normalizeEventTypes): Added.
(logEvent): Added.
(canQuerySelectorOnNode): Added.
(bind): Deleted.
(value): Deleted.
(this.method.toString): Deleted.
(CommandLineAPI): Deleted.
(CommandLineAPIImpl): Deleted.
(CommandLineAPIImpl.prototype): Deleted.
(CommandLineAPIImpl.prototype._canQuerySelectorOnNode): Deleted.
(CommandLineAPIImpl.prototype.x): Deleted.
(CommandLineAPIImpl.prototype.dir): Deleted.
(CommandLineAPIImpl.prototype.dirxml): Deleted.
(CommandLineAPIImpl.prototype.keys): Deleted.
(CommandLineAPIImpl.prototype.values): Deleted.
(CommandLineAPIImpl.prototype.profile): Deleted.
(CommandLineAPIImpl.prototype.profileEnd): Deleted.
(CommandLineAPIImpl.prototype.table): Deleted.
(CommandLineAPIImpl.prototype.screenshot): Deleted.
(CommandLineAPIImpl.prototype.monitorEvents): Deleted.
(CommandLineAPIImpl.prototype.unmonitorEvents): Deleted.
(CommandLineAPIImpl.prototype.inspect): Deleted.
(CommandLineAPIImpl.prototype.queryInstances): Deleted.
(CommandLineAPIImpl.prototype.queryObjects): Deleted.
(CommandLineAPIImpl.prototype.queryHolders): Deleted.
(CommandLineAPIImpl.prototype.copy): Deleted.
(CommandLineAPIImpl.prototype.clear): Deleted.
(CommandLineAPIImpl.prototype.getEventListeners): Deleted.
(CommandLineAPIImpl.prototype._inspectedObject): Deleted.
(CommandLineAPIImpl.prototype._normalizeEventTypes): Deleted.
(CommandLineAPIImpl.prototype._logEvent): Deleted.
(CommandLineAPIImpl.prototype._inspect): Deleted.

Source/WebInspectorUI:

Expose all `console.*` functions in the command line API, since they're all already able to
be referenced via the `console` object.

Provide a simpler interface for other injected scripts to modify the command line API.

* UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
(WI.JavaScriptRuntimeCompletionProvider.prototype.get _commandLineAPIKeys): Added.
(WI.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.updateLastPropertyNames):
(WI.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.receivedPropertyNames):

LayoutTests:

* http/tests/inspector/dom/cross-domain-inspected-node-access-expected.txt:
* inspector/console/command-line-api-expected.txt:

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

17 hours agoCrash under TimerBase::setNextFireTime() in the NetworkProcess
cdumez@apple.com [Sat, 24 Aug 2019 00:24:11 +0000 (00:24 +0000)]
Crash under TimerBase::setNextFireTime() in the NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=201097
<rdar://problem/54658339>

Reviewed by Ryosuke Niwa.

NetworkStateNotifier is a WebCore/platform class used by both WebKitLegacy and WebKit2 in the NetworkProcess.
On iOS, the lambda in the implementation of NetworkStateNotifier::startObserving() may get called by the
underlying framework on a non-main thread and we therefore want to go back to the main thread before calling
NetworkStateNotifier::singleton().updateStateSoon(). This is important because updateStateSoon() will schedule
a WebCore::Timer. The issue is that the code was using WebThreadRun() to go back the the main thread. While
this works fine in iOS WK1, it does not do what we want in WebKit2 in the network process. Indeed, before there
is no WebThread in the network process, WebThreadRun() will simply run the block on whatever thread we're one.
This would lead to crashes when trying to schedule the Timer in updateStateSoon(). To address the issue, we now
use callOnMainThread().

* platform/network/ios/NetworkStateNotifierIOS.mm:
(WebCore::NetworkStateNotifier::startObserving):

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

17 hours agoREGRESSION (r248807): Objects stored in ElementRareData are leaked
rniwa@webkit.org [Sat, 24 Aug 2019 00:20:57 +0000 (00:20 +0000)]
REGRESSION (r248807): Objects stored in ElementRareData are leaked
https://bugs.webkit.org/show_bug.cgi?id=200954

Reviewed by David Kilzer.

NodeRareData didn't have a virtual destructor. As a result, member variables
of ElementRareData did not get destructed properly.

* dom/NodeRareData.cpp:
* dom/NodeRareData.h:
(WebCore::NodeRareData::~NodeRareData):

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

18 hours agoRemove MaximalFlushInsertionPhase
tzagallo@apple.com [Fri, 23 Aug 2019 23:08:06 +0000 (23:08 +0000)]
Remove MaximalFlushInsertionPhase
https://bugs.webkit.org/show_bug.cgi?id=201036

Reviewed by Saam Barati.

JSTests:

Remove all the references to maximal flush

* stress/arith-ceil-on-various-types.js:
(checkCompileCountForUselessNegativeZero):
* stress/arith-floor-on-various-types.js:
(checkCompileCountForUselessNegativeZero):
* stress/arith-negate-on-various-types.js:
(checkCompileCountForUselessNegativeZero):
* stress/arith-round-on-various-types.js:
(checkCompileCountForUselessNegativeZero):
* stress/arith-trunc-on-various-types.js:
(checkCompileCountForUselessNegativeZero):
* stress/dfg-compare-eq-via-nonSpeculativeNonPeepholeCompareNullOrUndefined.js:
* stress/has-indexed-property-should-accept-non-int32.js:
* stress/has-indexed-property-with-worsening-array-mode.js:
* stress/known-int32-cant-be-used-across-bytecode-boundary.js:
* stress/read-dead-bytecode-locals-in-must-handle-values1.js:
* stress/read-dead-bytecode-locals-in-must-handle-values2.js:
* stress/rest-parameter-many-arguments.js:
* stress/set-argument-maybe-maximal-flush-should-not-extend-liveness-2.js:
* stress/set-argument-maybe-maximal-flush-should-not-extend-liveness.js:
* stress/to-index-string-should-not-assume-incoming-value-is-uint32.js:

Source/JavaScriptCore:

Maximal flush has found too many false positives recently, so we decided it's finally time
to remove it instead of hacking it to fix the most recent false positive.

The most recent false positive was caused by a LoadVarargs followed by a SetArgumentDefinitely
for the argument count that was being flushed in a much later block. Now, since that block was
the head of a loop, and there was a SetLocal in the same block to the same variable, this
generated a Phi of both values, which then led to the unification of their VariableAccessData
in the unification phase. This caused AI to assign the Int52 type to argument count, which
broke the AI’s assumption that it should always be an Int32.

* JavaScriptCore.xcodeproj/project.pbxproj:
* Sources.txt:
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleVarargsInlining):
* dfg/DFGMaximalFlushInsertionPhase.cpp: Removed.
* dfg/DFGMaximalFlushInsertionPhase.h: Removed.
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThreadImpl):
* runtime/Options.cpp:
(JSC::recomputeDependentOptions):
* runtime/Options.h:

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

18 hours ago[iOS] [WebKit2] Tapping on the “I’m” text suggestion after typing “i’” does nothing
wenson_hsieh@apple.com [Fri, 23 Aug 2019 23:00:38 +0000 (23:00 +0000)]
[iOS] [WebKit2] Tapping on the “I’m” text suggestion after typing “i’” does nothing
https://bugs.webkit.org/show_bug.cgi?id=201085
<rdar://problem/53056118>

Reviewed by Tim Horton.

Source/WebCore:

Exposes an existing quote folding function as a helper on TextIterator, and also adjusts foldQuoteMarks to take
a const String& rather than a String. See WebKit ChangeLog for more details.

* editing/TextIterator.cpp:
(WebCore::foldQuoteMarks):
(WebCore::SearchBuffer::SearchBuffer):
* editing/TextIterator.h:

Source/WebKit:

Currently, logic in applyAutocorrectionInternal only selects the range to autocorrect if the text of the range
matches the string to replace (delivered to us from UIKit). In the case of changing "I’" to "I’m", the string to
replace is "I'" (with a straight quote rather than an apostrophe), even though the DOM contains an apostrophe.

This is because kbd believes that the document context contains straight quotes (rather than apostrophes). For
native text views, this works out because UIKit uses relative UITextPositions to determine the replacement
range rather than by checking against the contents of the document. However, WKWebView does not have the ability
to synchronously compute and reason about arbitrary UITextPositions relative to the selection, so we instead
search for the string near the current selection when applying autocorrections.

Of course, this doesn't work in this scenario because the replacement string contains a straight quote, yet the
text node contains an apostrophe, so we bail and don't end up replacing any text. To address this, we repurpose
TextIterator helpers currently used to allow find-in-page to match straight quotes against apostrophes; instead
of matching the replacement string exactly, we instead match the quote-folded versions of these strings when
finding the range to replace.

Test: fast/events/ios/autocorrect-with-apostrophe.html

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::applyAutocorrectionInternal):

LayoutTests:

Add a new layout test to verify that "I’" can be autocorrected to "I’m".

* fast/events/ios/autocorrect-with-apostrophe-expected.txt: Added.
* fast/events/ios/autocorrect-with-apostrophe.html: Added.

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

18 hours agoUnreviewed WinCairo build fix following r249058.
ross.kirsling@sony.com [Fri, 23 Aug 2019 22:56:58 +0000 (22:56 +0000)]
Unreviewed WinCairo build fix following r249058.

* API/tests/testapi.cpp:
(TestAPI::callFunction):
WinCairo chokes on `JSValueRef args[sizeof...(arguments)]` when there are no arguments, but AppleWin does not...
MSVC must have changed somehow.

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

18 hours agoREGRESSION (r248974): fast/events/ios/key-command-delete-to-end-of-paragraph.html...
timothy_horton@apple.com [Fri, 23 Aug 2019 22:54:48 +0000 (22:54 +0000)]
REGRESSION (r248974): fast/events/ios/key-command-delete-to-end-of-paragraph.html is timing out on iOS
https://bugs.webkit.org/show_bug.cgi?id=201091
<rdar://problem/54647731>

Reviewed by Megan Gardner.

* fast/events/ios/key-command-delete-to-end-of-paragraph.html:
The test as-written doesn't actually wait for the tap to complete before
continuing on with the test - it starts immediately when the focus event
fires. This results in the selection being changed by the single click
handler *after* focusing the field.

Rewrite the test to await completion of the tap before moving forward
instead of waiting for focus.

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

19 hours agoRemove IDBDatabaseIdentifier::m_mainFrameOrigin
youenn@apple.com [Fri, 23 Aug 2019 21:37:03 +0000 (21:37 +0000)]
Remove IDBDatabaseIdentifier::m_mainFrameOrigin
https://bugs.webkit.org/show_bug.cgi?id=201078

Reviewed by Darin Adler.

No change of behavior.

* Modules/indexeddb/IDBDatabaseIdentifier.h:

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

20 hours ago[WASM-References] Do not overwrite argument registers in jsCallEntrypoint
justin_michaud@apple.com [Fri, 23 Aug 2019 21:33:08 +0000 (21:33 +0000)]
[WASM-References] Do not overwrite argument registers in jsCallEntrypoint
https://bugs.webkit.org/show_bug.cgi?id=200952

Reviewed by Saam Barati.

JSTests:

* wasm/references/func_ref.js:
(assert.throws):

Source/JavaScriptCore:

The c call that we emitted was incorrect. If we had an int argument that was supposed to be placed in GPR0 by this loop,
we would clobber it while making the call (among many other possible registers). To fix this, we just inline the call
to isWebassemblyHostFunction.

* wasm/js/WebAssemblyFunction.cpp:
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):

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

20 hours agoUnreviewed, build fix after r249059
jiewen_tan@apple.com [Fri, 23 Aug 2019 21:21:51 +0000 (21:21 +0000)]
Unreviewed, build fix after r249059

Source/WebKit:

* UIProcess/WebAuthentication/Cocoa/NfcConnection.mm:
(WebKit::NfcConnection::NfcConnection):
Remove the HAVE() macro.

Source/WTF:

* wtf/Platform.h:
Make HAVE_NEAR_FIELD available only on iOS 13+ and macOS Catalina+.

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

20 hours agoIncrease log level for watchlist result
aakash_jain@apple.com [Fri, 23 Aug 2019 21:06:02 +0000 (21:06 +0000)]
Increase log level for watchlist result
https://bugs.webkit.org/show_bug.cgi?id=201081

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/tool/steps/applywatchlist.py: Increased log level.
* Scripts/webkitpy/tool/steps/applywatchlist_unittest.py: Updated unit-tests.
* Scripts/webkitpy/tool/commands/applywatchlistlocal_unittest.py: Ditto.

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

20 hours ago[geolocation] Rename interfaces and remove [NoInterfaceObject]
cdumez@apple.com [Fri, 23 Aug 2019 20:58:49 +0000 (20:58 +0000)]
[geolocation] Rename interfaces and remove [NoInterfaceObject]
https://bugs.webkit.org/show_bug.cgi?id=200885

Reviewed by Alex Christensen.

Source/WebCore:

Rename Geolocation interfaces and expose them on the global Window object to match the
latest specification:
- https://w3c.github.io/geolocation-api/#api_description

Test: fast/dom/Geolocation/exposed-geolocation-interfaces.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Modules/geolocation/GeoNotifier.cpp:
(WebCore::GeoNotifier::setFatalError):
(WebCore::GeoNotifier::runSuccessCallback):
(WebCore::GeoNotifier::runErrorCallback):
(WebCore::GeoNotifier::timerFired):
* Modules/geolocation/GeoNotifier.h:
* Modules/geolocation/Geolocation.cpp:
(WebCore::createGeolocationPosition):
(WebCore::createGeolocationPositionError):
(WebCore::Geolocation::lastPosition):
(WebCore::Geolocation::startRequest):
(WebCore::Geolocation::requestUsesCachedPosition):
(WebCore::Geolocation::makeCachedPositionCallbacks):
(WebCore::Geolocation::haveSuitableCachedPosition):
(WebCore::Geolocation::setIsAllowed):
(WebCore::Geolocation::sendError):
(WebCore::Geolocation::sendPosition):
(WebCore::Geolocation::cancelRequests):
(WebCore::Geolocation::handleError):
(WebCore::Geolocation::makeSuccessCallbacks):
(WebCore::Geolocation::positionChanged):
(WebCore::Geolocation::setError):
(WebCore::Geolocation::handlePendingPermissionNotifiers):
* Modules/geolocation/Geolocation.h:
* Modules/geolocation/Geolocation.idl:
* Modules/geolocation/GeolocationClient.h:
* Modules/geolocation/GeolocationController.cpp:
(WebCore::GeolocationController::positionChanged):
(WebCore::GeolocationController::lastPosition):
* Modules/geolocation/GeolocationController.h:
* Modules/geolocation/GeolocationCoordinates.cpp: Renamed from Source/WebCore/Modules/geolocation/Coordinates.cpp.
(WebCore::GeolocationCoordinates::GeolocationCoordinates):
* Modules/geolocation/GeolocationCoordinates.h: Renamed from Source/WebCore/Modules/geolocation/Coordinates.h.
(WebCore::GeolocationCoordinates::create):
(WebCore::GeolocationCoordinates::isolatedCopy const):
* Modules/geolocation/GeolocationCoordinates.idl: Renamed from Source/WebCore/Modules/geolocation/Coordinates.idl.
* Modules/geolocation/GeolocationPosition.h:
(WebCore::GeolocationPosition::create):
(WebCore::GeolocationPosition::isolatedCopy const):
(WebCore::GeolocationPosition::timestamp const):
(WebCore::GeolocationPosition::coords const):
(WebCore::GeolocationPosition::GeolocationPosition):
* Modules/geolocation/GeolocationPosition.idl: Renamed from Source/WebCore/Modules/geolocation/Geoposition.idl.
* Modules/geolocation/GeolocationPositionData.h: Copied from Source/WebCore/Modules/geolocation/GeolocationPosition.h.
(WebCore::GeolocationPositionData::GeolocationPositionData):
(WebCore::GeolocationPositionData::encode const):
(WebCore::GeolocationPositionData::decode):
(WebCore::GeolocationPositionData::isValid const):
* Modules/geolocation/GeolocationPositionError.h: Renamed from Source/WebCore/Modules/geolocation/PositionError.h.
(WebCore::GeolocationPositionError::create):
(WebCore::GeolocationPositionError::GeolocationPositionError):
* Modules/geolocation/GeolocationPositionError.idl: Renamed from Source/WebCore/Modules/geolocation/PositionError.idl.
* Modules/geolocation/Geoposition.h: Removed.
* Modules/geolocation/PositionCallback.h:
* Modules/geolocation/PositionCallback.idl:
* Modules/geolocation/PositionErrorCallback.h:
* Modules/geolocation/PositionErrorCallback.idl:
* Modules/geolocation/ios/GeolocationPositionDataIOS.mm: Renamed from Source/WebCore/Modules/geolocation/ios/GeolocationPositionIOS.mm.
(WebCore::GeolocationPositionData::GeolocationPositionData):
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/mock/GeolocationClientMock.cpp:
(WebCore::GeolocationClientMock::setPosition):
(WebCore::GeolocationClientMock::lastPosition):
* platform/mock/GeolocationClientMock.h:

Source/WebKit:

* Shared/WebGeolocationPosition.cpp:
(WebKit::WebGeolocationPosition::create):
* Shared/WebGeolocationPosition.h:
(WebKit::WebGeolocationPosition::corePosition const):
(WebKit::WebGeolocationPosition::WebGeolocationPosition):
* UIProcess/API/C/WKGeolocationPosition.cpp:
(WKGeolocationPositionCreate_c):
* UIProcess/WebGeolocationManagerProxy.h:
(WebKit::WebGeolocationManagerProxy::lastPosition const):
* UIProcess/ios/WKGeolocationProviderIOS.mm:
(-[WKLegacyCoreLocationProvider positionChanged:]):
* WebProcess/Geolocation/WebGeolocationManager.cpp:
(WebKit::WebGeolocationManager::didChangePosition):
* WebProcess/Geolocation/WebGeolocationManager.h:
* WebProcess/Geolocation/WebGeolocationManager.messages.in:
* WebProcess/WebCoreSupport/WebGeolocationClient.cpp:
(WebKit::WebGeolocationClient::lastPosition):
* WebProcess/WebCoreSupport/WebGeolocationClient.h:

Source/WebKitLegacy/ios:

* Misc/WebGeolocationCoreLocationProvider.h:
* Misc/WebGeolocationCoreLocationProvider.mm:
(-[WebGeolocationCoreLocationProvider sendLocation:]):
* Misc/WebGeolocationProviderIOS.mm:
(-[_WebCoreLocationUpdateThreadingProxy positionChanged:]):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebGeolocationClient.h:
* WebCoreSupport/WebGeolocationClient.mm:
(WebGeolocationClient::lastPosition):
* WebView/WebGeolocationPosition.mm:
(-[WebGeolocationPositionInternal initWithCoreGeolocationPosition:]):
(core):
(-[WebGeolocationPosition initWithTimestamp:latitude:longitude:accuracy:]):
(-[WebGeolocationPosition initWithGeolocationPosition:]):
* WebView/WebGeolocationPositionInternal.h:

Tools:

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setMockGeolocationPosition):

LayoutTests:

Add layout test coverage.

* fast/dom/Geolocation/exposed-geolocation-interfaces-expected.txt: Added.
* fast/dom/Geolocation/exposed-geolocation-interfaces.html: Added.
* fast/dom/Geolocation/position-string-expected.txt:
* fast/dom/Geolocation/position-string.html:

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

20 hours agoUndo disabling of IsoHeaps when Gigacage is off.
mark.lam@apple.com [Fri, 23 Aug 2019 20:55:28 +0000 (20:55 +0000)]
Undo disabling of IsoHeaps when Gigacage is off.
https://bugs.webkit.org/show_bug.cgi?id=201061
<rdar://problem/54622500>

Reviewed by Saam Barati and Michael Saboff.

* CMakeLists.txt:
* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/IsoTLS.cpp:
(bmalloc::IsoTLS::determineMallocFallbackState):
* bmalloc/PerThread.cpp: Removed.
* bmalloc/PerThread.h:

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

21 hours agoRegression(r248533) Assertion hit in isMainThread() for some clients using WTF becaus...
cdumez@apple.com [Fri, 23 Aug 2019 20:31:08 +0000 (20:31 +0000)]
Regression(r248533) Assertion hit in isMainThread() for some clients using WTF because the main thread is not initialized
https://bugs.webkit.org/show_bug.cgi?id=201083

Reviewed by Alex Christensen.

An assertion is hit in isMainThread() for some clients using WTF because the main thread is not initialized, since r248533.
Clients can work around this by calling WTF::initializeMainThread() before using WTF but it seems unfortunate to force them
to do so. I propose we disable the assertion until the main thread is initialized.

* wtf/MainThread.h:
* wtf/RefCounted.h:
(WTF::RefCountedBase::RefCountedBase):
(WTF::RefCountedBase::applyRefDerefThreadingCheck const):
* wtf/cocoa/MainThreadCocoa.mm:
(WTF::isMainThreadInitialized):
* wtf/generic/MainThreadGeneric.cpp:
(WTF::isMainThreadInitialized):

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

21 hours agoUnreviewed, rolling out r249001.
ryanhaddad@apple.com [Fri, 23 Aug 2019 20:23:21 +0000 (20:23 +0000)]
Unreviewed, rolling out r249001.

Caused one layout test to fail on all configurations and
another to time out on Catalina / iOS 13.

Reverted changeset:

"Add a WebsiteDataStore delegate to handle
AuthenticationChallenge that do not come from pages"
https://bugs.webkit.org/show_bug.cgi?id=196870
https://trac.webkit.org/changeset/249001

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

21 hours agoREGRESSION(r248713): WebDriver commands which target the implicit main frame now...
bburg@apple.com [Fri, 23 Aug 2019 19:35:02 +0000 (19:35 +0000)]
REGRESSION(r248713): WebDriver commands which target the implicit main frame now hit an ASSERT
https://bugs.webkit.org/show_bug.cgi?id=200793
<rdar://problem/54516988>

Reviewed by Chris Dumez.

SimulatedInputDispatcher and its callers need to support Optional<FrameIdentifier>
and WTF::nullopt as an encoding for the implicit main frame.

* UIProcess/Automation/SimulatedInputDispatcher.h:
* UIProcess/Automation/SimulatedInputDispatcher.cpp:
(WebKit::SimulatedInputDispatcher::resolveLocation):
(WebKit::SimulatedInputDispatcher::run):

* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::viewportInViewCenterPointOfElement):
(WebKit::WebAutomationSession::performInteractionSequence):
(WebKit::WebAutomationSession::cancelInteractionSequence):

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

22 hours agoresults.webkit.org: Escape html in changelog
jbedard@apple.com [Fri, 23 Aug 2019 19:25:31 +0000 (19:25 +0000)]
results.webkit.org: Escape html in changelog
https://bugs.webkit.org/show_bug.cgi?id=201025
<rdar://problem/54564837>

Reviewed by Darin Adler.

* resultsdbpy/resultsdbpy/view/commit_view.py:
(CommitView.commit): Output a dictionary instead of a JSON encoded string.
* resultsdbpy/resultsdbpy/view/templates/commit.html: Unpack commits dictionary
directly into a JavaScript dictionary.

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

22 hours agoREGRESSION: fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup...
commit-queue@webkit.org [Fri, 23 Aug 2019 19:21:32 +0000 (19:21 +0000)]
REGRESSION: fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html is timing out
https://bugs.webkit.org/show_bug.cgi?id=201075
<rdar://problem/54491246>

Patch by Antoine Quint <graouts@apple.com> on 2019-08-23
Reviewed by Daniel Bates.

This test was written very early on in the process of implementing Pointer Events and assumed events would keep
firing when scrolling occured. We need to add "touch-action: none" to ensure we get pointermove and pointerup
events. We also need to ensure that the interaction occurs over content otherwise events won't fire. Finally, we
pretty up the test a bit.

* fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup-expected.txt:
* fast/events/pointer/ios/drag-gives-pointerdown-pointermove-pointerup.html:

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

22 hours ago[WebAuthn] Support NFC authenticators for iOS
jiewen_tan@apple.com [Fri, 23 Aug 2019 18:56:03 +0000 (18:56 +0000)]
[WebAuthn] Support NFC authenticators for iOS
https://bugs.webkit.org/show_bug.cgi?id=188624
<rdar://problem/43354214>

Reviewed by Chris Dumez.

Source/WebCore:

Tests: http/wpt/webauthn/ctap-nfc-failure.https.html
       http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html
       http/wpt/webauthn/public-key-credential-create-success-nfc.https.html
       http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html
       http/wpt/webauthn/public-key-credential-get-success-nfc.https.html

* Modules/webauthn/apdu/ApduResponse.h:
Adds a new method to support moving m_data.
* Modules/webauthn/fido/FidoConstants.h:
Adds constants for NFC applet selection.

Source/WebKit:

This patch implements support for NFC authenticators including both FIDO2 and U2F ones. It utilizes a private
framework called NearField instead of CoreNFC to be able to supply a custom UI later if necessary.

The patch follows almost the same flow as previous HID and Local authenticator support.
1) Discovery is via NfcService which will invoke NFHardwareManager to start a generic NFC reader session.
2) Once a reader session is established, a NfcConnection is created to start the polling and register the WKNFReaderSessionDelegate
to wait for 'didDetectTags'.
3) When tags are detected, NfcConnection will determine if it meets our requriements: { type, connectability, fido applet availability }.
The first tag that meets all requirement will then be returned for WebAuthn operations.
4) The first WebAuthn operation is to send authenticatorGetInfo command to determine the supported protocol, and then initialize corresponding
authenticators. Noted, the sending/receiving of this command is now abstracted into FidoService which will be shared across HidService and NfcService.
5) From then, the actual WebAuthn request, either makeCredential or getAssertion will be sent.

For testing, this patch follows the same flow as well.
1) MockNfcService overrides NfcService to mock the behavior of NFC Tags discovery.
2) The same class also swizzles methods from NFReaderSession to mock tag connection and communication.

* Platform/spi/Cocoa/NearFieldSPI.h: Added.
* Sources.txt:
* SourcesCocoa.txt:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetWebAuthenticationMockConfiguration):
* UIProcess/WebAuthentication/AuthenticatorManager.cpp:
(WebKit::AuthenticatorManagerInternal::collectTransports):
* UIProcess/WebAuthentication/AuthenticatorTransportService.cpp:
(WebKit::AuthenticatorTransportService::create):
(WebKit::AuthenticatorTransportService::createMock):
* UIProcess/WebAuthentication/Cocoa/HidService.h:
* UIProcess/WebAuthentication/Cocoa/HidService.mm:
(WebKit::HidService::HidService):
(WebKit::HidService::deviceAdded):
(WebKit::HidService::continueAddDeviceAfterGetInfo): Deleted.
* UIProcess/WebAuthentication/Cocoa/NearFieldSoftLink.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/Cocoa/NearFieldSoftLink.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/Cocoa/NfcConnection.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/Cocoa/NfcConnection.mm: Added.
(WebKit::fido::compareVersion):
(WebKit::NfcConnection::NfcConnection):
(WebKit::NfcConnection::~NfcConnection):
(WebKit::NfcConnection::transact const):
(WebKit::NfcConnection::didDetectTags const):
* UIProcess/WebAuthentication/Cocoa/NfcService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/Cocoa/NfcService.mm: Added.
(WebKit::NfcService::NfcService):
(WebKit::NfcService::~NfcService):
(WebKit::NfcService::didConnectTag):
(WebKit::NfcService::startDiscoveryInternal):
(WebKit::NfcService::platformStartDiscovery):
* UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/Cocoa/WKNFReaderSessionDelegate.mm: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
(-[WKNFReaderSessionDelegate initWithConnection:]):
(-[WKNFReaderSessionDelegate readerSession:didDetectTags:]):
* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::send):
(WebKit::MockHidConnection::registerDataReceivedCallbackInternal):
(WebKit::MockHidConnection::parseRequest):
(WebKit::MockHidConnection::feedReports):
(WebKit::MockHidConnection::shouldContinueFeedReports):
* UIProcess/WebAuthentication/Mock/MockNfcService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/Mock/MockNfcService.mm: Added.
(-[WKMockNFTag type]):
(-[WKMockNFTag initWithNFTag:]):
(-[WKMockNFTag description]):
(-[WKMockNFTag isEqualToNFTag:]):
(-[WKMockNFTag initWithType:]):
(WebKit::MockNfcService::MockNfcService):
(WebKit::MockNfcService::transceive):
(WebKit::MockNfcService::platformStartDiscovery):
(WebKit::MockNfcService::detectTags const):
* UIProcess/WebAuthentication/Mock/MockWebAuthenticationConfiguration.h:
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp:
* UIProcess/WebAuthentication/fido/CtapAuthenticator.h:
* UIProcess/WebAuthentication/fido/CtapNfcDriver.cpp: Added.
(WebKit::CtapNfcDriver::CtapNfcDriver):
(WebKit::CtapNfcDriver::transact):
(WebKit::CtapNfcDriver::respondAsync const):
* UIProcess/WebAuthentication/fido/CtapNfcDriver.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/fido/FidoService.cpp: Added.
(WebKit::FidoService::FidoService):
(WebKit::FidoService::getInfo):
(WebKit::FidoService::continueAfterGetInfo):
* UIProcess/WebAuthentication/fido/FidoService.h: Copied from Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.h.
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp:
* UIProcess/WebAuthentication/fido/U2fAuthenticator.h:
* UIProcess/ios/WebPageProxyIOS.mm:
* WebKit.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/Platform.h:
Add a feature flag for NearField.

Tools:

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setWebAuthenticationMockConfiguration):
Setup NFC mock testing configuration.

LayoutTests:

* http/wpt/webauthn/ctap-nfc-failure.https-expected.txt: Added.
* http/wpt/webauthn/ctap-nfc-failure.https.html: Added.
* http/wpt/webauthn/public-key-credential-create-failure-nfc.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-create-failure-nfc.https.html: Added.
* http/wpt/webauthn/public-key-credential-create-success-hid.https-expected.txt:
* http/wpt/webauthn/public-key-credential-create-success-hid.https.html:
This patch replaces the "local" keyword with "hid".
* http/wpt/webauthn/public-key-credential-create-success-nfc.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-create-success-nfc.https.html: Added.
* http/wpt/webauthn/public-key-credential-get-failure-nfc.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-get-failure-nfc.https.html: Added.
* http/wpt/webauthn/public-key-credential-get-success-nfc.https-expected.txt: Added.
* http/wpt/webauthn/public-key-credential-get-success-nfc.https.html: Added.
* http/wpt/webauthn/resources/util.js:
* platform/ios-simulator-wk2/TestExpectations:
Skip NFC tests for simulators.

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

22 hours agoJSC should have public API for unhandled promise rejections
ross.kirsling@sony.com [Fri, 23 Aug 2019 18:51:20 +0000 (18:51 +0000)]
JSC should have public API for unhandled promise rejections
https://bugs.webkit.org/show_bug.cgi?id=197172

Reviewed by Keith Miller.

Source/JavaScriptCore:

This patch makes it possible to register a unhandled promise rejection callback via the JSC API.
Since there is no event loop in such an environment, this callback fires off of the microtask queue.
The callback receives the promise and rejection reason as arguments and its return value is ignored.

* API/JSContextRef.cpp:
(JSGlobalContextSetUnhandledRejectionCallback): Added.
* API/JSContextRefPrivate.h:
Add new C++ API call.

* API/tests/testapi.cpp:
(TestAPI::promiseResolveTrue): Clean up test output.
(TestAPI::promiseRejectTrue): Clean up test output.
(TestAPI::promiseUnhandledRejection): Added.
(TestAPI::promiseUnhandledRejectionFromUnhandledRejectionCallback): Added.
(TestAPI::promiseEarlyHandledRejections): Added.
(testCAPIViaCpp):
Add new C++ API test.

* jsc.cpp:
(GlobalObject::finishCreation):
(functionSetUnhandledRejectionCallback): Added.
Add corresponding global to JSC shell.

* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::setUnhandledRejectionCallback): Added.
(JSC::JSGlobalObject::unhandledRejectionCallback const): Added.
Keep a strong reference to the callback.

* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncHostPromiseRejectionTracker):
Add default behavior.

* runtime/VM.cpp:
(JSC::VM::callPromiseRejectionCallback): Added.
(JSC::VM::didExhaustMicrotaskQueue): Added.
(JSC::VM::promiseRejected): Added.
(JSC::VM::drainMicrotasks):
When microtask queue is exhausted, deal with any pending unhandled rejections
(in a manner based on RejectedPromiseTracker's reportUnhandledRejections),
then make sure this didn't cause any new microtasks to be added to the queue.

* runtime/VM.h:
Store unhandled rejections.
(This collection will always be empty in the presence of WebCore.)

Source/WebCore:

* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::promiseRejectionTracker):
Move JSInternalPromise early-out to JSC side.

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

23 hours agoWeb Inspector: transparency checkerboard is too bright in dark mode
drousso@apple.com [Fri, 23 Aug 2019 18:29:59 +0000 (18:29 +0000)]
Web Inspector: transparency checkerboard is too bright in dark mode
https://bugs.webkit.org/show_bug.cgi?id=201067

Reviewed by Joseph Pecoraro.

* UserInterface/Views/Main.css:
(@media (prefers-color-scheme: dark) :matches(img, canvas).show-grid):
* UserInterface/Views/ConsoleMessageView.css:
(.console-message-body > .show-grid):

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

23 hours agoSupport ITP on a per-session basis (198923)
commit-queue@webkit.org [Fri, 23 Aug 2019 18:14:43 +0000 (18:14 +0000)]
Support ITP on a per-session basis (198923)
https://bugs.webkit.org/show_bug.cgi?id=198923

Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-08-23
Reviewed by Chris Dumez.

Source/WebCore:

This patch updated the data structure used to collect resource load
statistics in order to support ITP data collection on a per session
basis. Each sessionID is stored as a key-value pair with its own map
of ResourceLoadStatistics.

It also updated the statisticsForURL function call to perform lookups
of URL data based on sessionID.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::setStatisticsUpdatedCallback):
(WebCore::ResourceLoadObserver::shouldLog const):
(WebCore::ResourceLoadObserver::logSubresourceLoading):
(WebCore::ResourceLoadObserver::logWebSocketLoading):
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
(WebCore::ResourceLoadObserver::logFontLoad):
(WebCore::ResourceLoadObserver::logCanvasRead):
(WebCore::ResourceLoadObserver::logCanvasWriteOrMeasure):
(WebCore::ResourceLoadObserver::logNavigatorAPIAccessed):
(WebCore::ResourceLoadObserver::logScreenAPIAccessed):
(WebCore::ResourceLoadObserver::ensureResourceStatisticsForRegistrableDomain):
(WebCore::ResourceLoadObserver::statisticsForURL):
(WebCore::ResourceLoadObserver::takeStatistics):
(WebCore::ResourceLoadObserver::clearState):
* loader/ResourceLoadObserver.h:
* testing/Internals.cpp:
(WebCore::Internals::resourceLoadStatisticsForURL):

Source/WebKit:

The original implementation of resourceLoadStatisticsUpdated
did not allow for ITP on a per session basis due to the sessionID
not being passed to the resourceLoadStatisticsUpdated function.
This patch allows access of the correct networkSession by passing
all resourceLoadStatistics in a new data structure of key-value
pairs, where the sessionID is the key.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::resourceLoadStatisticsUpdated):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* WebProcess/WebProcess.cpp:

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

24 hours agoVirtualRegister::dump() can use more informative CallFrame header slot names.
mark.lam@apple.com [Fri, 23 Aug 2019 17:21:19 +0000 (17:21 +0000)]
VirtualRegister::dump() can use more informative CallFrame header slot names.
https://bugs.webkit.org/show_bug.cgi?id=201062

Reviewed by Tadeu Zagallo.

For example, it currently dumps head3 instead of callee.  This patch changes the
dump as follows (for 64-bit addressing):
    head0 => callerFrame
    head1 => returnPC
    head2 => codeBlock
    head3 => callee
    head4 => argumentCount

Now, one might be wondering when would bytecode ever access callerFrame and
returnPC?  The answer is never.  However, I don't think its the role of the
dumper to catch a bug where these header slots are being used.  The dumper's role
is to clearly report them so that we can see that these unexpected values are
being used.

* bytecode/VirtualRegister.cpp:
(JSC::VirtualRegister::dump const):

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

24 hours agoUnreviewed, rolling out r249031.
russell_e@apple.com [Fri, 23 Aug 2019 17:15:42 +0000 (17:15 +0000)]
Unreviewed, rolling out r249031.

Causes multiple test failures on iOS simulator

Reverted changeset:

"[iOS] Should show input view when became first responder if
keyboard was showing when the view was resigned"
https://bugs.webkit.org/show_bug.cgi?id=200902
https://trac.webkit.org/changeset/249031

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

24 hours agoRemove unnecessary call to enclosingClippingScopes()
simon.fraser@apple.com [Fri, 23 Aug 2019 16:53:02 +0000 (16:53 +0000)]
Remove unnecessary call to enclosingClippingScopes()
https://bugs.webkit.org/show_bug.cgi?id=201063

Reviewed by Zalan Bujtas.

This line of code did nothing, and was left in by mistake. Remove it.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateOverlapMap const):

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

25 hours ago[ews] Enable Style queue on new EWS
aakash_jain@apple.com [Fri, 23 Aug 2019 15:47:44 +0000 (15:47 +0000)]
[ews] Enable Style queue on new EWS
https://bugs.webkit.org/show_bug.cgi?id=201071

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/config.json: Enabled the scheduler for Style queue.
* BuildSlaveSupport/ews-app/ews/views/statusbubble.py: Enabled style queue bubble on new EWS.
* QueueStatusServer/config/queues.py: Removed style queue from old EWS.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BubbleQueueServer.js:
(BubbleQueueServer): Removed style queue from bot-watcher's dashboard.

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

26 hours agoCache hasCompositedScrollableOverflow as a bit on RenderLayer
simon.fraser@apple.com [Fri, 23 Aug 2019 15:31:12 +0000 (15:31 +0000)]
Cache hasCompositedScrollableOverflow as a bit on RenderLayer
https://bugs.webkit.org/show_bug.cgi?id=201065

Reviewed by Zalan Bujtas.

hasCompositedScrollableOverflow() is pretty hot on some compositing-related code paths, and isn't
super cheap, as it checks a Setting and calls into renderer code. Optimize by computing it in
computeScrollDimensions().

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::hasCompositedScrollableOverflow const):
(WebCore::RenderLayer::computeScrollDimensions):
* rendering/RenderLayer.h:

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

26 hours agoDon't call clipCrossesPaintingBoundary() when not necessary
simon.fraser@apple.com [Fri, 23 Aug 2019 15:14:46 +0000 (15:14 +0000)]
Don't call clipCrossesPaintingBoundary() when not necessary
https://bugs.webkit.org/show_bug.cgi?id=201064

Reviewed by Zalan Bujtas.

clipCrossesPaintingBoundary() does some RenderLayer ancestor walks, so avoid
calling it when we already know that the clip rects are TemporaryClipRects.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):

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

30 hours ago[GStreamer] Hole-punch build is broken
philn@webkit.org [Fri, 23 Aug 2019 10:53:00 +0000 (10:53 +0000)]
[GStreamer] Hole-punch build is broken
https://bugs.webkit.org/show_bug.cgi?id=200972

Reviewed by Žan Doberšek.

This patch fixes link issues when building with
USE_GSTREAMER_HOLEPUNCH enabled, the hole punch client destructor
was missing.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
Remove FAST_ALLOCATED annotation, because:
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
it's now in the base class, along with a default destructor.

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

34 hours agoRevert delete-in-input-in-iframe.html and typing-in-input-in-iframe.html to original...
megan_gardner@apple.com [Fri, 23 Aug 2019 07:25:00 +0000 (07:25 +0000)]
Revert delete-in-input-in-iframe.html and typing-in-input-in-iframe.html to original behaviour after r248977 and make associated test autoscroll-input-when-very-zoomed.html more stable
https://bugs.webkit.org/show_bug.cgi?id=201058

Reviewed by Simon Fraser.

delete-in-input-in-iframe and typing-in-input-in-iframe were changed when scrolling was made to work differently in r244141.
They actually did find a bug, and that bug was fixed in r248977, so we put the tests back to test that scolls do not happen.
Also update autoscroll-input-when-very-zoomed which was added to test r248977 to be more robust.

* fast/forms/ios/delete-in-input-in-iframe-expected.txt:
* fast/forms/ios/delete-in-input-in-iframe.html:
* fast/forms/ios/typing-in-input-in-iframe-expected.txt:
* fast/forms/ios/typing-in-input-in-iframe.html:
* fast/scrolling/ios/autoscroll-input-when-very-zoomed.html:

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

39 hours ago[SVG] -webkit-clip-path treats url(abc#xyz) as url(#xyz) because it checks only URL...
Hironori.Fujii@sony.com [Fri, 23 Aug 2019 02:06:42 +0000 (02:06 +0000)]
[SVG] -webkit-clip-path treats url(abc#xyz) as url(#xyz) because it checks only URL fragment part
https://bugs.webkit.org/show_bug.cgi?id=201030

Reviewed by Ryosuke Niwa.

Source/WebCore:

Tests: svg/clip-path/clip-path-invalid-reference-001-expected.svg
       svg/clip-path/clip-path-invalid-reference-001.svg
       svg/clip-path/clip-path-invalid-reference-002-expected.svg
       svg/clip-path/clip-path-invalid-reference-002.svg

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertClipPath): Use
SVGURIReference::fragmentIdentifierFromIRIString to get fragment
identifier from -webkit-clip-path.

LayoutTests:

* svg/clip-path/clip-path-invalid-reference-001-expected.svg: Added.
* svg/clip-path/clip-path-invalid-reference-001.svg: Added.
* svg/clip-path/clip-path-invalid-reference-002-expected.svg: Added.
* svg/clip-path/clip-path-invalid-reference-002.svg: Added.

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

39 hours ago[Win][MiniBrowser] URL bar should be updated for in-page navigations
Hironori.Fujii@sony.com [Fri, 23 Aug 2019 01:59:22 +0000 (01:59 +0000)]
[Win][MiniBrowser] URL bar should be updated for in-page navigations
https://bugs.webkit.org/show_bug.cgi?id=201032

Reviewed by Darin Adler.

* MiniBrowser/win/BrowserWindow.h: Added activeURLChanged to BrowserWindowClient interface.
* MiniBrowser/win/MainWindow.cpp:
(MainWindow::init):
(MainWindow::activeURLChanged): Added.
* MiniBrowser/win/MainWindow.h:
* MiniBrowser/win/MiniBrowserWebHost.cpp:
(MiniBrowserWebHost::didCommitLoadForFrame):
(MiniBrowserWebHost::didChangeLocationWithinPageForFrame): Added.
(MiniBrowserWebHost::updateAddressBar): Deleted.
(MiniBrowserWebHost::loadURL): Deleted.
* MiniBrowser/win/MiniBrowserWebHost.h:
(MiniBrowserWebHost::MiniBrowserWebHost):
(MiniBrowserWebHost::didCommitLoadForFrame): Deleted.
(MiniBrowserWebHost::didChangeLocationWithinPageForFrame): Deleted.
* MiniBrowser/win/PrintWebUIDelegate.cpp:
* MiniBrowser/win/WebKitBrowserWindow.cpp:
(WebKitBrowserWindow::create):
(WebKitBrowserWindow::WebKitBrowserWindow):
(WebKitBrowserWindow::didChangeIsLoading): Removed an unused variable.
(WebKitBrowserWindow::didChangeActiveURL): Added.
(WebKitBrowserWindow::createNewPage):
(WebKitBrowserWindow::didCommitNavigation): Deleted.
* MiniBrowser/win/WebKitBrowserWindow.h: Removed m_urlBarWnd.
* MiniBrowser/win/WebKitLegacyBrowserWindow.cpp:
(WebKitLegacyBrowserWindow::create):
(WebKitLegacyBrowserWindow::WebKitLegacyBrowserWindow):
(WebKitLegacyBrowserWindow::init):
(WebKitLegacyBrowserWindow::navigateToHistory):
* MiniBrowser/win/WebKitLegacyBrowserWindow.h: Removed m_urlBarWnd.

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

39 hours agoWeb Inspector: Console: automatically select the "Evaluations" filter whenever runnin...
drousso@apple.com [Fri, 23 Aug 2019 01:43:43 +0000 (01:43 +0000)]
Web Inspector: Console: automatically select the "Evaluations" filter whenever running commands
https://bugs.webkit.org/show_bug.cgi?id=201060

Reviewed by Timothy Hatcher.

If the Console is actively being filtered (e.g. not "All"), it can be confusing to run a
command, only to not see any results. We should automatically enable the "Evaluations"
filter in addition to any other existing filters in these cases.

* UserInterface/Views/LogContentView.js:
(WI.LogContentView.prototype.didAppendConsoleMessageView):
* UserInterface/Views/ScopeBarItem.js:
(WI.ScopeBarItem.prototype.set selected):
(WI.ScopeBarItem.prototype.toggle): Added.

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

40 hours agoWeb Inspector: REGRESSION(r248485): stack overflow when viewing a source map generate...
drousso@apple.com [Fri, 23 Aug 2019 01:07:43 +0000 (01:07 +0000)]
Web Inspector: REGRESSION(r248485): stack overflow when viewing a source map generated from inline content
https://bugs.webkit.org/show_bug.cgi?id=201042
<rdar://problem/54509750>

Reviewed by Antoine Quint.

In r248485, `WI.ResourceClusterContentView` was changed to `requestContent` whenever the
given resource finished loading (by listening for `WI.Resource.Event.LoadingDidFinish`).

Even though retrieving a source map's contents uses `Promise`s, in the case that the content
was inlined in the "original" source code, the code path would mark the source map as being
finished (which would fire a `WI.Resource.Event.LoadingDidFinish`) _before_ it could return
a `Promise`, which would've been cached (`WI.SourceCode.prototype.requestContent`) and
preventend any reentrancy.

Wrapping the inline code path in a `Promise.resolve()` gives the `WI.SourceCode` a chance to
cache the `Promise` before any events are fired.

* UserInterface/Models/SourceMapResource.js:
(WI.SourceMapResource.prototype.requestContentFromBackend):

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

41 hours ago[watchOS] Disable Content Filtering in the simulator build
aestes@apple.com [Thu, 22 Aug 2019 23:54:59 +0000 (23:54 +0000)]
[watchOS] Disable Content Filtering in the simulator build
https://bugs.webkit.org/show_bug.cgi?id=201047

Reviewed by Tim Horton.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WTF:

* wtf/Platform.h:

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

42 hours agoTry to recover nicely when getting an unexpected schema in the service workers database
cdumez@apple.com [Thu, 22 Aug 2019 23:28:45 +0000 (23:28 +0000)]
Try to recover nicely when getting an unexpected schema in the service workers database
https://bugs.webkit.org/show_bug.cgi?id=201002
<rdar://problem/54574991>

Reviewed by Youenn Fablet.

Source/WebCore:

Try to recover nicely when getting an unexpected schema in the service workers database instead
of crashing the network process. To recover, we delete the database file and re-create it.

* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::openSQLiteDatabase):
(WebCore::RegistrationDatabase::ensureValidRecordsTable):

Tools:

Add API test coverage.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:

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

42 hours agoWeb Inspector: console.dir should expand objects
nvasilyev@apple.com [Thu, 22 Aug 2019 23:17:46 +0000 (23:17 +0000)]
Web Inspector: console.dir should expand objects
https://bugs.webkit.org/show_bug.cgi?id=152039
<rdar://problem/23816853>

Reviewed by Joseph Pecoraro.

Expand objects logged by console.dir but keep them collapsed when logged by console.log.

* UserInterface/Views/ConsoleMessageView.js:
(WI.ConsoleMessageView.prototype.render):

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

42 hours agoRemove support for tvOS < 13.0
krollin@apple.com [Thu, 22 Aug 2019 22:51:46 +0000 (22:51 +0000)]
Remove support for tvOS < 13.0
https://bugs.webkit.org/show_bug.cgi?id=200963
<rdar://problem/54541355>

Reviewed by Tim Horton.

Update conditionals that reference __TV_OS_VERSION_MIN_REQUIRED and
__TV_OS_VERSION_MAX_ALLOWED, assuming that they both have values >=
130000. This means that expressions like "__TV_OS_VERSION_MIN_REQUIRED
< 130000" are always False and "__TV_OS_VERSION_MIN_REQUIRED >=
130000" are always True.

Source/WebCore/PAL:

* pal/spi/cocoa/NSKeyedArchiverSPI.h:
* pal/spi/cocoa/NSProgressSPI.h:

Source/WTF:

* wtf/FeatureDefines.h:
* wtf/Platform.h:

Tools:

* TestWebKitAPI/Tests/WebCore/cocoa/AVFoundationSoftLinkTest.mm:
(TestWebKitAPI::TEST):

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

43 hours ago[iOS] Should show input view when became first responder if keyboard was showing...
dbates@webkit.org [Thu, 22 Aug 2019 22:22:49 +0000 (22:22 +0000)]
[iOS] Should show input view when became first responder if keyboard was showing when the view was resigned
https://bugs.webkit.org/show_bug.cgi?id=200902
<rdar://problem/54231756>

Reviewed by Wenson Hsieh.

Source/WebKit:

When resigning first responder save whether the peripheral host has an input view on screen,
including the software keyboard, so that we show the input view(s) again when the WKWebView
is made first responder. In Safari, this avoids the need for a person to explicitly focus an
editable element again to bring up the keyboard when returning to a tab they were previously
typing in. It also makes the behavior of switching tabs in Safari with a software keyboard
match the behavior of doing the same thing when a hardware keyboard attached.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::focusedElementDidChangeInputMode):
Pass a diff of the activity state from the web process to the UI process so that we can
differentiate between an inputmode change as a result of page deactivation vs a change
caused by some other means. We need to differentiate these cases because we want to
ignore a page that sets inputmode "none" (i.e. a request to hide the keyboard) from inside
a focus event handler if the handler was called as part of the process of page activation
(i.e. switching to the tab). Google Docs is one example of a web site that sets inputmode
to "none" as a result of the page activation process.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanupInteraction]): Clear out state.
(-[WKContentView resignFirstResponderForWebView]): Save whether the peripheral host is on screen
into a local before ending the editing session. We then copy the local into the ivar if we
actually will resign. This ordering is explicitly done because:
        1. Ending the editing session may dismiss the keyboard => we need to query the peripheral
           host first.
        2. If the view is being resigned as a result of a keyboard dismissal (i.e. a person pressed
           the hide keyboard button on iPad) then the user has indicated that they are finished
           with the keyboard and we do not want to show the keyboard on page re-activation => we
           do not want to copy the local to the ivar.
        3. If the view refuses to resign itself then it does not make sense to save the keyboard
           state as responder status hasn't changed.
(-[WKContentView shouldShowAutomaticKeyboardUI]): Ignore inputmode="none", if needed.
(-[WKContentView _didCommitLoadForMainFrame]): Clear out state.
(-[WKContentView isFirstResponderOrBecomingFirstResponder]): Added.
(-[WKContentView shouldShowInputViewOnPageActivation:]): Added.
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]):
Update ivar if this element is being focused as a result of page activation.
(-[WKContentView _didUpdateInputMode:activityStateChanges:]): Modified to take the activity state
diff. If the input mode was changed as a result of page activation then we want to update our ivar
so that when we call -reloadInputViews and UIKit calls us back in -shouldShowAutomaticKeyboardUI we
will know to ignore inputmode set to "none" when determining whether to show the automatic keyboard UI.
Note that we do not need to check/track whether an earlier -_elementDidFocus actually started an
input session as part of updating the value of our ivar because if an input session was not started,
say the embedding client disallowed it, then we would not have a focused element => we early return from
this function. Also remove duplication and improve code readbility by making use of the convenience function
hasFocusedElement() instead of duplicating what it does.
(-[WKContentView _didUpdateInputMode:]): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::focusedElementDidChangeInputMode): Modified to take the activity state diff
and pass it through.
(WebKit::WebPageProxy::didReleaseAllTouchPoints): Pass the empty set for the activity state diff to
keep our current behavior.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::focusedElementDidChangeInputMode): Send the activity state diff to the UI process.

LayoutTests:

Add tests to ensure that we show the keyboard when becoming first responder if the view resigned with the
keyboard on screen. Also add a test to ensure that we keep our current behavior and do NOT show the keyboard
for an autofocused text field when the view becomes first responder.

* fast/events/ios/resources/check-keyboard-on-screen.js: Added.
(async.checkKeyboardOnScreen):
(async.checkKeyboardNotOnScreen):
* fast/events/ios/should-not-show-keyboard-for-autofocused-field-when-becoming-first-responder-after-navigation-expected.txt: Added.
* fast/events/ios/should-not-show-keyboard-for-autofocused-field-when-becoming-first-responder-after-navigation.html: Added.
* fast/events/ios/show-keyboard-when-becoming-first-responder-despite-inputmode-none-expected.txt: Added.
* fast/events/ios/show-keyboard-when-becoming-first-responder-despite-inputmode-none.html: Added.
* fast/events/ios/show-keyboard-when-becoming-first-responder-expected.txt: Added.
* fast/events/ios/show-keyboard-when-becoming-first-responder.html: Added.
* resources/ui-helper.js:
(window.UIHelper.waitForKeyboardToShow.return.new.Promise): Added.
(window.UIHelper.waitForKeyboardToShow): Added.
(window.UIHelper.becomeFirstResponder): Added.

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

43 hours ago[lldb-webkit] OptionSet summary shows size 0 sometimes for non-empty set
dbates@webkit.org [Thu, 22 Aug 2019 22:06:54 +0000 (22:06 +0000)]
[lldb-webkit] OptionSet summary shows size 0 sometimes for non-empty set
https://bugs.webkit.org/show_bug.cgi?id=200742

Reviewed by Simon Fraser.

The OptionSet synthetic provider must respond to requests for the value of m_storage
(i.e. GetChildMemberWithName('m_storage')) to avoid interfering with the computation
of the type summary.

Synthetic providers substitute alternative debug information (children) for the default
information for a variable. The OptionSet type summary is implemented in terms of the
OptionSet synthetic provider to maximize code reuse. If LLDB instantiates the provider
before invoking the type summary handler then evaluating GetChildMemberWithName() on
the SBValue passed to the type summary handler will access the substitute information
instead of the original debug information. As a result OptionSet's synthetic provider's
get_child_index('m_storage') returns None hence SBValue.GetChildMemberWithName('m_storage')
returned an invalid value; => WTFOptionSetProvider._bitmask() returns 0; => the size
reported in the type summary for the OptionSet is 0. Instead get_child_index('m_storage')
should return a valid value.

* lldb/lldb_webkit.py:
(FlagEnumerationProvider.__init__):
(FlagEnumerationProvider):
(FlagEnumerationProvider._get_child_index): Added. WTFOptionSetProvider will override.
(FlagEnumerationProvider._get_child_at_index): Added. WTFOptionSetProvider will override.
(FlagEnumerationProvider.size): Added.
(FlagEnumerationProvider.get_child_index): Modified to call _get_child_index().
(FlagEnumerationProvider.get_child_at_index): Modified to call _get_child_at_index().
(FlagEnumerationProvider.update): Moved initialization of self._elements to the constructor
and removed self.size. For the latter we can just expose a getter that returns the size of
the list self._elements.
(WTFOptionSetProvider._get_child_index): Added. Return the index for LLDB to query for the
value of m_storage.
(WTFOptionSetProvider):
(WTFOptionSetProvider._get_child_at_index): Added. Return the value for m_storage if it
matches the specified index.
* lldb/lldb_webkit_unittest.py:
(TestSummaryProviders.serial_test_WTFOptionSetProvider_empty): Update expected result now
that we return the value of m_storage as the last synthetic child.

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

43 hours agoRemove logging that contains a URL
krollin@apple.com [Thu, 22 Aug 2019 21:43:53 +0000 (21:43 +0000)]
Remove logging that contains a URL
https://bugs.webkit.org/show_bug.cgi?id=201052
<rdar://problem/54613204>

Reviewed by Chris Dumez.

checkURLReceivedFromWebProcess in WebProcessProxy.cpp contains an old
logging line that logs a URL. We don't log URLs any more for privacy
reasons, so remove this.

A search for WTFLogAlways.*url turns up other matches, but those are
either false positives or cases where the URLs are logged only on
demand by the developer as part of debugging.
checkURLReceivedFromWebProcess is the only place where a URL is logged
as a matter of course.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::checkURLReceivedFromWebProcess):

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

44 hours agoREGRESSION (r248974): fast/events/ios/select-all-with-existing-selection.html fails
timothy_horton@apple.com [Thu, 22 Aug 2019 21:30:46 +0000 (21:30 +0000)]
REGRESSION (r248974): fast/events/ios/select-all-with-existing-selection.html fails
https://bugs.webkit.org/show_bug.cgi?id=201050

Reviewed by Wenson Hsieh.

* fast/events/ios/select-all-with-existing-selection.html:
The test as-written doesn't actually wait for the tap to complete before
continuing on with the test - it starts immediately when the focus event
fires. This results in the selection being changed by the single click
handler *after* focusing the field.

Rewrite the test to await completion of the tap before moving forward
instead of waiting for focus.

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

44 hours agoLogging in FileSystem::deleteFile should avoid logging unsurprising errors
commit-queue@webkit.org [Thu, 22 Aug 2019 21:28:29 +0000 (21:28 +0000)]
Logging in FileSystem::deleteFile should avoid logging unsurprising errors
https://bugs.webkit.org/show_bug.cgi?id=200831

Patch by Kate Cheney <katherine_cheney@apple.com> on 2019-08-22
Reviewed by Chris Dumez.

To avoid overlogging unnecessary information, added a check to avoid logging
ENOENT (file not found) errors.

* wtf/posix/FileSystemPOSIX.cpp:
(WTF::FileSystemImpl::deleteFile):

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

44 hours agoCrash may happen when an SVG <feImage> element references the root <svg> element
said@apple.com [Thu, 22 Aug 2019 21:13:38 +0000 (21:13 +0000)]
Crash may happen when an SVG <feImage> element references the root <svg> element
https://bugs.webkit.org/show_bug.cgi?id=201014

Reviewed by Ryosuke Niwa.

Source/WebCore:

When an <feImage> references an <svg> element as its target image but
this <svg> element is also one of the ancestors of the <feImage>, the
parent <filter> should not be applied.

Test: svg/filters/filter-image-ref-root.html

* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::build const):

LayoutTests:

Ensure the cyclic reference between the <feImage> renderer and its
ancestor <svg> root renderer is broken.

* svg/filters/filter-image-ref-root-expected.txt: Added.
* svg/filters/filter-image-ref-root.html: Added.

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

46 hours agoMake ImageBuffer and SVG's FilterData isoheap'ed
rniwa@webkit.org [Thu, 22 Aug 2019 19:25:48 +0000 (19:25 +0000)]
Make ImageBuffer and SVG's FilterData isoheap'ed
https://bugs.webkit.org/show_bug.cgi?id=201029

Reviewed by Simon Fraser.

Made ImageBuffer and RenderSVGResourceFilter use IsoHeap.

* platform/graphics/ImageBuffer.cpp:
* platform/graphics/ImageBuffer.h:
* rendering/svg/RenderSVGResourceFilter.cpp:
* rendering/svg/RenderSVGResourceFilter.h:

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

46 hours agoresults.webkit.org: Remove branch and repository information from commit tooltip
jbedard@apple.com [Thu, 22 Aug 2019 19:09:55 +0000 (19:09 +0000)]
results.webkit.org: Remove branch and repository information from commit tooltip
https://bugs.webkit.org/show_bug.cgi?id=201035

Reviewed by Aakash Jain.

* resultsdbpy/resultsdbpy/view/static/js/timeline.js:
(xAxisFromScale): Remove branch and repository information from tooltip.

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

46 hours agorun-webkit-tests: Use -noBulkSymbolication when calling spindump
jbedard@apple.com [Thu, 22 Aug 2019 19:04:52 +0000 (19:04 +0000)]
run-webkit-tests: Use -noBulkSymbolication when calling spindump
https://bugs.webkit.org/show_bug.cgi?id=201000
<rdar://problem/53778938>

Reviewed by Alexey Proskuryakov.

* Scripts/webkitpy/port/darwin.py:
(DarwinPort.sample_process): Attempt to symbolicate with -noBulkSymbolication first.
* Scripts/webkitpy/port/darwin_testcase.py:
(DarwinTest.test_tailspin):
(DarwinTest.test_get_crash_log): Deleted.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_tailspin):

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

46 hours ago[GTK][WPE] Fixes for non-unified builds after r248547
aperez@igalia.com [Thu, 22 Aug 2019 18:54:34 +0000 (18:54 +0000)]
[GTK][WPE] Fixes for non-unified builds after r248547
https://bugs.webkit.org/show_bug.cgi?id=201044

Reviewed by Philippe Normand.

Source/JavaScriptCore:

* b3/B3ReduceLoopStrength.cpp: Add missing inclusions of B3BasicBlockInlines.h,
B3InsertionSet.h, and B3NaturalLoops.h
* wasm/WasmOMGForOSREntryPlan.h: Include WasmCallee.h instead of forward-declaring
BBQCallee in order to avoid build failure due to incomplete definition on template
expansions.

Source/WebCore:

* platform/audio/AudioResamplerKernel.h: Add missing inclusion of wtf/Noncopyable.h

Source/WebKit:

* NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp: Add missing inclusion of
the wtf/CrossThreadCopier.h header.
* WebProcess/WebStorage/StorageNamespaceImpl.h: Add missing inclusion of the
WebCore/PageIdentifier.h header.

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

46 hours ago[results.webkit.org Webkit.css] Change input's disable style
zhifei_fang@apple.com [Thu, 22 Aug 2019 18:50:01 +0000 (18:50 +0000)]
[results.webkit.org Webkit.css] Change input's disable style
The disable input style will always show the label like it has a value
https://bugs.webkit.org/show_bug.cgi?id=200998

Reviewed by Jonathan Bedard.

* resultsdbpy/resultsdbpy/view/static/library/css/docs.yaml: Adding a new example for disabled input that already has a value
*resultsdbpy/resultsdbpy/view/static/library/css/generate-webkit-css-docs:
* resultsdbpy/resultsdbpy/view/static/library/css/index.html:
* resultsdbpy/resultsdbpy/view/static/library/css/webkit.css:
(.input>input[type="text"][required][disabled],.input>input[type="number"][required][disabled],):When disabling a text input element even without a value, the style should match the style of a text input element with a value
(.input>input[type="text"][required][disabled]~label, .input>input[type="number"][required][disabled]~label,):
(@media (prefers-color-scheme: dark)):

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

47 hours agoAdd missing exception check in canonicalizeLocaleList
justin_michaud@apple.com [Thu, 22 Aug 2019 18:18:04 +0000 (18:18 +0000)]
Add missing exception check in canonicalizeLocaleList
https://bugs.webkit.org/show_bug.cgi?id=201021

Reviewed by Mark Lam.

JSTests:

* stress/missing-exception-check-in-canonicalizeLocaleList.js: Added.
(catch):

Source/JavaScriptCore:

* runtime/IntlObject.cpp:
(JSC::canonicalizeLocaleList):

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

47 hours agoDisable legacy TLS versions and add a temporary default to re-enable it
commit-queue@webkit.org [Thu, 22 Aug 2019 18:13:08 +0000 (18:13 +0000)]
Disable legacy TLS versions and add a temporary default to re-enable it
https://bugs.webkit.org/show_bug.cgi?id=200945

Patch by Alex Christensen <achristensen@webkit.org> on 2019-08-22
Reviewed by Brady Eidson.

Source/WebKit:

* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::privateSessionParameters):
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):

Source/WTF:

* wtf/Platform.h:

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

47 hours agoMake MediaStreamTrackPrivate WeakPtrFactoryInitialization::Eager
youenn@apple.com [Thu, 22 Aug 2019 18:01:09 +0000 (18:01 +0000)]
Make MediaStreamTrackPrivate WeakPtrFactoryInitialization::Eager
https://bugs.webkit.org/show_bug.cgi?id=201037

Reviewed by Darin Adler.

No change of behavior, replacing m_weakThis by the more convenient Eager.

* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
(WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.h:

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

47 hours agoRebaseline some editing tests after r248974
timothy_horton@apple.com [Thu, 22 Aug 2019 17:35:06 +0000 (17:35 +0000)]
Rebaseline some editing tests after r248974
https://bugs.webkit.org/show_bug.cgi?id=200999
<rdar://problem/54564878>

* platform/ios/editing/deleting/smart-delete-003-expected.txt:
* platform/ios/editing/deleting/smart-delete-004-expected.txt:
* platform/ios/editing/pasteboard/smart-paste-008-expected.txt:

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

2 days agoWeb Inspector: Cleanup some unused code
pecoraro@apple.com [Thu, 22 Aug 2019 17:23:59 +0000 (17:23 +0000)]
Web Inspector: Cleanup some unused code
https://bugs.webkit.org/show_bug.cgi?id=201041

Reviewed by Alex Christensen.

* UserInterface/Views/CPUUsageCombinedView.css:
(.cpu-usage-combined-view > .graph > .stacked-area-chart):
* UserInterface/Views/CPUUsageCombinedView.js:
(WI.CPUUsageCombinedView):
* UserInterface/Views/MediaTimelineOverviewGraph.js:
(WI.MediaTimelineOverviewGraph):

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

2 days agoRename StringBuilder functions to avoid unclear "append uninitialized" terminology
darin@apple.com [Thu, 22 Aug 2019 16:50:27 +0000 (16:50 +0000)]
Rename StringBuilder functions to avoid unclear "append uninitialized" terminology
https://bugs.webkit.org/show_bug.cgi?id=201020

Reviewed by Alex Christensen.

* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::allocateBuffer): Use std::memcpy instead of just memcpy.
(WTF::StringBuilder::extendBufferForAppending): Renamed.
(WTF::StringBuilder::extendBufferForAppendingWithoutOverflowCheck): Ditto.
(WTF::StringBuilder::extendBufferForAppending8): Ditto.
(WTF::StringBuilder::extendBufferForAppending16): Ditto.
(WTF::StringBuilder::extendBufferForAppendingSlowPath): Ditto.
(WTF::StringBuilder::appendCharacters): Updated for new names.
* wtf/text/StringBuilder.h: Updated for new names.

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

2 days agoWeb Inspector: Provide an engineering option to log protocol traffic as text
pecoraro@apple.com [Thu, 22 Aug 2019 16:42:57 +0000 (16:42 +0000)]
Web Inspector: Provide an engineering option to log protocol traffic as text
https://bugs.webkit.org/show_bug.cgi?id=200969

Reviewed by Devin Rousso.

* UserInterface/Base/Setting.js:
* UserInterface/Protocol/LoggingProtocolTracer.js:
(WI.LoggingProtocolTracer.prototype._processEntry):
(WI.LoggingProtocolTracer):
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createDebugSettingsView):

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

2 days agoUse makeString and multi-argument StringBuilder::append instead of less efficient...
darin@apple.com [Thu, 22 Aug 2019 16:26:04 +0000 (16:26 +0000)]
Use makeString and multi-argument StringBuilder::append instead of less efficient multiple appends
https://bugs.webkit.org/show_bug.cgi?id=200862

Reviewed by Ryosuke Niwa.

Source/JavaScriptCore:

* runtime/ExceptionHelpers.cpp:
(JSC::createUndefinedVariableError): Got rid of unnecessary local variable.
(JSC::notAFunctionSourceAppender): Use single append instead of multiple.
Eliminate unneeded and unconventional use of makeString on a single string literal.
(JSC::invalidParameterInstanceofNotFunctionSourceAppender): Ditto.
(JSC::invalidParameterInstanceofhasInstanceValueNotFunctionSourceAppender): Ditto.
(JSC::createInvalidFunctionApplyParameterError): Ditto.
(JSC::createInvalidInParameterError): Ditto.
(JSC::createInvalidInstanceofParameterErrorNotFunction): Ditto.
(JSC::createInvalidInstanceofParameterErrorHasInstanceValueNotFunction): Ditto.

* runtime/FunctionConstructor.cpp:
(JSC::constructFunctionSkippingEvalEnabledCheck): Use single append instead of multiple.
* runtime/Options.cpp:
(JSC::Options::dumpOption): Ditto.
* runtime/TypeProfiler.cpp:
(JSC::TypeProfiler::typeInformationForExpressionAtOffset): Ditto.
* runtime/TypeSet.cpp:
(JSC::StructureShape::stringRepresentation): Ditto. Also use a modern for loop.

Source/WebCore:

* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::loggingString const): Use one append instead of multiple.
* Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
(WebCore::IDBObjectStoreInfo::loggingString const): Ditto.
* Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
(WebCore::toRTCCodecParameters): Ditto.
* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::youTubeURLFromAbsoluteURL): Ditto.
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::generateDatabaseFileName): Ditto.
* Modules/websockets/WebSocketExtensionDispatcher.cpp:
(WebCore::WebSocketExtensionDispatcher::createHeaderValue const): Ditto.
(WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension): Ditto.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::clientLocation const): Use makeString instead of
StringBuilder.

* bindings/js/JSDOMExceptionHandling.cpp:
(WebCore::appendArgumentMustBe): Use one append instead of multiple.
(WebCore::throwArgumentMustBeEnumError): Ditto.
(WebCore::throwArgumentTypeError): Ditto.
* contentextensions/CombinedURLFilters.cpp:
(WebCore::ContentExtensions::recursivePrint): Ditto.
* css/CSSBasicShapes.cpp:
(WebCore::buildCircleString): Ditto.
(WebCore::buildEllipseString): Ditto.
(WebCore::buildPolygonString): Ditto.
(WebCore::buildInsetString): Ditto.

* css/CSSCalculationValue.cpp:
(WebCore::buildCssText): Deleted.
(WebCore::CSSCalcValue::customCSSText const): Use makeString.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::cssText const): Use one append instead of multiple.

* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::customCSSText const): Use makeString.
* css/CSSFilterImageValue.cpp:
(WebCore::CSSFilterImageValue::customCSSText const): Ditto.
* css/CSSFontFaceRule.cpp:
(WebCore::CSSFontFaceRule::cssText const): Ditto.
* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::customCSSText const): Ditto.

* css/CSSGradientValue.cpp:
(WebCore::appendGradientStops): Moved code here from CSSLinearGradientValue::customCSSText
so it can be shared with CSSRadialGradientValue::customCSSText. Use one append per stop.
(WebCore::CSSLinearGradientValue::customCSSText const): Use one append instead of multiple.
(WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
(WebCore::CSSConicGradientValue::customCSSText const): Ditto.
* css/CSSMediaRule.cpp:
(WebCore::CSSMediaRule::cssText const): Ditto.
* css/CSSNamespaceRule.cpp:
(WebCore::CSSNamespaceRule::cssText const): Ditto.

* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::selectorText const): Use makeString.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
Use one append instead of multiple.

* css/CSSPropertySourceData.cpp:
(WebCore::CSSPropertySourceData::CSSPropertySourceData): Initialize in the
structure definition instead of the constructor.
(WebCore::CSSPropertySourceData::toString const): Use makeString.
* css/CSSPropertySourceData.h: Initialize in the structure definition.

* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::cssText const): Use makeString.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseFontFaceDescriptor): Use makeString.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::font const): Use one append instead of multiple.

Source/WebKit:

* Shared/mac/AuxiliaryProcessMac.mm:
(WebKit::setAndSerializeSandboxParameters): Use one append instead of multiple.

Source/WTF:

* wtf/DateMath.cpp:
(WTF::makeRFC2822DateString): Use one append instead of multiple.
* wtf/JSONValues.cpp:
(WTF::appendDoubleQuotedString): Ditto.

Tools:

* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::statisticsDidRunTelemetryCallback): Use makeString.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::findAndDumpWebKitProcessIdentifiers): Ditto.
(WTR::TestController::downloadDidReceiveServerRedirectToURL): Ditto.
(WTR::TestController::downloadDidFail): Ditto.

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

2 days agoPass conformance/attribs WebGL conformance tests
commit-queue@webkit.org [Thu, 22 Aug 2019 15:34:06 +0000 (15:34 +0000)]
Pass conformance/attribs WebGL conformance tests
https://bugs.webkit.org/show_bug.cgi?id=200901

Patch by Kai Ninomiya <kainino@chromium.org> on 2019-08-22
Reviewed by Alex Christensen.

Tested by
LayoutTests/webgl/*/conformance/attribs/gl-vertexattribpointer.html,
LayoutTests/webgl/2.0.0/conformance/more/functions/vertexAttribPointerBadArgs.html,
and other conformance/attribs/* tests not included in LayoutTests.
LayoutTests/webgl/1.0.2/conformance/more/functions/vertexAttribPointerBadArgs.html
fails as expected because it is an old snapshot of an incorrect test.

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::validateVertexAttributes):
(WebCore::WebGLRenderingContextBase::vertexAttribPointer):
* html/canvas/WebGLVertexArrayObjectBase.cpp:
(WebCore::WebGLVertexArrayObjectBase::setVertexAttribState):
* html/canvas/WebGLVertexArrayObjectBase.h:

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

2 days agoTyping Korean in title field after typing in the body inserts extraneous characters...
wenson_hsieh@apple.com [Thu, 22 Aug 2019 15:09:48 +0000 (15:09 +0000)]
Typing Korean in title field after typing in the body inserts extraneous characters on blog.naver.com
https://bugs.webkit.org/show_bug.cgi?id=201023
<rdar://problem/54294794>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Ensures that we recognize the blog editor on blog.naver.com to be a hidden editable area. This website places
focus inside an editable body element of a subframe that is completely empty (width: 0 and border: 0). See the
WebKit ChangeLog for more details.

Test: editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):

Source/WebKit:

After r242833, we began to avoid sending redundant ElementDidFocus updates in the case where a focused element
was blurred and refocused within the same runloop. This was done to prevent the input view from flickering due
to input view reloading, as well as scrolling to reveal the focused element, when tapping to change selection on
Microsoft Word online.

However, on blog.naver.com, these ElementDidFocus messages were necessary in order to ensure that the platform
input context changes when moving between the title and body fields, or when tapping to change selection. This
is because blog.naver.com uses a hidden contenteditable area under a subframe (see WebCore ChangeLog for more
detail here). While text is never directly inserted into this hidden contenteditable, the events are observed
and used to "play back" editing in the main visible content area.

Thus, when moving between the title and body fields (or when changing selection within either), the only hint we
get is that the hidden editable element is blurred and immediately refocused. Since we no longer send
ElementDidFocus updates in this scenario, UIKeyboardImpl and kbd are not aware that the page has effectively
changed input contexts.

Combined with the fact that Korean IME on iOS may insert additional text given the document context (i.e. text
that the input manager, kbd, thinks we've previously inserted), this means that when typing several characters
into the body field on naver and then switching to edit the title, initial keystrokes may insert unexpected
text in the title field.

To fix this, we add some hooks to notify the UI process when an element that was blurred has been immediately
refocused. Upon receiving this message, the UI process then tells UIKeyboardImpl to re-retrieve its input
context, which calls into -requestAutocorrectionContextWithCompletionHandler: in WKContentView. While notorious
for being synchronous IPC, this is mitigated by (1) being limiting to only instances where we have a hidden
editable area, and (2) being limited by a batching mechanism in the web process, such that if the focused
element is blurred, refocused, re-blurred, and refocused many times in the same runloop, we'll only send a
single UpdateInputContextAfterBlurringAndRefocusingElement message (as opposed to the many ElementDidFocus
messages we would've sent in previous releases).

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

Add a new mechanism to update the platform input context (on iOS, UIKeyboardImpl's document state) when focus
moves away from and immediately returns to a hidden editable element.

* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::updateInputContextAfterBlurringAndRefocusingElement):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _updateInputContextAfterBlurringAndRefocusingElement]):

Tell the active UIKeyboardImpl to refetch document state from the WKContentView. While this does result in a new
autocorrection context request (which, unfortunately, triggers synchronous IPC to the web process), this request
would've still happened anyways in the case where we would previously have sent an ElementDidFocus message.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::updateInputContextAfterBlurringAndRefocusingElement):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::elementDidFocus):

In the case where we avoid sending a full ElementDidFocus message to the UI process due to refocusing the same
element, we should still notify the UI process so that it can synchronize state between the application process
and kbd. See above for more details.

(WebKit::WebPage::elementDidBlur):
(WebKit::WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateInputContextAfterBlurringAndRefocusingElementIfNeeded):

LayoutTests:

Add a new layout test to verify that we suppress text interactions when focusing an editable element inside an
empty, borderless subframe.

* editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe-expected.txt: Added.
* editing/selection/ios/do-not-show-selection-in-empty-borderless-subframe.html: Added.

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

2 days ago[GTK][WPE] Support for command "--version" on the MiniBrowser (follow-up fix)
clopez@igalia.com [Thu, 22 Aug 2019 11:41:02 +0000 (11:41 +0000)]
[GTK][WPE] Support for command "--version" on the MiniBrowser (follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=200978

Unreviewed follow-up fix.

Update the string format specifier for unsigned it.

Patch by clopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> on 2019-08-22

* MiniBrowser/gtk/main.c:
(main):
* MiniBrowser/wpe/main.cpp:
(main):

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

2 days ago[GTK][WPE] Support for command "--version" on the MiniBrowser
clopez@igalia.com [Thu, 22 Aug 2019 11:18:58 +0000 (11:18 +0000)]
[GTK][WPE] Support for command "--version" on the MiniBrowser
https://bugs.webkit.org/show_bug.cgi?id=200978

Reviewed by Žan Doberšek.

Printing the engine version used from the MiniBrowser is useful.
For example, the test scripts on WPT can use this info to better
tag the generated results.

* MiniBrowser/gtk/main.c: Print the engine version when called with --version or -v.
(main):
* MiniBrowser/wpe/main.cpp: Ditto.
(main):

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

2 days agoCaptureDeviceManager does not need to be CanMakeWeakPtr
youenn@apple.com [Thu, 22 Aug 2019 11:05:50 +0000 (11:05 +0000)]
CaptureDeviceManager does not need to be CanMakeWeakPtr
https://bugs.webkit.org/show_bug.cgi?id=200936

Reviewed by Alex Christensen.

CaptureDeviceManager does not need to create a weak pointer in deviceChanged
since it directly calls RealtimeMediaSourceCenter singleton.

CoreAudioCaptureDeviceManager does not need to create a weak pointer since its only
instance is NeverDestroyed.
No change of behavior.

* platform/mediastream/CaptureDeviceManager.cpp:
(WebCore::CaptureDeviceManager::deviceChanged):
* platform/mediastream/CaptureDeviceManager.h:
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
(WebCore::createAudioObjectPropertyListenerBlock):
(WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
(WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
* platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:

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

2 days agoAdd a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come...
youenn@apple.com [Thu, 22 Aug 2019 11:05:12 +0000 (11:05 +0000)]
Add a WebsiteDataStore delegate to handle AuthenticationChallenge that do not come from pages
https://bugs.webkit.org/show_bug.cgi?id=196870

Reviewed by Alex Christensen.

Source/WebKit:

Make NetworkProcess provide the session ID for any authentication challenge.
In case there is no associated page for the authentication challenge or this is related to a service worker,
ask the website data store to take a decision.
Add website data store delegate to allow applications to make the decision.
Restrict using the delegate to server trust evaluation only.

Make ping loads reuse the same mechanism.

Covered by service worker tests and updated beacon test.

* NetworkProcess/NetworkCORSPreflightChecker.cpp:
(WebKit::NetworkCORSPreflightChecker::didReceiveChallenge):
* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::sessionID const):
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didReceiveChallenge):
* NetworkProcess/NetworkLoadChecker.h:
(WebKit::NetworkLoadChecker::networkProcess):
* NetworkProcess/PingLoad.cpp:
(WebKit::PingLoad::didReceiveChallenge):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
* Shared/Authentication/AuthenticationManager.h:
* Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.h: Copied from Tools/WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h.
* Shared/Authentication/cocoa/AuthenticationChallengeDispositionCocoa.mm: Copied from Source/WebKit/Shared/Authentication/cocoa/ClientCertificateAuthenticationXPCConstants.h.
(WebKit::toAuthenticationChallengeDisposition):
* SourcesCocoa.txt:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(WebsiteDataStoreClient::WebsiteDataStoreClient):
* UIProcess/API/Cocoa/_WKWebsiteDataStoreDelegate.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/ServiceWorkerProcessProxy.cpp:
* UIProcess/ServiceWorkerProcessProxy.h:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::isServiceWorkerPageID const):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStoreClient.h:
(WebKit::WebsiteDataStoreClient::didReceiveAuthenticationChallenge):
* WebKit.xcodeproj/project.pbxproj:

Tools:

Implement the new delegate by respecting the value set by testRunner.setAllowsAnySSLCertificate
Accept any server certificate by default.

* WebKitTestRunner/TestController.cpp:
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::cocoaResetStateToConsistentValues):
(WTR::TestController::setAllowsAnySSLCertificate):
* WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.h:
* WebKitTestRunner/cocoa/TestWebsiteDataStoreDelegate.mm:
(-[TestWebsiteDataStoreDelegate didReceiveAuthenticationChallenge:completionHandler:]):
(-[TestWebsiteDataStoreDelegate setAllowAnySSLCertificate:]):

LayoutTests:

Add tests to validate that the delegate decision is respected for beacons and service worker loads.

* http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight-expected.txt:
* http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html:
* http/wpt/beacon/resources/beacon-preflight.py:
(main):
* http/wpt/service-workers/resources/lengthy-pass.py:
(main):
* http/wpt/service-workers/server-trust-evaluation.https-expected.txt: Added.
* http/wpt/service-workers/server-trust-evaluation.https.html: Added.
* http/wpt/service-workers/server-trust-worker.js: Added.

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

2 days agoFix unsafe usage of MediaStreamTrackPrivate from background thread in MediaStreamTrac...
cdumez@apple.com [Thu, 22 Aug 2019 09:41:57 +0000 (09:41 +0000)]
Fix unsafe usage of MediaStreamTrackPrivate from background thread in MediaStreamTrackPrivate::audioSamplesAvailable()
https://bugs.webkit.org/show_bug.cgi?id=200924

Reviewed by Youenn Fablet.

MediaStreamTrackPrivate is constructed / destructed on the main thread but its MediaStreamTrackPrivate::audioSamplesAvailable()
gets called on a background thread. The audioSamplesAvailable() method may get called until the MediaStreamTrackPrivate
destructor unregisters |this| as an observer from m_source. Event though MediaStreamTrackPrivate subclasses ThreadSafeRefCounted,
ref'ing |this| on the background thread inside audioSamplesAvailable() is still unsafe as the destructor may already be running
on the main thread.

* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
(WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate):
(WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
* platform/mediastream/MediaStreamTrackPrivate.h:

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

2 days ago[SOUP] NetworkProcessSoup does not initialize CacheOptions correctly
csaavedra@igalia.com [Thu, 22 Aug 2019 09:40:25 +0000 (09:40 +0000)]
[SOUP] NetworkProcessSoup does not initialize CacheOptions correctly
https://bugs.webkit.org/show_bug.cgi?id=200886

Reviewed by Philippe Normand.

r247567 wrongly initializes CacheOptions in a local variable that is never used
instead of using NetworkProcess's member variable, that is later used by the
NetworkSession to initialize the cache.

* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):

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

2 days agoRemove the dead code of ScalableImageDecoder for scaling
Hironori.Fujii@sony.com [Thu, 22 Aug 2019 09:12:33 +0000 (09:12 +0000)]
Remove the dead code of ScalableImageDecoder for scaling
https://bugs.webkit.org/show_bug.cgi?id=200498

Reviewed by Daniel Bates.

No ports are using the down scaling feature of
ScalableImageDecoder now. Removed it.

No behavior change.

* platform/image-decoders/ScalableImageDecoder.cpp:
(WebCore::ScalableImageDecoder::prepareScaleDataIfNecessary): Deleted.
(WebCore::ScalableImageDecoder::upperBoundScaledX): Deleted.
(WebCore::ScalableImageDecoder::lowerBoundScaledX): Deleted.
(WebCore::ScalableImageDecoder::upperBoundScaledY): Deleted.
(WebCore::ScalableImageDecoder::lowerBoundScaledY): Deleted.
(WebCore::ScalableImageDecoder::scaledY): Deleted.
* platform/image-decoders/ScalableImageDecoder.h:
(WebCore::ScalableImageDecoder::scaledSize): Deleted.
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::setSize):
(WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode):
(WebCore::GIFImageDecoder::haveDecodedRow):
(WebCore::GIFImageDecoder::frameComplete):
(WebCore::GIFImageDecoder::initFrameBuffer):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::outputScanlines):
(WebCore::JPEGImageDecoder::setSize): Deleted.
* platform/image-decoders/jpeg/JPEGImageDecoder.h:
* platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:
(WebCore::JPEG2000ImageDecoder::decode):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::initFrameBuffer):
(WebCore::PNGImageDecoder::frameComplete):
(WebCore::PNGImageDecoder::setSize): Deleted.
* platform/image-decoders/png/PNGImageDecoder.h:

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

2 days agoUnreviewed build fix; add a 'final' declaration on shouldOverridePauseDuringRouteChan...
jer.noble@apple.com [Thu, 22 Aug 2019 06:16:08 +0000 (06:16 +0000)]
Unreviewed build fix; add a 'final' declaration on shouldOverridePauseDuringRouteChange().

* Modules/mediastream/MediaStream.h:

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

2 days agoLayout Test perf/clone-with-focus.html is a Flaky Failure
rniwa@webkit.org [Thu, 22 Aug 2019 05:51:53 +0000 (05:51 +0000)]
Layout Test perf/clone-with-focus.html is a Flaky Failure
https://bugs.webkit.org/show_bug.cgi?id=201012

Reviewed by Antti Koivisto.

The flakiness was observed when the time to clone elements without focus is 0ms
but the time to clone elements with focus is 1ms or greater.

The test tries to make sure the time to clone elements with foucs is less than 2x
of the time to clone elements without focus. When the time to clone without focus
is 0ms, any difference is always more than 2x larger.

Fixed the test by increasing the number of elements until the time to clone without
focus takes at least 5ms.

* perf/clone-with-focus.html:

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

2 days agoresults.webkit.org: Fix drawer style
jbedard@apple.com [Thu, 22 Aug 2019 05:33:33 +0000 (05:33 +0000)]
results.webkit.org: Fix drawer style
https://bugs.webkit.org/show_bug.cgi?id=200988

Rubber-stamped by Aakash Jain.

* resultsdbpy/resultsdbpy/view/static/js/drawer.js:
(Drawer): Nothing in the drawer should be selectable.
(ConfigurationSelectors): Standardize text size, remove underscore from expanders.
* resultsdbpy/resultsdbpy/view/static/library/css/webkit.css:
(.action:hover): Disable underline on 'links' which are actually actions
(.unselectable): Make a div unselectable.
* resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:
(Timeline.ExpandableSeriesWithHeaderExpanderComponent): Remove underscore from expanders.

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

2 days ago[WHLSL] Improve default constructor and emit fewer pointers in metal codegen
sbarati@apple.com [Thu, 22 Aug 2019 02:55:32 +0000 (02:55 +0000)]
[WHLSL] Improve default constructor and emit fewer pointers in metal codegen
https://bugs.webkit.org/show_bug.cgi?id=200995

Reviewed by Myles C. Maxfield.

This patch makes it so that we:
1. Emit less code for copy constructors by omitting an unused variable.
2. Emit ternary expressions instead of if statements for conditional assignments.
3. Don't copy pointers for producing an lvalue from DereferenceExpression.
4. Lazily produce lvalues for GlobalVariableReference.

* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
(WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
(WebCore::WHLSL::Metal::inlineNativeFunction):

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

2 days ago[WHLSL] Vertex shader and fragment shader need to be able to come from two different...
mmaxfield@apple.com [Thu, 22 Aug 2019 02:50:21 +0000 (02:50 +0000)]
[WHLSL] Vertex shader and fragment shader need to be able to come from two different programs
https://bugs.webkit.org/show_bug.cgi?id=195446

Reviewed by Saam Barati.

Source/WebCore:

When an author configures WebGPU to render things, the author provides a vertex shader and a fragment
shader, and they both execute within the same draw call. It's common for authors coming from WebGL to
put the two shaders in distinct files. Until this patch, WHLSL was unable to process two shaders from
different sources which were meant to be hooked together.

The first thing this patch does is add the notion of a "shader module" to the WHLSL compiler. This
represents the source code containing one or more shaders. When the author wants to actually compile
their source, they supply one or more shader modules to the compiler. The compiler then looks in the
first module for the vertex shader and the second module for the fragment shader. The two modules are
passed by reference, so they may refer to the same underlying object, which is supported.

Shader modules have this interesting behavior where, within a shader module, funtion / type names may
refer to each other, but may not refer to any other name within any other shader module. They behave
as if all the names inside the module are not exported. So, it would seem that the most natural way to
support this would be to run the WHLSL compiler and the MSL compiler twice independently, once for each
module. However, this means that our compile times would double, which would be unfortunate. Instead,
a more performant option would be to make the WHLSL compiler smart enough to handle multiple shader
modules at once, and to produce a single merged output program that contains everything. It does this
by parsing all the shader modules into a single Program object, but remembering which items in the
Program came from which places.

This is implemented by teaching the WHLSL compiler about "namespaces." There are three namespaces: one
for each shader module, and an additional one for the standard library. Every global object (e.g.
named types and functions) knows which namespace it lives inside. The NameResolver has been educated
to understand namespaces, so when you ask it for a name in a particular namespace, it will look up
all the names both in that namespace and in the standard library's namespace, and it will union the
results together.

Function overload resolution doesn't actually go through the name resolver; instead, it's handled by
sorting all functions into buckets such that any CallExpression only has to look in a single bucket
to find all its potential overloads. These buckets can't be educated about namespaces (consider a
function which has overloads in all 3 namespaces that is called from both shader modules - all the
overloads must end up in the same bucket). Therefore, this logic is moved into
resolveFunctionOverload(), which will now disregard candidate functions if they are in an inaccessible
namespace.

Tests: webgpu/whlsl/separate-shader-modules/separate-shader-modules-10.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-11.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-12.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-13.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-14.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-15.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-16.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-17.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-18.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-19.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-2.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-20.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-21.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-22.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-23.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-24.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-25.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-26.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-27.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-3.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-4.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-5.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-6.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-7.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-8.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules-9.html
       webgpu/whlsl/separate-shader-modules/separate-shader-modules.html

* Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
(WebCore::WHLSL::AST::FunctionDeclaration::nameSpace const):
(WebCore::WHLSL::AST::FunctionDeclaration::setNameSpace):
* Modules/webgpu/WHLSL/AST/WHLSLNameSpace.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h.
* Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:
(WebCore::WHLSL::AST::NamedType::nameSpace const):
(WebCore::WHLSL::AST::NamedType::setNameSpace):
* Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
(WebCore::WHLSL::Metal::emitMetalFunctions):
* Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
(WebCore::WHLSL::DuplicateFunctionKey::operator== const):
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::FunctionKey::operator== const):
(WebCore::WHLSL::checkOperatorOverload):
(WebCore::WHLSL::Checker::checkShaderType):
(WebCore::WHLSL::Checker::visit):
(WebCore::WHLSL::Checker::resolveFunction):
* Modules/webgpu/WHLSL/WHLSLLexer.cpp:
* Modules/webgpu/WHLSL/WHLSLNameContext.cpp:
(WebCore::WHLSL::NameContext::add):
(WebCore::WHLSL::NameContext::getTypes):
(WebCore::WHLSL::NameContext::getFunctions):
(WebCore::WHLSL::NameContext::searchTypes const):
(WebCore::WHLSL::NameContext::searchFunctions const):
(WebCore::WHLSL::NameContext::globalExists const):
(WebCore::WHLSL::NameContext::localExists const):
(WebCore::WHLSL::NameContext::exists): Deleted.
* Modules/webgpu/WHLSL/WHLSLNameContext.h:
(WebCore::WHLSL::NameContext::setCurrentNameSpace):
* Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
(WebCore::WHLSL::NameResolver::NameResolver):
(WebCore::WHLSL::NameResolver::visit):
(WebCore::WHLSL::resolveNamesInTypes):
(WebCore::WHLSL::resolveTypeNamesInFunctions):
* Modules/webgpu/WHLSL/WHLSLNameResolver.h:
(WebCore::WHLSL::NameResolver::setCurrentNameSpace):
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Parser::parse):
(WebCore::WHLSL::Parser::fail):
(WebCore::WHLSL::Parser::consumeIntegralLiteral):
(WebCore::WHLSL::Parser::consumeNonNegativeIntegralLiteral):
(WebCore::WHLSL::Parser::parseConstantExpression):
(WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
(WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
(WebCore::WHLSL::Parser::parseBuiltInSemantic):
(WebCore::WHLSL::Parser::parseResourceSemantic):
(WebCore::WHLSL::Parser::parseStageInOutSemantic):
(WebCore::WHLSL::Parser::parseEnumerationDefinition):
(WebCore::WHLSL::Parser::parseEnumerationMember):
(WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
(WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
(WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
(WebCore::WHLSL::Parser::parseSwitchCase):
(WebCore::WHLSL::Parser::parseForLoop):
(WebCore::WHLSL::Parser::parseVariableDeclarations):
(WebCore::WHLSL::Parser::completeAssignment):
(WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
(WebCore::WHLSL::Parser::parseTerm):
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
(WebCore::WHLSL::ShaderModule::ShaderModule):
(WebCore::WHLSL::createShaderModule):
(WebCore::WHLSL::ShaderModuleDeleter::operator()):
(WebCore::WHLSL::prepareShared):
(WebCore::WHLSL::prepare):
* Modules/webgpu/WHLSL/WHLSLPrepare.h:
* Modules/webgpu/WHLSL/WHLSLProgram.h:
(WebCore::WHLSL::Program::append):
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
(WebCore::WHLSL::resolveFunctionOverloadImpl):
(WebCore::WHLSL::resolveFunctionOverload):
* Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.h:
* Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
(WebCore::WHLSL::matchSemantics):
(WebCore::WHLSL::findEntryPoint): Deleted.
* Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h:
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
(WebCore::WHLSL::includeStandardLibrary):
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.h:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/GPUShaderModule.h:
(WebCore::GPUShaderModule::platformShaderModule const):
(WebCore::GPUShaderModule::whlslModule const):
(WebCore::GPUShaderModule::whlslSource const): Deleted.
* platform/graphics/gpu/cocoa/GPUComputePipelineMetal.mm:
(WebCore::trySetFunctions):
(WebCore::convertComputePipelineDescriptor):
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::trySetMetalFunctions):
(WebCore::trySetFunctions):
(WebCore::convertRenderPipelineDescriptor):
* platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm:
(WebCore::GPUShaderModule::tryCreate):
(WebCore::GPUShaderModule::GPUShaderModule):

LayoutTests:

* webgpu/whlsl/separate-shader-modules/separate-shader-modules-10-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-10.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-11-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-11.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-12-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-12.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-13-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-13.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-14-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-14.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-15-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-15.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-16-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-16.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-17-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-17.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-18-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-18.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-19-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-19.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-2-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-2.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-20-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-20.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-21-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-21.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-22-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-22.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-23-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-23.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-24-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-24.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-25-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-25.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-26-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-26.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-27-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-27.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-3-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-3.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-4-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-4.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-5-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-5.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-6-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-6.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-7-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-7.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-8-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-8.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-9-expected.txt: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-9.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules-expected.html: Added.
* webgpu/whlsl/separate-shader-modules/separate-shader-modules.html: Added.

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

2 days agoFix infinite recursion in WTFCrashWithInfo() after r248930.
mark.lam@apple.com [Thu, 22 Aug 2019 02:44:01 +0000 (02:44 +0000)]
Fix infinite recursion in WTFCrashWithInfo() after r248930.
https://bugs.webkit.org/show_bug.cgi?id=201022

Reviewed by Saam Barati.

* wtf/Assertions.cpp:
(WTFCrashWithInfoImpl):
(WTFCrashWithInfo): Deleted.
* wtf/Assertions.h:
(WTFCrashWithInfo):

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

2 days agoWeb Inspector: RTL: DOM outline in Elements tab should be LTR
nvasilyev@apple.com [Thu, 22 Aug 2019 02:33:40 +0000 (02:33 +0000)]
Web Inspector: RTL: DOM outline in Elements tab should be LTR
https://bugs.webkit.org/show_bug.cgi?id=200601

Reviewed by Timothy Hatcher.

Make DOM outlines in Console and Elements tab always LTR,
and unsure that Left and Right arrow keys continue working correctly.

* UserInterface/Base/Main.js:
(WI.resolveLayoutDirectionForElement): Added.
The existing WI.resolvedLayoutDirection function returns the value of the root DOM element.
The newly added resolveLayoutDirectionForElement function returns the correct value for any element,
including elements with `dir=ltr` inside of `<body dir=rtl>`.

* UserInterface/Views/DOMTreeOutline.css:
(.tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
(.tree-outline.dom li:not(.editing)):
(.tree-outline.dom li.editing):
(.tree-outline.dom li .pseudo-class-indicator):
(.tree-outline.dom.single-node li):
(.tree-outline.dom li.parent):
(.tree-outline.dom li .html-tag.close):
(.tree-outline.dom li.parent::before):
(.tree-outline.dom li.parent.shadow::after):
Remove RTL logic.

* UserInterface/Views/DOMTreeOutline.js:
* UserInterface/Views/TreeOutline.js:
(WI.TreeOutline.prototype._treeKeyDown):
Make Left and Right arrow keys work correctly for LTR DOM outlines inside of the global RTL.

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

2 days ago[Win][MiniBrowser] Add a progress indicator to the main window
Hironori.Fujii@sony.com [Thu, 22 Aug 2019 01:49:48 +0000 (01:49 +0000)]
[Win][MiniBrowser] Add a progress indicator to the main window
https://bugs.webkit.org/show_bug.cgi?id=200970

Reviewed by Alex Christensen.

* MiniBrowser/win/BrowserWindow.h: Added BrowserWindowClient class.
* MiniBrowser/win/MainWindow.cpp:
(MainWindow::init):
(MainWindow::resizeSubViews):
(MainWindow::progressChanged):
(MainWindow::progressFinished):
* MiniBrowser/win/MainWindow.h: Inherited BrowserWindowClient.
Added m_hProgressIndicator.
(MainWindow::hwnd const): Deleted.
(MainWindow::browserWindow const): Deleted.
(): Deleted.
* MiniBrowser/win/MiniBrowserWebHost.cpp:
(MiniBrowserWebHost::onNotify):
* MiniBrowser/win/MiniBrowserWebHost.h:
* MiniBrowser/win/WebKitBrowserWindow.cpp:
(WebKitBrowserWindow::create):
(WebKitBrowserWindow::WebKitBrowserWindow):
(WebKitBrowserWindow::didChangeIsLoading):
(WebKitBrowserWindow::didChangeEstimatedProgress):
(WebKitBrowserWindow::createNewPage):
* MiniBrowser/win/WebKitBrowserWindow.h:
* MiniBrowser/win/WebKitLegacyBrowserWindow.cpp:
(WebKitLegacyBrowserWindow::create):
(WebKitLegacyBrowserWindow::WebKitLegacyBrowserWindow):
(WebKitLegacyBrowserWindow::init):
* MiniBrowser/win/WebKitLegacyBrowserWindow.h:

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

2 days agoWasm::FunctionParser is failing to enforce maxFunctionLocals.
mark.lam@apple.com [Thu, 22 Aug 2019 01:42:22 +0000 (01:42 +0000)]
Wasm::FunctionParser is failing to enforce maxFunctionLocals.
https://bugs.webkit.org/show_bug.cgi?id=201016
<rdar://problem/54579911>

Reviewed by Yusuke Suzuki.

JSTests:

* wasm/stress/too-many-locals.js: Added.
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.catch):

Source/JavaScriptCore:

Currently, Wasm::FunctionParser is allowing

    maxFunctionParams + maxFunctionLocals * maxFunctionLocals

... locals, which is 0x9502FCE8.  It should be enforcing max locals of
maxFunctionLocals instead.

* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parse):

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

2 days agoSVG element should become focusable when focus and key event listeners are added
rniwa@webkit.org [Thu, 22 Aug 2019 00:34:48 +0000 (00:34 +0000)]
SVG element should become focusable when focus and key event listeners are added
https://bugs.webkit.org/show_bug.cgi?id=200997

Reviewed by Said Abou-Hallawa.

Source/WebCore:

This patch removes the odd behavior WebKit (and Blink) browsers had to make SVG elements
with key or focus event listeners focusable. New behavior matches the behavior of Firefox
as well as the SVG 2.0 specification: https://www.w3.org/TR/SVG2/interact.html#Focus

Test: svg/custom/tabindex-order.html

* svg/SVGAElement.cpp:
(WebCore::SVGAElement::supportsFocus const):
* svg/SVGElement.cpp:
(WebCore::SVGElement::hasFocusEventListeners const): Deleted.
(WebCore::SVGElement::isMouseFocusable const): Deleted.
* svg/SVGElement.h:
* svg/SVGGraphicsElement.h:

LayoutTests:

Updated existing tests to set tabIndex where appropriate, and added SVG elements
without tabindex content attribute to tabindex-order.html so that the test would
skip those elements when sequentially focus navigating across them.

* svg/custom/add-event-listener-shadow-tree-element.html:
* svg/custom/resources/focus-event-handling-keyboard.js:
* svg/custom/resources/focus-event-handling.js:
* svg/custom/tabindex-order-expected.txt:
* svg/custom/tabindex-order.html: Added test cases without tabindex.

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

2 days agoUnreviewed, rolling out r248970.
ryanhaddad@apple.com [Thu, 22 Aug 2019 00:23:15 +0000 (00:23 +0000)]
Unreviewed, rolling out r248970.

Caused
lldb_webkit_unittest.TestSummaryProviders.serial_test_WTFOptionSetProvider_empty
to fail.

Reverted changeset:

"[lldb-webkit] OptionSet summary shows size 0 sometimes for
non-empty set"
https://bugs.webkit.org/show_bug.cgi?id=200742
https://trac.webkit.org/changeset/248970

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

2 days agoresults.webkit.org: Add database table to save zip archives to
jbedard@apple.com [Thu, 22 Aug 2019 00:21:50 +0000 (00:21 +0000)]
results.webkit.org: Add database table to save zip archives to
https://bugs.webkit.org/show_bug.cgi?id=200718

Rubber-stamped by Aakash Jain.

* resultsdbpy/resultsdbpy/model/archive_context.py: Added.
(ArchiveContext):
(ArchiveContext.ArchivesByCommit): Store archives to be retrieved by commit and configuration.
(ArchiveContext.ArchivesByCommit.unpack):
(ArchiveContext.assert_zipfile):
(ArchiveContext.open_zipfile):
(ArchiveContext.__init__):
(ArchiveContext.__enter__):
(ArchiveContext.__exit__):
(ArchiveContext.register): Save the provided archive to Cassandra.
(ArchiveContext.find_archive): Find all archives matching the specified criteria.
(ArchiveContext._files_for_archive):
(ArchiveContext.ls): List all files in the matching archives.
(ArchiveContext.file): Extract a file from the matching archives.
* resultsdbpy/resultsdbpy/model/archive_context_unittest.py: Added.
(ArchiveContextTest):
* resultsdbpy/resultsdbpy/model/mock_model_factory.py:
(MockModelFactory):
(MockModelFactory.process_results):
(MockModelFactory.add_mock_archives):
* resultsdbpy/resultsdbpy/model/model.py:
(Model.__init__): Add an ArchiveContext to the model.

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

2 days agoAdopt AVSystemController_ActiveAudioRouteDidChangeNotification
jer.noble@apple.com [Thu, 22 Aug 2019 00:11:28 +0000 (00:11 +0000)]
Adopt AVSystemController_ActiveAudioRouteDidChangeNotification
https://bugs.webkit.org/show_bug.cgi?id=200992
<rdar://problem/54408993>

Reviewed by Eric Carlson.

Follow-up to r248962: When the active audio route changes, and the
system instructs us to pause, only pause the currently audible sessions.

* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::activeAudioRouteDidChange):
(-[WebMediaSessionHelper activeAudioRouteDidChange:]):
(WebCore::MediaSessionManageriOS::activeRouteDidChange): Deleted.

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

2 days agoDo not adjust viewport if editing selection is already visible
megan_gardner@apple.com [Thu, 22 Aug 2019 00:06:38 +0000 (00:06 +0000)]
Do not adjust viewport if editing selection is already visible
https://bugs.webkit.org/show_bug.cgi?id=200907
<rdar://problem/53903417>

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/scrolling/ios/autoscroll-input-when-very-zoomed.html

Currently due to scrolling being mostly handled by integers, we are getting
issues with rounding errors when trying to adjust the viewport while
editing text when we are significantly zoomed in. The real fix would be to
start dealing with scrolling with floats/doubles, but until such time,
we should early out of adjusting selections that we are certain are currently
visible.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):

LayoutTests:

* fast/scrolling/ios/autoscroll-input-when-very-zoomed-expected.txt: Added.
* fast/scrolling/ios/autoscroll-input-when-very-zoomed.html: Added.
* resources/ui-helper.js:
(window.UIHelper.immediateZoomToScale):

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

2 days ago[ews-build] view layout test results option should be displayed next to layout-test...
aakash_jain@apple.com [Wed, 21 Aug 2019 23:56:24 +0000 (23:56 +0000)]
[ews-build] view layout test results option should be displayed next to layout-test build step
https://bugs.webkit.org/show_bug.cgi?id=200048

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/steps.py:
(ExtractTestResults.getLastBuildStepByName): Method to return the last build-step matching the step name.
(ExtractTestResults.addCustomURLs): Add urls to corresponding layout-test step.

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

2 days ago[ews] Fix capitalization in Found x new Test failure message
aakash_jain@apple.com [Wed, 21 Aug 2019 23:51:34 +0000 (23:51 +0000)]
[ews] Fix capitalization in Found x new Test failure message
https://bugs.webkit.org/show_bug.cgi?id=201004

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/ews-build/steps.py:
(AnalyzeLayoutTestsResults.report_failure):
(AnalyzeAPITestsResults.analyzeResults):
* BuildSlaveSupport/ews-build/steps_unittest.py: Updated unit-tests accordingly.

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

2 days ago[Mail] Tapping top of message scrolls back to copied text instead of top of the message
timothy_horton@apple.com [Wed, 21 Aug 2019 23:05:26 +0000 (23:05 +0000)]
[Mail] Tapping top of message scrolls back to copied text instead of top of the message
https://bugs.webkit.org/show_bug.cgi?id=200999
<rdar://problem/54564878>

Reviewed by Wenson Hsieh.

Source/WebCore:

Test: editing/selection/ios/change-selection-by-tapping-with-existing-selection.html

* page/EditorClient.h:
(WebCore::EditorClient::shouldAllowSingleClickToChangeSelection const):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):
Instead of encoding platform behaviors in EventHandler, defer to EditorClient.

Source/WebKit:

In the case where you have a WebCore selection but are not first responder,
when you tap the WKWebView to become first responder, EventHandler would
bail from setting the selection, assuming UIKit was going to do it. This
behavior was introduced in r233311.

However, since we are not first responder, UIKit does not change the
selection, since it considers the view to not be editable.

Fix this by letting WebCore set the selection in this case, as it used to.

* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebCoreSupport/ios/WebEditorClientIOS.mm:
(WebKit::WebEditorClient::shouldAllowSingleClickToChangeSelection const):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::isShowingInputViewForFocusedElement const):
Copy the logic from EventHandler, with the added caveat (which fixes the
aforementioned behavior) that we will allow EventHandler to change the
selection if we don't have a focused node in the UIKit sense, because
we know that the platform text interaction code will *not* change the
selection if that is the case, so it's up to us.

Source/WebKitLegacy/mac:

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::shouldAllowSingleClickToChangeSelection const):
Copy the existing behavior from EventHandler.
We do not fix the bug in WebKitLegacy for a multitude of reasons, primarily
because we do not know of any user impact.

LayoutTests:

* editing/selection/ios/change-selection-by-tapping-with-existing-selection-expected.txt: Added.
* editing/selection/ios/change-selection-by-tapping-with-existing-selection.html: Added.

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

2 days agoCrash under NetworkCache::Data::mapToFile()
cdumez@apple.com [Wed, 21 Aug 2019 23:01:41 +0000 (23:01 +0000)]
Crash under NetworkCache::Data::mapToFile()
https://bugs.webkit.org/show_bug.cgi?id=200996
<rdar://problem/54570421>

Reviewed by Geoffrey Garen.

Make sure NetworkCache::Data::mapToFile() calls makeSafeToUseMemoryMapForPath() between
creating the file and calling mmap().

* NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
(WebKit::NetworkCache::BlobStorage::add):
* NetworkProcess/cache/NetworkCacheData.cpp:
(WebKit::NetworkCache::Data::mapToFile const):

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

2 days agoAssign ews117 to EWS High-Sierra Debug queues
aakash_jain@apple.com [Wed, 21 Aug 2019 22:48:36 +0000 (22:48 +0000)]
Assign ews117 to EWS High-Sierra Debug queues
https://bugs.webkit.org/show_bug.cgi?id=200993

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/config.json:

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

2 days agoCrash under StringImpl::endsWith() in SQLiteIDBBackingStore::fullDatabaseDirectoryWit...
cdumez@apple.com [Wed, 21 Aug 2019 22:45:46 +0000 (22:45 +0000)]
Crash under StringImpl::endsWith() in SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade()
https://bugs.webkit.org/show_bug.cgi?id=200990
<rdar://problem/54566439>

Reviewed by Alex Christensen.

Make sure we call isolatedCopy() on SQLiteIDBBackingStore::m_databaseRootDirectory before using
it from background threads.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::fullDatabaseDirectoryWithUpgrade):
(WebCore::IDBServer::SQLiteIDBBackingStore::databasesSizeForOrigin const):
(WebCore::IDBServer::SQLiteIDBBackingStore::deleteBackingStore):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
(WebCore::IDBServer::SQLiteIDBBackingStore::databaseRootDirectory const):

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

2 days ago[lldb-webkit] OptionSet summary shows size 0 sometimes for non-empty set
dbates@webkit.org [Wed, 21 Aug 2019 22:42:48 +0000 (22:42 +0000)]
[lldb-webkit] OptionSet summary shows size 0 sometimes for non-empty set
https://bugs.webkit.org/show_bug.cgi?id=200742

Reviewed by Simon Fraser.

The OptionSet synthetic provider must respond to requests for the value of m_storage
(i.e. GetChildMemberWithName('m_storage')) to avoid interfering with the computation
of the type summary.

Synthetic providers substitute alternative debug information (children) for the default
information for a variable. The OptionSet type summary is implemented in terms of the
OptionSet synthetic provider to maximize code reuse. If LLDB instantiates the provider
before invoking the type summary handler then evaluating GetChildMemberWithName() on
the SBValue passed to the type summary handler will access the substitute information
instead of the original debug information. As a result OptionSet's synthetic provider's
get_child_index('m_storage') returns None hence SBValue.GetChildMemberWithName('m_storage')
returned an invalid value; => WTFOptionSetProvider._bitmask() returns 0; => the size
reported in the type summary for the OptionSet is 0. Instead get_child_index('m_storage')
should return a valid value.

* lldb/lldb_webkit.py:
(FlagEnumerationProvider.__init__):
(FlagEnumerationProvider):
(FlagEnumerationProvider._get_child_index): Added. WTFOptionSetProvider will override.
(FlagEnumerationProvider._get_child_at_index): Added. WTFOptionSetProvider will override.
(FlagEnumerationProvider.size): Added.
(FlagEnumerationProvider.get_child_index): Modified to call _get_child_index().
(FlagEnumerationProvider.get_child_at_index): Modified to call _get_child_at_index().
(FlagEnumerationProvider.update): Moved initialization of self._elements to the constructor
and removed self.size. For the latter we can just expose a getter that returns the size of
the list self._elements.
(WTFOptionSetProvider._get_child_index): Added. Return the index for LLDB to query for the
value of m_storage.
(WTFOptionSetProvider):
(WTFOptionSetProvider._get_child_at_index): Added. Return the value for m_storage if it
matches the specified index.

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

2 days agoCrash under StringImpl::~StringImpl() in IDBServer::computeSpaceUsedForOrigin()
cdumez@apple.com [Wed, 21 Aug 2019 22:32:23 +0000 (22:32 +0000)]
Crash under StringImpl::~StringImpl() in IDBServer::computeSpaceUsedForOrigin()
https://bugs.webkit.org/show_bug.cgi?id=200989
<rdar://problem/54565546>

Reviewed by Alex Christensen.

Make sure we call isolatedCopy() on IDBServer::m_databaseDirectoryPath before using it from
background threads.

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::createBackingStore):
(WebCore::IDBServer::IDBServer::performGetAllDatabaseNames):
(WebCore::IDBServer::IDBServer::removeDatabasesModifiedSinceForVersion):
(WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
(WebCore::IDBServer::IDBServer::removeDatabasesWithOriginsForVersion):
(WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
(WebCore::IDBServer::IDBServer::computeSpaceUsedForOrigin):
(WebCore::IDBServer::IDBServer::upgradeFilesIfNecessary):
* Modules/indexeddb/server/IDBServer.h:
(WebCore::IDBServer::IDBServer::databaseDirectoryPath const):

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

2 days agoCrash under StringImpl::endsWith() in RegistrationDatabase::openSQLiteDatabase()
cdumez@apple.com [Wed, 21 Aug 2019 22:17:49 +0000 (22:17 +0000)]
Crash under StringImpl::endsWith() in RegistrationDatabase::openSQLiteDatabase()
https://bugs.webkit.org/show_bug.cgi?id=200991
<rdar://problem/54566689>

Reviewed by Geoffrey Garen.

Make sure we call isolatedCopy() on RegistrationDatabase::m_databaseDirectory before using
it from background threads.

* workers/service/server/RegistrationDatabase.cpp:
(WebCore::RegistrationDatabase::openSQLiteDatabase):
(WebCore::RegistrationDatabase::clearAll):
* workers/service/server/RegistrationDatabase.h:
(WebCore::RegistrationDatabase::databaseDirectory const):

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

2 days agoDisabling text autosizing should prevent text autosizing
achristensen@apple.com [Wed, 21 Aug 2019 22:03:02 +0000 (22:03 +0000)]
Disabling text autosizing should prevent text autosizing
https://bugs.webkit.org/show_bug.cgi?id=200955
<rdar://problem/48095374>

Reviewed by Simon Fraser.

Source/WebCore:

Before this change there was no way to reliably change the text size on iOS when a -webkit-text-size-adjust:none style was applied
because it would ignore the WKPreferences value for _textAutosizingEnabled.  Now that value has the desired effect when laying out.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::checkForTextSizeAdjust):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/TextSize.mm: Added.
(TEST):

LayoutTests:

* fast/text-autosizing/ios/text-size-adjust-inline-style.html:
The comment was incorrect because we call WKPreferencesSetTextAutosizingEnabled(preferences, false) in TestController::platformResetPreferencesToConsistentValues.
In order to test the effect of text autosizing in this test, we need to explicitly turn it on.  The disabling of text autosizing didn't do anything before this
patch, so it wasn't needed before now.

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

2 days ago[GTK][WPE] Make debug-test-runner work
aperez@igalia.com [Wed, 21 Aug 2019 21:49:00 +0000 (21:49 +0000)]
[GTK][WPE] Make debug-test-runner work
https://bugs.webkit.org/show_bug.cgi?id=193576

Reviewed by Michael Catanzaro.

* Scripts/webkitdirs.pm:
(wrapperPrefixIfNeeded): Only add the wrapper prefix when not running inside a Flatpak sandbox.
(setupUnixWebKitEnvironment): Added, sets TEST_RUNNER_INJECTED_BUNDLE_FILENAME and
TEST_RUNNER_TEST_PLUGIN_PATH in the environment.
(execUnixAppForDebugging): Added.
(debugWebKitTestRunner): Alternatively, use execUnixAppForDebugging() for the WPE and GTK+ ports.

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