WebKit-https.git
4 months agoUnreviewed, rolling out r245890, 245887.
ryanhaddad@apple.com [Fri, 31 May 2019 03:14:35 +0000 (03:14 +0000)]
Unreviewed, rolling out r245890, 245887.

Breaks internal builds.

Reverted changeset:
"Video playback in Safari should continue when CarPlay is plugged in"
https://bugs.webkit.org/show_bug.cgi?id=198345
https://trac.webkit.org/changeset/245887/webkit# Please enter the commit message for your changes. Lines starting

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

4 months agoWKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
sihui_liu@apple.com [Fri, 31 May 2019 02:19:12 +0000 (02:19 +0000)]
WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
https://bugs.webkit.org/show_bug.cgi?id=198317
Source/WebKit:

<rdar://problem/51244662>

Reviewed by Alex Christensen.

Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or
websiteDataStore.

* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::StorageArea::isEphemeral const):
(WebKit::StorageManager::StorageArea::removeListener):
(WebKit::StorageManager::StorageArea::setItems):
(WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const):
(WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace):
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
(WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const):
(WebKit::StorageManager::LocalStorageNamespace::cloneTo):
(WebKit::StorageManager::StorageManager):
(WebKit::StorageManager::cloneSessionStorageNamespace):
(WebKit::StorageManager::getLocalStorageOrigins):
(WebKit::StorageManager::getLocalStorageOriginDetails):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
(WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
(WebKit::StorageManager::createLocalStorageMap):
(WebKit::StorageManager::createTransientLocalStorageMap):
(WebKit::StorageManager::createSessionStorageMap):
(WebKit::StorageManager::destroyStorageMap):
(WebKit::StorageManager::getValues):
(WebKit::StorageManager::setItem):
(WebKit::StorageManager::removeItem):
(WebKit::StorageManager::clear):
(WebKit::StorageManager::suspend):
(WebKit::StorageManager::resume):
(WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted.
* NetworkProcess/WebStorage/StorageManager.h:
(): Deleted.
* WebProcess/WebStorage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::dispatchStorageEvent):
(WebKit::StorageAreaMap::dispatchSessionStorageEvent):
(WebKit::StorageAreaMap::connect):
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
(WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
* WebProcess/WebStorage/StorageNamespaceImpl.h:
* WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
(WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):

Tools:

Reviewed by Alex Christensen.

* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):

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

4 months agoMedia documents on iPad are too wide in split screen
dino@apple.com [Fri, 31 May 2019 02:03:59 +0000 (02:03 +0000)]
Media documents on iPad are too wide in split screen
https://bugs.webkit.org/show_bug.cgi?id=198405
<rdar://problem/50974548>

Reviewed by Tim Horton.

Source/WebCore:

Media documents on iPad had a minimum width of 700px. This
was fine in full-screen, but didn't work when then window
was smaller, such as split screen or a link preview.

Tests: media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html
       media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html

* Modules/modern-media-controls/controls/media-document.css: Add a media query to
detect small windows.
* Modules/modern-media-controls/media/media-document-controller.js:

LayoutTests:

Make old test iPhone-specific. Add an iPad-specific test.
And mark all the expectations correctly.

* media/modern-media-controls/media-documents/media-document-video-ipad-sizing-expected.txt: Copied from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt.
* media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html: Copied from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html.
* media/modern-media-controls/media-documents/media-document-video-iphone-sizing-expected.txt: Renamed from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt.
* media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html: Renamed from LayoutTests/media/modern-media-controls/media-documents/media-document-video-ios-sizing.html.
* platform/ios/TestExpectations:
* platform/ipad/TestExpectations:
* platform/mac/TestExpectations:

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

4 months ago[CMake] Add WEBKIT_FRAMEWORK_TARGET macro
don.olmstead@sony.com [Fri, 31 May 2019 00:46:38 +0000 (00:46 +0000)]
[CMake] Add WEBKIT_FRAMEWORK_TARGET macro
https://bugs.webkit.org/show_bug.cgi?id=198396

Reviewed by Konstantin Tokarev.

.:

Add a macro to help create the WebKit::targets in CMake.

* CMakeLists.txt:
* Source/cmake/WebKitMacros.cmake:

Source/bmalloc:

Use WEBKIT_FRAMEWORK_TARGET.

* CMakeLists.txt:

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

4 months agoWeb Inspector: Audit: there should be a default test for WebInspectorAudit.Resources...
drousso@apple.com [Fri, 31 May 2019 00:12:03 +0000 (00:12 +0000)]
Web Inspector: Audit: there should be a default test for WebInspectorAudit.Resources functionality
https://bugs.webkit.org/show_bug.cgi?id=196710
<rdar://problem/49712348>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Audit.json:
Increment Audit version.

Source/WebInspectorUI:

Previously, there was no way to return data from Audit that wasn't a DOM node, a DOM
attribute (which wasn't "shown" anywhere, as it would highlight that attribute on any
returned DOM nodes), or an error string.

In order for Audits to be more flexible with the types of things they test, there needs to
be a way for other types of data to be sent back and displayed in the Audit tab.

This patch makes it so that an Audit result can now contain other keys/values that are all
expected to be JSON serializable. It will take all of the non-"special" (e.g. "domNodes" or
"errors") keys/values and display them as object trees. This way, any JSON serializable data
can be sent with the result and be displayed in the Audit tab.

* UserInterface/Models/AuditTestBase.js:
(WI.AuditTestBase.prototype.async setup):
(WI.AuditTestBase.prototype.clearResult):
* UserInterface/Models/AuditTestGroup.js:
(WI.AuditTestCase.prototype.clearResult):
(WI.AuditTestCase.prototype._updateResult):
* UserInterface/Models/AuditTestCase.js:
(WI.AuditTestCase.prototype.async run):
(WI.AuditTestCase.prototype.async run.async parseResponse):
(WI.AuditTestCase.prototype.async run.async parseResponse.checkResultProperty):
(WI.AuditTestCase.prototype.async run.async parseResponse.checkResultProperty.addErrorForValueType):
(WI.AuditTestCase.prototype.async run.async parseResponse.async resultArrayForEach):
(WI.AuditTestCase.prototype.async run.async parseResponse.inspectedPage_stringify): Added.
Rename `ResultCleared` to `ResultChanged` so that it can (semantically) be used whenever a
new result is set in addition to when an existing one is cleared. This is needed so that
`AuditTestCaseContentView` will refresh each time the result changes, instead of only in the
first `layout()` after the last result was cleared.

* UserInterface/Models/AuditTestCaseResult.js:
(WI.AuditTestCaseResult.async fromPayload):
(WI.AuditTestCaseResult.prototype.toJSON):
Drive-by: fix the check for optional `data` values to still warn if the value is `null`.
* UserInterface/Controllers/AuditManager.js:
(WI.AuditManager.prototype._addDefaultTests):
Add a default test "Demo Audit > Result Data > data-custom" as an example how to write an
Audit that returns custom data, as well as how that custom data is shown in the Audit tab.

* UserInterface/Views/AuditTestContentView.js:
(WI.AuditTestContentView.prototype.shown):
(WI.AuditTestContentView.prototype.handleResultChanged): Added.
* UserInterface/Views/AuditTestCaseContentView.js:
(WI.AuditTestCaseContentView):
(WI.AuditTestCaseContentView.prototype.layout):
(WI.AuditTestCaseContentView.prototype.handleResultChanged): Added.
Preserve the UI for each section across `layout()`s, so that expand/collapse states aren't
reset each time the user changes the selected Audit.

* UserInterface/Views/AuditTestCaseContentView.css:
(.content-view.audit-test-case > section table > tr > td + td): Added.
Drive-by: ensure that the "index" table column is never larger than it needs to be.
* UserInterface/Views/AuditTreeElement.js:
(WI.AuditTreeElement.prototype.onattach):
(WI.AuditTreeElement.prototype._handleTestResultChanged): Added.
(WI.AuditTreeElement.prototype._handleTestResultCleared): Deleted.

* Localizations/en.lproj/localizedStrings.js:

LayoutTests:

* inspector/audit/manager-start-setup.html:
* inspector/audit/manager-start-setup-expected.txt:
* inspector/model/auditTestCase-expected.txt:
* inspector/model/auditTestCaseResult-expected.txt:
* inspector/model/auditTestGroup-expected.txt:
* inspector/unit-tests/object-utilities.html:
* inspector/unit-tests/object-utilities-expected.txt:

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

4 months agoREGRESSION (r245873) [Mac WK2] Layout Test http/wpt/service-workers/update-service...
youenn@apple.com [Fri, 31 May 2019 00:08:04 +0000 (00:08 +0000)]
REGRESSION (r245873) [Mac WK2] Layout Test http/wpt/service-workers/update-service-worker.https.html is a flaky crash after running new test
https://bugs.webkit.org/show_bug.cgi?id=198379
<rdar://problem/51264361>

Reviewed by Alex Christensen.

This case can happen when network process is crashing.
Given the WebSWClientConnection may be kept alive, it might reregister itself but in that case will never be unregistered.
Remove the WebSWClientConnection from the NetworkProcessConnection corresponding map on destruction time.
Covered by no longer crashing tests.

* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::removeSWClientConnection):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::~WebSWClientConnection):

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

4 months agoInserting a newline in contenteditable causes two characters to be added instead...
commit-queue@webkit.org [Fri, 31 May 2019 00:02:59 +0000 (00:02 +0000)]
Inserting a newline in contenteditable causes two characters to be added instead of one
https://bugs.webkit.org/show_bug.cgi?id=197894
<rdar://problem/49700998>

Patch by Andres Gonzalez <andresg_22@apple.com> on 2019-05-30
Reviewed by Wenson Hsieh and Chris Fleizach.

Source/WebCore:

There were two issues with inserting a newline character at the end of
a line that caused problems for accessibility:
- the first '\n' inserted after text would result in two line breaks
inserted instead of one. createFragmentFromText in markup.cpp was
splitting the string "\n" into two empty strings and creating a <div>
and a <br> respectively. Then the emission code would emit a '\n' for
the empty div and another for the <br>.
- the second problem is a consequence of <rdar://problem/5192593> and
the workaround is the change in editing.cpp in the function
visiblePositionForIndexUsingCharacterIterator, similar to what is done
in VisibleUnits.cpp for nextBoundary.
The rest of the changes in this patch are accessibility changes to
execute the layout tests.

Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html
       accessibility/set-selected-text-range-after-newline.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::setSelectedTextRange):
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper stringForRange:]):
(-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
(-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
* editing/Editing.cpp:
(WebCore::visiblePositionForIndexUsingCharacterIterator):
* editing/markup.cpp:
(WebCore::createFragmentFromText):

Tools:

iOS implementation of several AccessibilityUIElement methods to execute
LayoutTests.

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::selectedTextRange):
(WTR::AccessibilityUIElement::setSelectedTextRange):
(WTR::AccessibilityUIElement::replaceTextInRange):

LayoutTests:

* accessibility/ios-simulator/set-selected-text-range-after-newline-expected.txt: Added.
* accessibility/ios-simulator/set-selected-text-range-after-newline.html: Added.
* accessibility/ios-simulator/text-marker-list-item-expected.txt:
* accessibility/set-selected-text-range-after-newline-expected.txt: Added.
* accessibility/set-selected-text-range-after-newline.html: Added.
* platform/win/TestExpectations:

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

4 months agoNetwork process crash when decoding SecItemResponseData
cdumez@apple.com [Fri, 31 May 2019 00:00:09 +0000 (00:00 +0000)]
Network process crash when decoding SecItemResponseData
https://bugs.webkit.org/show_bug.cgi?id=198388
<rdar://problem/50408046>

Reviewed by Alex Christensen.

* Shared/cf/ArgumentCodersCF.cpp:
(IPC::decode):
When decoding the elements inside a CFArrayRef, if decoding was successful but
the CFTypeRef element is still null then skip it instead of trying to append it
to the array. A CFArray container is not allowed to contain null.
Some of our decoders for CFTypeRef types may not initialize the element even if
the decode() function returns true. For example, the decoders for CFArrayRef and
CFDictionaryRef return true if the encoded container was null but do not create
a container.

* Shared/mac/SecItemResponseData.cpp:
(WebKit::SecItemResponseData::SecItemResponseData):
nit: The wrong parameter was being moved. This is more efficient.

(WebKit::SecItemResponseData::encode const):
nit: Drop unnecessary .get().

* UIProcess/mac/SecItemShimProxy.cpp:
(WebKit::SecItemShimProxy::secItemRequest):
nit: Use nullptr instead of 0.

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

4 months agoWeb Inspector: Audit: tests are unable to get the current Audit version
drousso@apple.com [Thu, 30 May 2019 23:15:09 +0000 (23:15 +0000)]
Web Inspector: Audit: tests are unable to get the current Audit version
https://bugs.webkit.org/show_bug.cgi?id=198270

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

Expose the Audit version number through the `WebInspectorObject` that's injected into tests
so that they can decide at runtime whether they're supported (e.g. the `unsupported` result).

* inspector/agents/InspectorAuditAgent.h:
* inspector/agents/InspectorAuditAgent.cpp:
(Inspector::InspectorAuditAgent::populateAuditObject):

LayoutTests:

* inspector/audit/run.html:
* inspector/audit/run-expected.txt:
* inspector/audit/version.html:

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

4 months agoIsoHeaps don't notice uncommitted VA becoming the first eligible.
keith_miller@apple.com [Thu, 30 May 2019 23:07:27 +0000 (23:07 +0000)]
IsoHeaps don't notice uncommitted VA becoming the first eligible.
https://bugs.webkit.org/show_bug.cgi?id=198301

Reviewed by Yusuke Suzuki.

Source/bmalloc:

IsoDirectory has a firstEligible member that is used as an
optimization to help find the first fit. However if the scavenger
decommitted a page before firstEligible then we wouldn't move
firstEligible. Thus, if no space is ever freed below firstEligible
we will never reused the decommitted memory (e.g. if the VA page
is decommitted). The fix is to make IsoDirectory::didDecommit move
the firstEligible page back if the decommitted page is smaller
than the current firstEligible. As such, this patch renames
firstEligible to firstEligibleOrDecommitted.

Also, this patch changes gigacageEnabledForProcess to check if the
process starts with Test rather than just test as TestWTF does.

Lastly, unbeknownst to me IsoHeaps are dependent on gigacage, so
by removing gigacage from arm64 I accidentally disabled
IsoHeaps...

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/IsoDirectory.h:
* bmalloc/IsoDirectoryInlines.h:
(bmalloc::passedNumPages>::takeFirstEligible):
(bmalloc::passedNumPages>::didBecome):
(bmalloc::passedNumPages>::didDecommit):
* bmalloc/IsoHeapImpl.h:
* bmalloc/IsoHeapImplInlines.h:
(bmalloc::IsoHeapImpl<Config>::takeFirstEligible):
(bmalloc::IsoHeapImpl<Config>::didBecomeEligibleOrDecommited):
(bmalloc::IsoHeapImpl<Config>::didCommit):
(bmalloc::IsoHeapImpl<Config>::didBecomeEligible): Deleted.
* bmalloc/IsoTLS.cpp:
(bmalloc::IsoTLS::determineMallocFallbackState):
* bmalloc/ProcessCheck.mm:
(bmalloc::gigacageEnabledForProcess):

Tools:

Move testbmalloc.cpp to TestWTF so it runs in automation.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/bmalloc/IsoHeap.cpp: Renamed from Source/bmalloc/test/testbmalloc.cpp.
(TEST):

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

4 months agoDragAndDropTests.DataTransferExposePlainTextWithFileURLAsFile API test is failing
wenson_hsieh@apple.com [Thu, 30 May 2019 23:06:34 +0000 (23:06 +0000)]
DragAndDropTests.DataTransferExposePlainTextWithFileURLAsFile API test is failing
https://bugs.webkit.org/show_bug.cgi?id=198389
<rdar://problem/51266096>

Reviewed by Tim Horton.

This test started failing, since the fallback name for a dropped text file changed from "text.txt" to
"Document.txt" on newer iOS SDK versions. We simply fix this test by checking that the name of the file ends
with ".txt", and that the MIME type of the file is "text/plain".

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

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

4 months ago[JSC] Implement op_wide16 / op_wide32 and introduce 16bit version bytecode
ysuzuki@apple.com [Thu, 30 May 2019 21:40:35 +0000 (21:40 +0000)]
[JSC] Implement op_wide16 / op_wide32 and introduce 16bit version bytecode
https://bugs.webkit.org/show_bug.cgi?id=197979

Reviewed by Filip Pizlo.

JSTests:

* stress/16bit-code.js: Added.
(shouldBe):
* stress/32bit-code.js: Added.
(shouldBe):

Source/JavaScriptCore:

This patch introduces 16bit bytecode size. Previously, we had two versions of bytecodes, 8bit and 32bit. However,
in Gmail, we found that a lot of bytecodes get 32bit because they do not fit in 8bit. 8bit is very small and large
function easily emits a lot of 32bit bytecodes because of large VirtualRegister number etc. But they almost always
fit in 16bit. If we can have 16bit version of bytecode, we can make most of the current 32bit bytecodes 16bit and
save memory.

We rename rename op_wide to op_wide32 and introduce op_wide16. The mechanism is similar to old op_wide. When we
get op_wide16, the following bytecode data is 16bit, and we execute 16bit version of bytecode in LLInt.

We also disable this op_wide16 feature in Windows CLoop, which is used in AppleWin port. When the code size of
CLoop::execute increases, MSVC starts generating CLoop::execute function with very large stack allocation
requirement. Even before introducing this 16bit bytecode, CLoop::execute in AppleWin takes almost 100KB stack
height. After introducing this, it becomes 160KB. While the semantics of the function is correctly compiled,
such a large stack allocation is not essentially necessary, and this leads to stack overflow errors quite easily,
and tests fail with AppleWin port because it starts throwing stack overflow range error in various places.
In this patch, for now, we just disable op_wide16 feature for AppleWin so that CLoop::execute takes 100KB
stack allocation because this patch is not focusing on fixing AppleWin's CLoop issue. We introduce a new backend
type for LLInt, "C_LOOP_WIN". "C_LOOP_WIN" do not generate wide16 version of code to reduce the code size of
CLoop::execute. In the future, we should investigate whether this MSVC issue is fixed in Visual Studio 2019.
Or we should consider always enabling ASM LLInt for Windows.

This patch improves Gmail by 7MB at least.

* CMakeLists.txt:
* bytecode/BytecodeConventions.h:
* bytecode/BytecodeDumper.cpp:
(JSC::BytecodeDumper<Block>::dumpBlock):
* bytecode/BytecodeList.rb:
* bytecode/BytecodeRewriter.h:
(JSC::BytecodeRewriter::Fragment::align):
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::metadataTable const):
* bytecode/Fits.h:
* bytecode/Instruction.h:
(JSC::Instruction::opcodeID const):
(JSC::Instruction::isWide16 const):
(JSC::Instruction::isWide32 const):
(JSC::Instruction::hasMetadata const):
(JSC::Instruction::sizeShiftAmount const):
(JSC::Instruction::size const):
(JSC::Instruction::wide16 const):
(JSC::Instruction::wide32 const):
(JSC::Instruction::isWide const): Deleted.
(JSC::Instruction::wide const): Deleted.
* bytecode/InstructionStream.h:
(JSC::InstructionStreamWriter::write):
* bytecode/Opcode.h:
* bytecode/OpcodeSize.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::alignWideOpcode16):
(JSC::BytecodeGenerator::alignWideOpcode32):
(JSC::BytecodeGenerator::emitGetByVal): Previously, we always emit 32bit op_get_by_val for bytecodes in `for-in` context because
its operand can be replaced to the other VirtualRegister later. But if we know that replacing VirtualRegister can fit in 8bit / 16bit
a-priori, we should not emit 32bit version. We expose OpXXX::checkWithoutMetadataID to check whether we could potentially compact
the bytecode for the given operands.

(JSC::BytecodeGenerator::emitYieldPoint):
(JSC::StructureForInContext::finalize):
(JSC::BytecodeGenerator::alignWideOpcode): Deleted.
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::write):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* generator/Argument.rb:
* generator/DSL.rb:
* generator/Metadata.rb:
* generator/Opcode.rb: A little bit weird but checkImpl's argument must be reference. We are relying on that BoundLabel is once modified in
this check phase, and the modified BoundLabel will be used when emitting the code. If checkImpl copies the passed BoundLabel, this modification
will be discarded in this checkImpl function and make the code generation broken.

* generator/Section.rb:
* jit/JITExceptions.cpp:
(JSC::genericUnwind):
* llint/LLIntData.cpp:
(JSC::LLInt::initialize):
* llint/LLIntData.h:
(JSC::LLInt::opcodeMapWide16):
(JSC::LLInt::opcodeMapWide32):
(JSC::LLInt::getOpcodeWide16):
(JSC::LLInt::getOpcodeWide32):
(JSC::LLInt::getWide16CodePtr):
(JSC::LLInt::getWide32CodePtr):
(JSC::LLInt::opcodeMapWide): Deleted.
(JSC::LLInt::getOpcodeWide): Deleted.
(JSC::LLInt::getWideCodePtr): Deleted.
* llint/LLIntOfflineAsmConfig.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* llint/LLIntSlowPaths.h:
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter.cpp:
(JSC::CLoop::execute):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* offlineasm/arm.rb:
* offlineasm/arm64.rb:
* offlineasm/asm.rb:
* offlineasm/backends.rb:
* offlineasm/cloop.rb:
* offlineasm/instructions.rb:
* offlineasm/mips.rb:
* offlineasm/x86.rb: Load operation with sign extension should also have the extended size information. For example, loadbs should be
converted to loadbsi for 32bit sign extension (and loadbsq for 64bit sign extension). And use loadbsq / loadhsq for loading VirtualRegister
information in LowLevelInterpreter64 since they will be used for pointer arithmetic and they are using machine register width.

* parser/ResultType.h:
(JSC::OperandTypes::OperandTypes):
(JSC::OperandTypes::first const):
(JSC::OperandTypes::second const):
(JSC::OperandTypes::bits):
(JSC::OperandTypes::fromBits):
(): Deleted.
(JSC::OperandTypes::toInt): Deleted.
(JSC::OperandTypes::fromInt): Deleted.
We reduce sizeof(OperandTypes) from unsigned to uint16_t, which guarantees that OperandTypes always fit in 16bit bytecode.

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

4 months ago[Web GPU] Vertex Buffers/Input State API updates
justin_fan@apple.com [Thu, 30 May 2019 21:05:16 +0000 (21:05 +0000)]
[Web GPU] Vertex Buffers/Input State API updates
https://bugs.webkit.org/show_bug.cgi?id=194258
<rdar://problem/47806127>

Reviewed by Myles C. Maxfield.

Source/WebCore:

The vertex buffer attributes model for GPURenderPipelines in the WebGPU API has been updated.
Update our implementation to match.

No new tests. Existing tests updated to match new behavior.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl.
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/gpu/GPURenderPipelineDescriptor.h:
* platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
* platform/graphics/gpu/GPUVertexBufferDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h.
* platform/graphics/gpu/GPUVertexInputDescriptor.h:
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::trySetVertexInput): Added. Populate Metal and WHLSL pipeline descriptors with vertex attribute metadata.
(WebCore::trySetColorStates): Added. Populate Metal and WHLSL pipeline descriptors with color attachment metadata.
(WebCore::convertLayout): Moved.
(WebCore::trySetMetalFunctions): Moved.
(WebCore::trySetFunctions): Added. WHLSL compilation to Metal SL happens here, then MSL functions are set on pipeline descriptor.
(WebCore::convertRenderPipelineDescriptor): Repurposed. Convert a GPURenderPipelineDescriptor to Metal and WHLSL versions.
(WebCore::tryCreateMtlRenderPipelineState):
(WebCore::GPURenderPipeline::tryCreate):
(WebCore::trySetMetalFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetWHLSLFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetFunctionsForPipelineDescriptor): Deleted.
(WebCore::trySetInputStateForPipelineDescriptor): Deleted.
(WebCore::setColorStatesForColorAttachmentArray): Deleted.

LayoutTests:

Update WebGPU tests for the new vertex buffer attributes model.

* webgpu/blend-triangle-strip.html:
* webgpu/buffer-command-buffer-races.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/draw-indexed-triangles.html:
* webgpu/js/webgpu-functions.js:
* webgpu/texture-triangle-strip.html:
* webgpu/vertex-buffer-triangle-strip.html:
* webgpu/whlsl-arbitrary-vertex-attribute-locations.html:
* webgpu/whlsl-dereference-pointer-should-type-check.html:
* webgpu/whlsl-dont-crash-parsing-enum.html:
* webgpu/whlsl-dot-expressions.html:
* webgpu/whlsl-nested-dot-expression-rvalue.html:
* webgpu/whlsl.html:

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

4 months agoStop StorageManager when network process is ready to suspend
sihui_liu@apple.com [Thu, 30 May 2019 21:00:57 +0000 (21:00 +0000)]
Stop StorageManager when network process is ready to suspend
https://bugs.webkit.org/show_bug.cgi?id=198201
<rdar://problem/49683172>

Reviewed by Youenn Fablet.

Source/WebKit:

To avoid local storage database operations that can hold lock to database files, suspend thread of
StorageManager when network process is about to suspend.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::actualPrepareToSuspend):
(WebKit::NetworkProcess::resume):
* NetworkProcess/NetworkSession.cpp:
(WebKit::NetworkSession::~NetworkSession):
* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::suspend):
(WebKit::StorageManager::resume):
* NetworkProcess/WebStorage/StorageManager.h:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:
(TEST):
* TestWebKitAPI/Tests/WebKitCocoa/local-storage-process-suspends-1.html: Added.
* TestWebKitAPI/Tests/WebKitCocoa/local-storage-process-suspends-2.html: Added.

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

4 months agoMissing caret when focusing an editable field if the selection was set when WKWebView...
wenson_hsieh@apple.com [Thu, 30 May 2019 20:06:38 +0000 (20:06 +0000)]
Missing caret when focusing an editable field if the selection was set when WKWebView wasn't first responder
https://bugs.webkit.org/show_bug.cgi?id=198356
<rdar://problem/50798593>

Reviewed by Tim Horton.

Source/WebKit:

In this bug, the DOM selection is initially set by script in a web view that is not the first responder. Then,
either the user begins editing by tapping somewhere such that the selection does not change, or an editable
element is programmatically focused and the client allows programmatic focus to show the keyboard. This is
because the selection clipping rect used by the UI process when computing the bounds of the caret view is empty,
causing the entire caret to be clipped.

This is due to two related issues: first, no updated editor state is sent to the UI process after the element is
focused, if the selection has not also changed. This means that while the selection geometry is sent over to the
UI process, the selection clipping rect (a member of the EditorState's PostLayoutData called
"focusedElementRect") becomes stale in the UI process, since the there was no focused element when the
previously computed editor state was sent to the UI process. To fix this, we schedule a full editor state update
when an element is focused, to ensure that the selection is eventually updated in the UI process.

Secondly, even once the editor state update is sent to the UI process, we will actually avoid updating any text
selection views, since there is no change in WKSelectionDrawingInfo, which currently consists of a selection
type, and either a caret rect or a list of selection rects. However, since selection drawing is also affected by
the selection clipping rect, it seems reasonable to add the selection clipping rect to the drawing info, and
trigger a selection update if this selection clipping rect has changed.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):

Add selectionClippingRect to WKSelectionDrawingInfo, and check against it when comparing two drawing infos.

(WebKit::operator==):
(WebKit::operator<<):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::elementDidFocus):

Schedule an editor state update when focusing an element. In many cases, an editor state update has already been
scheduled when focusing an element, so this becomes a no-op; however, in this scenario, it delivers updated
selection clipping rects (i.e. the focused element rect) and other updated information to the UI process.

LayoutTests:

Add a new layout test to exercise this scenario.

* editing/selection/ios/caret-when-focusing-editable-element-with-selection-expected.txt: Added.
* editing/selection/ios/caret-when-focusing-editable-element-with-selection.html: Added.

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

4 months agoREGRESSION (r245756) [Mac] 2 TestWebKitAPI.DownloadProgress* and TestWebKitAPI._WKDow...
david_quesada@apple.com [Thu, 30 May 2019 19:52:57 +0000 (19:52 +0000)]
REGRESSION (r245756) [Mac] 2 TestWebKitAPI.DownloadProgress* and TestWebKitAPI._WKDownload.DownloadMonitorCancel are flaky timeouts
https://bugs.webkit.org/show_bug.cgi?id=198298
rdar://problem/51182393

Reviewed by Alexey Proskuryakov.

Source/WebKit:

When canceling a download, there has always been a race condition between:

 (A) the execution of Download::didCancel() within the block passed to
     -[NSURLSessionDownloadTask cancelByProducingResumeData:] within
     Download::platformCancelNetworkLoad(), and

 (B) the invocation of -[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]

If A happens before B, the block calls didCancel() on the download, which reports the
cancellation to the UI process and tears down the download. When B happens, WKNetworkSessionDelegate
gracefully handles the fact that the Download has been removed from the map, and nothing
else happens. Life is good.

If B happens before A, -URLSession:task:didCompleteWithError: invokes Download::didFail(),
which reports a download failure (*not* a cancellation) to the UI process and tears down
the Download and DownloadProxy. On release builds, this can leave the tests waiting for a
cancellation until they time out. When A happens, the block calls Download::didCancel().
This messages the UI process, which results in a debug assertion failure from an unhandled
message since the DownloadProxy was torn down when the failure was reported. Meanwhile,
the network process hits a debug assertion in DownloadManager::downloadFinished() when
trying to remove the Download *again*.

r245756 made the bad case (B before A) more likely by adding a delay before didCancel()
is called.

Make this race condition impossible by eliminating the didCancel() from the cancellation
block, and instead relying on -URLSession:task:didCompleteWithError: to report the
download as canceled. This also effectively coalesces calls to platformCancelNetworkLoad(),
which, if called multiple times before CFNetwork reports that the download was canceled,
could cause multiple calls to didCancel(), resulting in the same assertion failures seen
in the B-before-A case.

No new tests, as recreating this race condition in the test scenario would require
additional machinery, and is no longer even possible since we don't depend on the calling
of the cancellation handler in order to report the Download as canceled.

* NetworkProcess/Downloads/Download.cpp:
(WebKit::Download::cancel):
* NetworkProcess/Downloads/Download.h:
(WebKit::Download::wasCanceled const):
* NetworkProcess/Downloads/cocoa/DownloadCocoa.mm:
(WebKit::Download::platformCancelNetworkLoad):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didCompleteWithError:]):

Tools:

Re-enable _WKDownload.DownloadMonitorCancel, which should no longer time out with this fix.

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(TestWebKitAPI::TEST):

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

4 months ago[iOS] Do not linkify telephone numbers inside <a> elements.
zalan@apple.com [Thu, 30 May 2019 19:41:53 +0000 (19:41 +0000)]
[iOS] Do not linkify telephone numbers inside <a> elements.
https://bugs.webkit.org/show_bug.cgi?id=198378

Reviewed by Chris Dumez.

Source/WebCore:

Phone number linkifying mutates the DOM in a potentially unexpected way triggering different kinds of failures with JS, CSS selectors etc.
This patch tightens the linkifying rule so that content inside an <a> element won't get linkified even when the <a> has no valid href attribute.

Test: fast/dom/linkify-phone-numbers.html

* html/parser/HTMLTreeBuilder.cpp:
(WebCore::disallowTelephoneNumberParsing):

LayoutTests:

* fast/dom/linkify-phone-numbers-expected.html: Added.
* fast/dom/linkify-phone-numbers.html: Added.

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

4 months ago[iOS] UIProcess' background task expiration handler may get called after the app...
cdumez@apple.com [Thu, 30 May 2019 19:34:19 +0000 (19:34 +0000)]
[iOS] UIProcess' background task expiration handler may get called after the app is foreground again
https://bugs.webkit.org/show_bug.cgi?id=198380
<rdar://problem/49762471>

Reviewed by Geoffrey Garen.

UIProcess' background task expiration handler may get called after the app is foreground again. When
this happens, we already have a foreground assertion on behalf of the WebContent process, and the view
is visible. We would send the WillSuspendImminently IPC to the WebContent process, which would freeze
its layers, even though it is visible on screen.

To address the issue, we now check if the app is visible in the expiration handler. If it is visible,
we do not notify clients of imminent suspension. Instead, we end the background task right away and
call _updateBackgroundTask asynchronously to start a new background task if necessary.

* UIProcess/ios/ProcessAssertionIOS.mm:
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):

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

4 months agoFix yet more deprecated uses of -[UIApplication interfaceOrientation]
krollin@apple.com [Thu, 30 May 2019 19:02:40 +0000 (19:02 +0000)]
Fix yet more deprecated uses of -[UIApplication interfaceOrientation]
https://bugs.webkit.org/show_bug.cgi?id=198381
<rdar://problem/51265846>

Reviewed by Wenson Hsieh.

r245267, r245272, and r245874 fixed many instances of this issue; this
change fixes the issue for tvOS.

* wtf/FeatureDefines.h:

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

4 months agoUnreviewed, rolling out r245883.
tsavell@apple.com [Thu, 30 May 2019 18:43:36 +0000 (18:43 +0000)]
Unreviewed, rolling out r245883.

Caused 6 webgpu/ layout test failures.

Reverted changeset:

"[WHLSL] Parsing and lexing the standard library is slow"
https://bugs.webkit.org/show_bug.cgi?id=192890
https://trac.webkit.org/changeset/245883

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

4 months ago[iOS] Third-party extensions using WKWebView are unable to render anything
cdumez@apple.com [Thu, 30 May 2019 18:39:19 +0000 (18:39 +0000)]
[iOS] Third-party extensions using WKWebView are unable to render anything
https://bugs.webkit.org/show_bug.cgi?id=198359
<rdar://problem/51105015>

Reviewed by Brent Fulgham and Geoff Garen.

Third-party extensions using WKWebView are unable to render anything because we do not get notified
when the extension's visibility changes. Because we do not recognize the extension showing the
WebView to be foreground, we do not take a process assertion on behalf of the child processes and
they get suspended before they get a chance to render anything.

The root of the issue is that WebKit was relying on BKSApplicationStateMonitor.handler to get
notified when the extension's state switches between foreground and background. However, the handler
never gets called unless the extension has an appropriate entitlement.

To address the issue, we now use the same logic for extensions and we do for view services.
I have verified that the _UIViewServiceHostDidEnterBackgroundNotification / _UIViewServiceHostWillEnterForegroundNotification
notifications get sent to the extensions (even third-party). We also properly detect MobileSafari as
host application and are able to get MobileSafari's foreground state accurately.

* UIProcess/ApplicationStateTracker.mm:

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

4 months agooss-fuzz: jsc: Issue 15016: jsc: Abrt in JSC::Wasm::AirIRGenerator::addLocal (15016)
justin_michaud@apple.com [Thu, 30 May 2019 18:06:09 +0000 (18:06 +0000)]
oss-fuzz: jsc: Issue 15016: jsc: Abrt in JSC::Wasm::AirIRGenerator::addLocal (15016)
https://bugs.webkit.org/show_bug.cgi?id=198355

Reviewed by Saam Barati.

JSTests:

* wasm/references/is_null.js:

Source/JavaScriptCore:

Fix missing anyref case in addLocal.

* wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::addLocal):

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

4 months agoRare crash under `WebPage::shouldIgnoreMetaViewport const` when shrinking to fit...
wenson_hsieh@apple.com [Thu, 30 May 2019 18:05:18 +0000 (18:05 +0000)]
Rare crash under `WebPage::shouldIgnoreMetaViewport const` when shrinking to fit content
https://bugs.webkit.org/show_bug.cgi?id=198374
<rdar://problem/51261348>

Reviewed by Tim Horton.

This is a speculative fix for the crash; what appears to be happening is that the shrink-to-fit-content timer
is somehow being scheduled after the page has already been closed. We can probably fix this by bailing when
scheduling shrink-to-fit-content if m_isClosed is true.

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

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

4 months agoMove some HistoricalVelocityData code into the cpp file
simon.fraser@apple.com [Thu, 30 May 2019 17:02:19 +0000 (17:02 +0000)]
Move some HistoricalVelocityData code into the cpp file
https://bugs.webkit.org/show_bug.cgi?id=198353

Reviewed by Tim Horton.

Now that we have VelocityData.cpp put the non-trivial HistoricalVelocityData::velocityForNewData()
into it. append() can become a lambda function.

* platform/graphics/VelocityData.cpp:
(WebCore::HistoricalVelocityData::velocityForNewData):
* platform/graphics/VelocityData.h:
(WebCore::HistoricalVelocityData::velocityForNewData): Deleted.
(WebCore::HistoricalVelocityData::append): Deleted.

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

4 months agoUnreviewed, rolling out r245881.
tsavell@apple.com [Thu, 30 May 2019 16:58:54 +0000 (16:58 +0000)]
Unreviewed, rolling out r245881.

Broke 13 Layout tests on WK2

Reverted changeset:

"WKWebsiteDataStore API fails to fetch web storage data for
non-persistent data store"
https://bugs.webkit.org/show_bug.cgi?id=198317
https://trac.webkit.org/changeset/245881

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

4 months agoFix the iOS build after r245887
tsavell@apple.com [Thu, 30 May 2019 16:55:22 +0000 (16:55 +0000)]
Fix the iOS build after r245887
https://bugs.webkit.org/show_bug.cgi?id=198345

Unreviewed build fix.

* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):

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

4 months agoASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudi...
jer.noble@apple.com [Thu, 30 May 2019 16:49:29 +0000 (16:49 +0000)]
ASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudioDidChange()
https://bugs.webkit.org/show_bug.cgi?id=181597
<rdar://problem/36474088>

Reviewed by Eric Carlson.

Because document() is usually null-checked before using (and we can add null-checks where missing),
there's no good reason to debug-assert that m_scriptExecutionContext is non-null before downcast<>ing
to Document*.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon):
(WebCore::AudioContext::stop):
(WebCore::AudioContext::document const):
(WebCore::AudioContext::visibilityStateChanged):
(WebCore::AudioContext::willBeginPlayback):
(WebCore::AudioContext::willPausePlayback):
(WebCore::AudioContext::pageMutedStateDidChange):

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

4 months ago[PlayStation] Skip additional tests on PlayStation
stephan.szabo@sony.com [Thu, 30 May 2019 16:36:44 +0000 (16:36 +0000)]
[PlayStation] Skip additional tests on PlayStation
https://bugs.webkit.org/show_bug.cgi?id=198352

Reviewed by Don Olmstead.

Skip pow test on PlayStation due to behavior difference in standard library.
Skip incremental marking test due to OOM on PlayStation systems.

* stress/incremental-marking-should-not-dead-lock-in-new-property-transition.js:
* stress/math-pow-with-constants.js:
* stress/pow-with-constants.js:

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

4 months agoVideo playback in Safari should continue when CarPlay is plugged in
jer.noble@apple.com [Thu, 30 May 2019 16:29:38 +0000 (16:29 +0000)]
Video playback in Safari should continue when CarPlay is plugged in
https://bugs.webkit.org/show_bug.cgi?id=198345
<rdar://problem/45505750>

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/video-isplayingtoautomotiveheadunit.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
* platform/audio/PlatformMediaSessionManager.h:
(WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
(WebCore::MediaSessionManageriOS::carPlayServerDied):
(WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
(-[WebMediaSessionHelper initWithCallback:]):
(-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
(-[WebMediaSessionHelper interruption:]):
(-[WebMediaSessionHelper applicationWillEnterForeground:]):
(-[WebMediaSessionHelper applicationDidBecomeActive:]):
(-[WebMediaSessionHelper applicationWillResignActive:]):
(-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
(-[WebMediaSessionHelper applicationDidEnterBackground:]):
(-[WebMediaSessionHelper carPlayServerDied:]):
(-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* media/video-isplayingtoautomotiveheadunit-expected.txt: Added.
* media/video-isplayingtoautomotiveheadunit.html: Added.

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

4 months ago[ews-build] Update configuration to share bots across queues
aakash_jain@apple.com [Thu, 30 May 2019 16:17:05 +0000 (16:17 +0000)]
[ews-build] Update configuration to share bots across queues
https://bugs.webkit.org/show_bug.cgi?id=198370

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/config.json: Share bots across builder and API tester queues.
Also use ews119 instead of ews120 for mac API tests, as ews120 seems to have some issues as
noted in https://bugs.webkit.org/show_bug.cgi?id=197571#c1

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

4 months agowebkitpy: Switch run-webkit-tests to tailspin (Follow-up fix)
jbedard@apple.com [Thu, 30 May 2019 16:05:21 +0000 (16:05 +0000)]
webkitpy: Switch run-webkit-tests to tailspin (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=198144
<rdar://problem/32463212>

Unreviewed infrastructure fix.

* Scripts/webkitpy/port/darwin.py:
(DarwinPort.look_for_new_samples): Use tailspin_file_path instead of spindump_file_path.

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

4 months agoUnreviewed, WPE without a11y support build fix.
philn@webkit.org [Thu, 30 May 2019 14:52:00 +0000 (14:52 +0000)]
Unreviewed, WPE without a11y support build fix.

* UIProcess/wpe/WebPageProxyWPE.cpp: Include atk headers only when enabled.

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

4 months ago[WHLSL] Parsing and lexing the standard library is slow
rmorisset@apple.com [Thu, 30 May 2019 03:41:13 +0000 (03:41 +0000)]
[WHLSL] Parsing and lexing the standard library is slow
https://bugs.webkit.org/show_bug.cgi?id=192890
<rdar://problem/50746335>

Reviewed by Myles Maxfield.

The main idea is to avoid backtracking by instead peeking at the next token (and occasionally at the one after that).
This implies a few things:
- We can replace the stack of tokens by a trivial ring buffer of size 2 (holding the next token and the one after, or WTF::nullopt if we are at the end of the file).
- We now have "completeFooExpression" functions, to avoid having to reparse the prefix of some expression, if we find half-way through what it is.

I also fixed the following parser bug:
- https://bugs.webkit.org/show_bug.cgi?id=198305 [WHLSL] Multiple variables with initializers in a declaration statement crashes the compiler
    which was due to a mistake I made in the grammar

Finally I added two new macros: CONSUME_TYPE and PARSE to eliminate about 500 lines of error propagation boilerplate.

There are still lots of ways of improving the parser and lexer, such as:
- finishing the conversion of tokens in the lexer, not bothering with allocating string views
- make two special tokens Invalid and EOF, to remove the overhead of Optional
- make peekTypes and consumeTypes use templates to avoid constructing a Vector and calling find on it.
- Turn the entire lexer into a proper automata, not going through the same characters again and again (this is certainly the largest win by far)
- Remove the last few pieces of backtracking from the parser.

The current patch is already enough to make parsing the full standard library (something like 85k lines) approximately 260ms.
This is still longer than I would like, but nowhere near the bottleneck any longer because of some other parts of the compiler.

* Modules/webgpu/WHLSL/WHLSLLexer.h:
(WebCore::WHLSL::Lexer::Lexer):
(WebCore::WHLSL::Lexer::consumeToken):
(WebCore::WHLSL::Lexer::peek):
(WebCore::WHLSL::Lexer::peekFurther):
(WebCore::WHLSL::Lexer::state const):
(WebCore::WHLSL::Lexer::setState):
(WebCore::WHLSL::Lexer::unconsumeToken): Deleted.
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Parser::parse):
(WebCore::WHLSL::Parser::peek):
(WebCore::WHLSL::Parser::peekTypes):
(WebCore::WHLSL::Parser::tryType):
(WebCore::WHLSL::Parser::tryTypes):
(WebCore::WHLSL::Parser::consumeTypes):
(WebCore::WHLSL::Parser::parseConstantExpression):
(WebCore::WHLSL::Parser::parseTypeArgument):
(WebCore::WHLSL::Parser::parseTypeArguments):
(WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
(WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
(WebCore::WHLSL::Parser::parseType):
(WebCore::WHLSL::Parser::parseTypeDefinition):
(WebCore::WHLSL::Parser::parseResourceSemantic):
(WebCore::WHLSL::Parser::parseSpecializationConstantSemantic):
(WebCore::WHLSL::Parser::parseStageInOutSemantic):
(WebCore::WHLSL::Parser::parseSemantic):
(WebCore::WHLSL::Parser::parseQualifiers):
(WebCore::WHLSL::Parser::parseStructureElement):
(WebCore::WHLSL::Parser::parseStructureDefinition):
(WebCore::WHLSL::Parser::parseEnumerationDefinition):
(WebCore::WHLSL::Parser::parseEnumerationMember):
(WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
(WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
(WebCore::WHLSL::Parser::parseAttributeBlock):
(WebCore::WHLSL::Parser::parseParameter):
(WebCore::WHLSL::Parser::parseParameters):
(WebCore::WHLSL::Parser::parseFunctionDefinition):
(WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
(WebCore::WHLSL::Parser::parseVertexFragmentFunctionDeclaration):
(WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
(WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
(WebCore::WHLSL::Parser::parseFunctionDeclaration):
(WebCore::WHLSL::Parser::parseNativeFunctionDeclaration):
(WebCore::WHLSL::Parser::parseBlock):
(WebCore::WHLSL::Parser::parseBlockBody):
(WebCore::WHLSL::Parser::parseIfStatement):
(WebCore::WHLSL::Parser::parseSwitchStatement):
(WebCore::WHLSL::Parser::parseSwitchCase):
(WebCore::WHLSL::Parser::parseForLoop):
(WebCore::WHLSL::Parser::parseWhileLoop):
(WebCore::WHLSL::Parser::parseDoWhileLoop):
(WebCore::WHLSL::Parser::parseVariableDeclaration):
(WebCore::WHLSL::Parser::parseVariableDeclarations):
(WebCore::WHLSL::Parser::parseStatement):
(WebCore::WHLSL::Parser::parseEffectfulExpression):
(WebCore::WHLSL::Parser::parseEffectfulAssignment):
(WebCore::WHLSL::Parser::parseExpression):
(WebCore::WHLSL::Parser::parseTernaryConditional):
(WebCore::WHLSL::Parser::completeTernaryConditional):
(WebCore::WHLSL::Parser::parseAssignment):
(WebCore::WHLSL::Parser::completeAssignment):
(WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
(WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
(WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
(WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
(WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
(WebCore::WHLSL::Parser::parsePossibleShift):
(WebCore::WHLSL::Parser::completePossibleShift):
(WebCore::WHLSL::Parser::parsePossibleAdd):
(WebCore::WHLSL::Parser::completePossibleAdd):
(WebCore::WHLSL::Parser::parsePossibleMultiply):
(WebCore::WHLSL::Parser::completePossibleMultiply):
(WebCore::WHLSL::Parser::parsePossiblePrefix):
(WebCore::WHLSL::Parser::parsePossibleSuffix):
(WebCore::WHLSL::Parser::parseCallExpression):
(WebCore::WHLSL::Parser::parseTerm):
(WebCore::WHLSL::Parser::parseAddressSpaceType): Deleted.
(WebCore::WHLSL::Parser::parseNonAddressSpaceType): Deleted.
(WebCore::WHLSL::Parser::parseEntryPointFunctionDeclaration): Deleted.
(WebCore::WHLSL::Parser::parseEffectfulPrefix): Deleted.
(WebCore::WHLSL::Parser::parseEffectfulSuffix): Deleted.
* Modules/webgpu/WHLSL/WHLSLParser.h:
(WebCore::WHLSL::Parser::Error::dump const):

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

4 months agoRemove some logic to suppress the text selection assistant during drop
wenson_hsieh@apple.com [Thu, 30 May 2019 02:41:10 +0000 (02:41 +0000)]
Remove some logic to suppress the text selection assistant during drop
https://bugs.webkit.org/show_bug.cgi?id=198354

Reviewed by Tim Horton.

Source/WebKit:

This logic was originally added to hide the ranged selection after performing a drop in editable content.
However, after r245803, we (1) no longer show the keyboard and/or text selection views when dropping, and (2)
the final selection is now a caret, so it's no longer necessary to suppress the selection assistant.

* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:performDrop:]):
(-[WKContentView dropInteraction:concludeDrop:]):

Tools:

Adjust some API tests that currently check whether or not the selection assistant was suppressed during drop.

* TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/DragAndDropSimulator.h:
* TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
(-[DragAndDropSimulator _resetSimulatedState]):
(-[DragAndDropSimulator _webView:dataInteractionOperationWasHandled:forSession:itemProviders:]):

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

4 months agoWKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
sihui_liu@apple.com [Thu, 30 May 2019 00:23:58 +0000 (00:23 +0000)]
WKWebsiteDataStore API fails to fetch web storage data for non-persistent data store
https://bugs.webkit.org/show_bug.cgi?id=198317

Reviewed by Alex Christensen.

Source/WebKit:

Use LocalStorageNameSpace instead of SessionStorageNameSpace for localStorage in ephemeral session or
websiteDataStore.

* NetworkProcess/WebStorage/StorageManager.cpp:
(WebKit::StorageManager::StorageArea::isEphemeral const):
(WebKit::StorageManager::StorageArea::removeListener):
(WebKit::StorageManager::StorageArea::setItems):
(WebKit::StorageManager::StorageArea::openDatabaseAndImportItemsIfNeeded const):
(WebKit::StorageManager::LocalStorageNamespace::~LocalStorageNamespace):
(WebKit::StorageManager::LocalStorageNamespace::getOrCreateStorageArea):
(WebKit::StorageManager::LocalStorageNamespace::clearAllStorageAreas):
(WebKit::StorageManager::LocalStorageNamespace::ephemeralOrigins const):
(WebKit::StorageManager::LocalStorageNamespace::cloneTo):
(WebKit::StorageManager::StorageManager):
(WebKit::StorageManager::cloneSessionStorageNamespace):
(WebKit::StorageManager::getLocalStorageOrigins):
(WebKit::StorageManager::getLocalStorageOriginDetails):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigin):
(WebKit::StorageManager::deleteLocalStorageOriginsModifiedSince):
(WebKit::StorageManager::deleteLocalStorageEntriesForOrigins):
(WebKit::StorageManager::createLocalStorageMap):
(WebKit::StorageManager::createTransientLocalStorageMap):
(WebKit::StorageManager::createSessionStorageMap):
(WebKit::StorageManager::destroyStorageMap):
(WebKit::StorageManager::getValues):
(WebKit::StorageManager::setItem):
(WebKit::StorageManager::removeItem):
(WebKit::StorageManager::clear):
(WebKit::StorageManager::StorageArea::isSessionStorage const): Deleted.
* NetworkProcess/WebStorage/StorageManager.h:
(): Deleted.
* WebProcess/WebStorage/StorageAreaMap.cpp:
(WebKit::StorageAreaMap::dispatchStorageEvent):
(WebKit::StorageAreaMap::dispatchSessionStorageEvent):
(WebKit::StorageAreaMap::connect):
* WebProcess/WebStorage/StorageNamespaceImpl.cpp:
(WebKit::StorageNamespaceImpl::createEphemeralLocalStorageNamespace):
(WebKit::StorageNamespaceImpl::createLocalStorageNamespace):
* WebProcess/WebStorage/StorageNamespaceImpl.h:
* WebProcess/WebStorage/WebStorageNamespaceProvider.cpp:
(WebKit::WebStorageNamespaceProvider::createLocalStorageNamespace):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm:
(TestWebKitAPI::TEST):

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

4 months agoBuild fix for branch.
achristensen@apple.com [Thu, 30 May 2019 00:14:48 +0000 (00:14 +0000)]
Build fix for branch.
<rdar://problem/50625279>

* TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:

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

4 months agoAttempt to fix JSC test timeouts after adding collectContinuously to WASM tests.
justin_michaud@apple.com [Wed, 29 May 2019 23:53:57 +0000 (23:53 +0000)]
Attempt to fix JSC test timeouts after adding collectContinuously to WASM tests.
https://bugs.webkit.org/show_bug.cgi?id=198322

Rubber-stamped by Michael Saboff. Disable running the new collectContinuously tests on debug builds.
This matches what we do for other jsc tests.

* Scripts/run-jsc-stress-tests:

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

4 months agoUnreviewed, update WebAuthN to "Supported In Preview"
jiewen_tan@apple.com [Wed, 29 May 2019 23:30:31 +0000 (23:30 +0000)]
Unreviewed, update WebAuthN to "Supported In Preview"

* features.json:

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

4 months agoREGRESSION (r244182) [Mac WK2] Layout Test imported/w3c/web-platform-tests/visual...
commit-queue@webkit.org [Wed, 29 May 2019 23:23:49 +0000 (23:23 +0000)]
REGRESSION (r244182) [Mac WK2] Layout Test imported/w3c/web-platform-tests/visual-viewport/viewport-resize-event-on-load-overflowing-page.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=197286

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-05-29
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

This is a time sensitive test. It expects to receive a resize event within
two frames after the page load. Scheduling the page update through the
RenderingUpdate made updating the page for the first time happens not
immediately after the page load but after an additional frame.

So we need to wait for this additional frame before checking whether the
'resize' event was fired.

* web-platform-tests/visual-viewport/viewport-resize-event-on-load-overflowing-page.html:

LayoutTests:

* platform/mac-wk2/TestExpectations:

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

4 months agoClean up a few #include statements in WTF
ddkilzer@apple.com [Wed, 29 May 2019 23:07:29 +0000 (23:07 +0000)]
Clean up a few #include statements in WTF
<https://webkit.org/b/198351>

Reviewed by Alex Christensen.

* benchmarks/HashSetDFGReplay.cpp:
- Add missing "config.h" include.
* wtf/ParallelJobsGeneric.cpp:
- Replace include of ParallelJobs.h with
  ParallelJobsGeneric.h.
* wtf/StackBounds.cpp:
- Fix include ordering of StackBounds.h.

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

4 months agoRemove ENABLE definitions from WebKit config files
don.olmstead@sony.com [Wed, 29 May 2019 23:05:55 +0000 (23:05 +0000)]
Remove ENABLE definitions from WebKit config files
https://bugs.webkit.org/show_bug.cgi?id=197858

Reviewed by Simon Fraser.

.:

Add ENABLE flags into WebKitFeatures.cmake and set the values for GTK and WPE according
to what was present in the config files.

* Source/cmake/OptionsGTK.cmake:
* Source/cmake/OptionsWPE.cmake:
* Source/cmake/WebKitFeatures.cmake:

Source/JavaScriptCore:

Sync FeatureDefines.xcconfig.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

Sync FeatureDefines.xcconfig.

* Configurations/FeatureDefines.xcconfig:

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

Remove ENABLE flags that were present in the config files. Add the ENABLE flags
to FeatureDefines.xcconfig instead.

* Configurations/FeatureDefines.xcconfig:
* WebKit2Prefix.h:
* config.h:

Source/WebKitLegacy/mac:

Sync FeatureDefines.xcconfig.

* Configurations/FeatureDefines.xcconfig:

Tools:

Sync FeatureDefines.xcconfig.

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

4 months agoFollowup to r245267 and r245272: fix even more deprecated uses of -[UIApplication...
krollin@apple.com [Wed, 29 May 2019 23:01:54 +0000 (23:01 +0000)]
Followup to r245267 and r245272: fix even more deprecated uses of -[UIApplication interfaceOrientation]
https://bugs.webkit.org/show_bug.cgi?id=198348
<rdar://problem/51234077>

Reviewed by Wenson Hsieh.

r245267 and r245272 fixed many instances of this issue; this change
fixes the issue for watchOS.

* wtf/FeatureDefines.h:

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

4 months agoReestablish WebSWClientConnection in case of network process crash
youenn@apple.com [Wed, 29 May 2019 22:21:08 +0000 (22:21 +0000)]
Reestablish WebSWClientConnection in case of network process crash
https://bugs.webkit.org/show_bug.cgi?id=198333

Reviewed by Alex Christensen.

Source/WebCore:

Refactor DocumentLoader to no longer take a ref to the SWClientConnection.
Instead, store the sessionID and get the SWClientConnection from it.
Remove unused code from ServiceWorkerContainer.

Test: http/wpt/service-workers/service-worker-networkprocess-crash.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
(WebCore::DocumentLoader::unregisterTemporaryServiceWorkerClient):
* loader/DocumentLoader.h:
* workers/service/ServiceWorkerContainer.cpp:
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJobClient.h:

Source/WebKit:

WebSWClientConnection now takes a RefPtr<IPC::Connection> so that on network process crash, it will set it back to null.
On the next call that needs the connection, WebSWClientConnection will reinitialize its underlying IPC connection and its own identifier.
Make sure that all code paths requiring this initialization are covered.

* WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::didClose):
(WebKit::NetworkProcessConnection::serviceWorkerConnectionForSession):
(WebKit::NetworkProcessConnection::isRegisteredActiveSWClientConnection):
(WebKit::NetworkProcessConnection::initializeSWClientConnection):
* WebProcess/Network/NetworkProcessConnection.h:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::WebSWClientConnection):
(WebKit::WebSWClientConnection::~WebSWClientConnection):
(WebKit::WebSWClientConnection::initializeConnectionIfNeeded):
(WebKit::WebSWClientConnection::ensureConnectionAndSend):
(WebKit::WebSWClientConnection::scheduleJobInServer):
(WebKit::WebSWClientConnection::finishFetchingScriptInServer):
(WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
(WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
(WebKit::WebSWClientConnection::registerServiceWorkerClient):
(WebKit::WebSWClientConnection::unregisterServiceWorkerClient):
(WebKit::WebSWClientConnection::didResolveRegistrationPromise):
(WebKit::WebSWClientConnection::matchRegistration):
(WebKit::WebSWClientConnection::runOrDelayTaskForImport):
(WebKit::WebSWClientConnection::whenRegistrationReady):
(WebKit::WebSWClientConnection::getRegistrations):
(WebKit::WebSWClientConnection::startFetch):
(WebKit::WebSWClientConnection::cancelFetch):
(WebKit::WebSWClientConnection::continueDidReceiveFetchResponse):
(WebKit::WebSWClientConnection::connectionToServerLost):
(WebKit::WebSWClientConnection::syncTerminateWorker):
(WebKit::WebSWClientConnection::serverConnectionIdentifier const):
(WebKit::WebSWClientConnection::updateThrottleState):
* WebProcess/Storage/WebSWClientConnection.h:

LayoutTests:

* http/wpt/service-workers/service-worker-networkprocess-crash-expected.txt: Added.
* http/wpt/service-workers/service-worker-networkprocess-crash.html: Added.

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

4 months ago[iOS] WebPage::positionInformation() may set InteractionInformationAtPosition.isImage...
commit-queue@webkit.org [Wed, 29 May 2019 22:07:29 +0000 (22:07 +0000)]
[iOS] WebPage::positionInformation() may set InteractionInformationAtPosition.isImage to true but leave image unset
https://bugs.webkit.org/show_bug.cgi?id=198202

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-05-29
Reviewed by Tim Horton.

Source/WebKit:

r192037 added the flags isLink and isImage to InteractionInformationAtPosition.
It also made WebPage::positionInformation() set isImage to true but before
ensuring there is a valid image at the position.

Safari WebKit additions assumes if isImage is true then the image has to
hold a valid ShareableBitmap pointer. Since WebPage::positionInformation()
is the only place that sets isImage, the fix is to set isImage to true
only  after passing all the image validation checks.

Since WebPage::positionInformation() is a little bit difficult to read
(182 lines), It was re-factored by splitting it to static functions.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::focusedElementPositionInformation):
(WebKit::linkIndicatorPositionInformation):
(WebKit::dataDetectorLinkPositionInformation):
(WebKit::imagePositionInformation):
(WebKit::boundsPositionInformation):
(WebKit::elementPositionInformation):
(WebKit::selectionPositionInformation):
(WebKit::textInteractionPositionInformation):
(WebKit::WebPage::positionInformation):

Tools:

The new test ensures InteractionInformationAtPosition::isImage will not
be to true for a broken image.

* TestWebKitAPI/Tests/WebKitCocoa/WKRequestActivatedElementInfo.mm:
(TestWebKitAPI::TEST):

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

4 months agoIndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects...
ddkilzer@apple.com [Wed, 29 May 2019 22:07:24 +0000 (22:07 +0000)]
IndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects into an autoreleasePool that's never cleared
<https://webkit.org/b/198346>
<rdar://problem/50895658>

Reviewed by Brent Fulgham.

Source/WebCore:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::IDBServer):
- Pass AutodrainedPoolForRunLoop::Use when creating
  CrossThreadTaskHandler to fix the bug.

Source/WTF:

* wtf/CrossThreadTaskHandler.cpp:
(WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
- Add optional second argument to enable use of an
  AutodrainedPool when running the runloop.
(WTF::CrossThreadTaskHandler::taskRunLoop):
- Create an AutodrainedPool if requested when
  CrossThreadTaskHandler was created.
* wtf/CrossThreadTaskHandler.h:
(WTF::CrossThreadTaskHandler::AutodrainedPoolForRunLoop):
- Add enum class for enabling an AutodrainedPool for
  CrossThreadTaskHandler::taskRunLoop().
(WTF::CrossThreadTaskHandler::CrossThreadTaskHandler):
- Add optional second argument to enable use of an
  AutodrainedPool when running the runloop.

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

4 months agocheck-webkit-style reports false-positive build/include_order warning in WTF C++...
ddkilzer@apple.com [Wed, 29 May 2019 22:04:58 +0000 (22:04 +0000)]
check-webkit-style reports false-positive build/include_order warning in WTF C++ source files
<https://webkit.org/b/198349>

Reviewed by Alex Christensen.

* Scripts/webkitpy/style/checkers/cpp.py:
(_classify_include): Don't return early for <wtf/Header.h>
includes.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(OrderOfIncludesTest.test_primary_header): Add tests for
<wtf/Header.h> includes.

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

4 months agoImplement Promise.allSettled
dino@apple.com [Wed, 29 May 2019 21:28:09 +0000 (21:28 +0000)]
Implement Promise.allSettled
https://bugs.webkit.org/show_bug.cgi?id=197600
<rdar://problem/50483885>

Reviewed by Keith Miller.

JSTests:

Start testing Promise.allSettled. We pass most of the tests.
The ones that fail are similar to the Promise.all tests we already fail.

* test262/config.yaml: Remove Promise.allSettled from skipped tests.
* test262/expectations.yaml: Add new expectations for allSettled tests.

Source/JavaScriptCore:

Implement Promise.allSettled
https://github.com/tc39/proposal-promise-allSettled/

Shipping in Firefox since version 68.
Shipping in V8 since https://chromium.googlesource.com/v8/v8.git/+/1f6d27e8df819b448712dface6ad367fb8de426b

* builtins/PromiseConstructor.js:
(allSettled.newResolveRejectElements.resolveElement):
(allSettled.newResolveRejectElements.rejectElement):
(allSettled.newResolveRejectElements):
(allSettled): Added.
* runtime/JSPromiseConstructor.cpp: Add ref to allSettled.

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

4 months agoWeakPtr breaks vtables when upcasting to base classes
ggaren@apple.com [Wed, 29 May 2019 21:15:54 +0000 (21:15 +0000)]
WeakPtr breaks vtables when upcasting to base classes
https://bugs.webkit.org/show_bug.cgi?id=188799

Reviewed by Youenn Fablet.

Source/WebCore:

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::MediaKeySession):
* Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
Removed redundant WeakPtrFactory.

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::existingWrapper):
* css/CSSFontFace.h: Moved functions out of line to avoid #include
explosion for .get().

* dom/ContainerNode.h:
* dom/Document.h:
* dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
subclasses except for DocumentFragment were already so, and we have
code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.

* dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::fullscreenRenderer const):
* dom/FullscreenManager.h:
(WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::form const):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const): Deleted. Moved functions
out of line to avoid #include explosion for .get().

* html/HTMLMediaElement.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Removed redundant .get().

* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::window const):
* page/DOMWindowProperty.h:
(WebCore::DOMWindowProperty::window const): Deleted.
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
* page/FrameViewLayoutContext.h:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
* page/UndoItem.cpp:
(WebCore::UndoItem::undoManager const):
* page/UndoItem.h:
(WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
line to avoid #include explosion for .get().

* platform/ScrollView.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* platform/Widget.cpp:
(WebCore::Widget::parent const):
* platform/Widget.h:
(WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
explosion for .get().

* platform/encryptedmedia/CDMInstanceSession.h: Made
CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
CanMakeWeakPtr is inherited now.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::CMTimebaseEffectiveRateChangedCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
(WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
(WebCore::SourceBufferPrivateAVFObjC::flushVideo):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
(WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::multiColumnFlow const):
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::header const):
(WebCore::RenderTable::footer const):
(WebCore::RenderTable::firstBody const):
(WebCore::RenderTable::topSection const):
* rendering/RenderTable.h:
(WebCore::RenderTable::header const): Deleted.
(WebCore::RenderTable::footer const): Deleted.
(WebCore::RenderTable::firstBody const): Deleted.
(WebCore::RenderTable::topSection const): Deleted. Moved functions out
of line to avoid #include explosion for .get().

Source/WebKit:

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::networkSession):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::suspendedPage const):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

* UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
(WebKit::SecKeyProxyStore::get const):
(WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted
CanMakeWeakPtr.

* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebProcessProxy.cpp: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

(WebKit::WebProcessProxy::processPool const):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::processPool const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

Source/WTF:

This patch switches from reinterpret_cast to static_cast when loading
from WeakReference storage.

We know which type to cast *to* because it's specified by the type of
the calling WeakPtr.

We know which type to cast *from* because it's specified by a typedef
in CanMakeWeakPtr.

(Our convention is that we store a pointer to the class that derives
from CanMakeWeakPtr. We cast from that pointer to derived pointers when
we get(). This means that #include of the derived type header is now
required in order to get() the pointer.)

* wtf/WeakHashSet.h:
(WTF::HashTraits<Ref<WeakReference>>::isReleasedWeakValue): Definition
is now eagerly required because WeakReference is not a template anymore.

(WTF::WeakHashSet::WeakHashSetConstIterator::get const):
(WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets):
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const):
(WTF::WeakHashSet::hasNullReferences const):
(WTF::WeakHashSet::computeSize const):
(WTF::HashTraits<Ref<WeakReference<T>>>::isReleasedWeakValue): Deleted.
Updated for new WeakReference get() API.

* wtf/WeakPtr.h: Use a macro for TestAPI support. We can't use template
specialization because WeakReference is not a class template anymore.
(Or maybe we could have kept it working with a dummy template argument?
Felt weird, so I switched.)

(WTF::WeakReference::create):
(WTF::WeakReference::~WeakReference):
(WTF::WeakReference::get const):
(WTF::WeakReference::operator bool const):
(WTF::WeakReference::WeakReference): WeakReference is just a void* now.
It's the caller's responsibility, when creating and getting, to use
a consistent storage type. We ensure a canonical storage type using a
typedef inside CanMakeWeakPtr.

(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::get const):
(WTF::WeakPtr::operator bool const):
(WTF::WeakPtr::operator-> const):
(WTF::WeakPtr::operator* const): Adopted new WeakReference API.

(WTF::WeakPtrFactory::createWeakPtr const): No need for reinterpret_cast.

(WTF::weak_reference_cast): This isn't required for correctness, but it's
nice to show a complier error at WeakPtr construction sites when you know
that the types won't work. Otherwise, you get compiler errors at
dereference sites, which are slightly more mysterious ways of saying that
you constructed your WeakPtr incorrectly.

(WTF::WeakPtr<T>::WeakPtr):
(WTF::=):
(WTF::makeWeakPtr):
(WTF::weak_reference_upcast): Deleted.
(WTF::weak_reference_downcast): Deleted.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp: Adopt the new macro API instead
of template specialization for observing weak references.

(TestWebKitAPI::Int::Int):
(TestWebKitAPI::Int::operator int const):
(TestWebKitAPI::Int::operator== const): Use a class for integer tests
because WeakPtr doesn't naturally support pointing to non-class objects
now.

(TestWebKitAPI::Base::foo):
(TestWebKitAPI::Derived::foo): Inherit from CanMakeWeakPtr to enable
deduction of the weak pointer type.

(TestWebKitAPI::TEST): Updated to use Int.

(TestWebKitAPI::Base::weakPtrFactory const): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::WeakReference): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::~WeakReference): Deleted.

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

4 months ago[Pointer Events] toElement and fromElement should be null
commit-queue@webkit.org [Wed, 29 May 2019 21:04:55 +0000 (21:04 +0000)]
[Pointer Events] toElement and fromElement should be null
https://bugs.webkit.org/show_bug.cgi?id=198338

Patch by Antoine Quint <graouts@apple.com> on 2019-05-29
Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Mark WPT progressions now that we return the correct values for toElement and fromElement.

* web-platform-tests/pointerevents/pointerevent_pointerenter_does_not_bubble-expected.txt:
* web-platform-tests/pointerevents/pointerevent_pointerleave_does_not_bubble-expected.txt:

Source/WebCore:

* dom/MouseEvent.h:
* dom/PointerEvent.h:

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

4 months agoVersioning.
kocsen_chung@apple.com [Wed, 29 May 2019 20:29:26 +0000 (20:29 +0000)]
Versioning.

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

4 months agoUnreviewed, rolling out r245857.
ryanhaddad@apple.com [Wed, 29 May 2019 20:07:56 +0000 (20:07 +0000)]
Unreviewed, rolling out r245857.

Breaks internal builds.

Reverted changeset:

"WeakPtr breaks vtables when upcasting to base classes"
https://bugs.webkit.org/show_bug.cgi?id=188799
https://trac.webkit.org/changeset/245857

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

4 months agoFix internal watchOS build
achristensen@apple.com [Wed, 29 May 2019 19:37:14 +0000 (19:37 +0000)]
Fix internal watchOS build
https://bugs.webkit.org/show_bug.cgi?id=198344
<rdar://problem/51128965>

Reviewed by Geoff Garen.

* Misc/WebDownload.h:
Fix watchOS like we did iosmac in r245596

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

4 months agoFix builds that don't use makeWindowFromView
krollin@apple.com [Wed, 29 May 2019 19:16:35 +0000 (19:16 +0000)]
Fix builds that don't use makeWindowFromView
https://bugs.webkit.org/show_bug.cgi?id=198342
<rdar://problem/51228563>

Reviewed by Wenson Hsieh.

In some configurations, VideoFullscreenInterfaceAVKit.mm declares but
does not use makeWindowFromView. Fix by conditionalizing the the
declaration on the same symbol as point where it's used.

No new tests -- no new functionality.

* platform/ios/VideoFullscreenInterfaceAVKit.mm:

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

4 months ago[iOS] The WebContent process needs proper entitlement to do secure drawing
cdumez@apple.com [Wed, 29 May 2019 19:15:26 +0000 (19:15 +0000)]
[iOS] The WebContent process needs proper entitlement to do secure drawing
https://bugs.webkit.org/show_bug.cgi?id=198343
<rdar://problem/50671257>

Reviewed by Tim Horton.

The WebContent process needs proper entitlement to do secure drawing on iOS.

* Configurations/WebContent-iOS.entitlements:

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

4 months agoUserMediaCaptureManager should remove a source from its map once the source is ended
youenn@apple.com [Wed, 29 May 2019 18:51:25 +0000 (18:51 +0000)]
UserMediaCaptureManager should remove a source from its map once the source is ended
https://bugs.webkit.org/show_bug.cgi?id=198337

Reviewed by Eric Carlson.

When the source is stopped, for instance using MediaStreamTrack.stop,
remove the source from UserMediaCaptureManager sources map.
This makes sure the map will not grow over time.
Add an if check to ensure that the source is still there before processing an incoming IPC call.

When UIProcess tells us the capture is finished (typically capture failed), remove the entry on WebProcess side as well.

* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::createCaptureSource):
(WebKit::UserMediaCaptureManager::sourceStopped):
(WebKit::UserMediaCaptureManager::captureFailed):
(WebKit::UserMediaCaptureManager::sourceMutedChanged):
(WebKit::UserMediaCaptureManager::sourceSettingsChanged):
(WebKit::UserMediaCaptureManager::storageChanged):
(WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
(WebKit::UserMediaCaptureManager::audioSamplesAvailable):
(WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable):
(WebKit::UserMediaCaptureManager::sourceEnded):
(WebKit::UserMediaCaptureManager::applyConstraintsSucceeded):
(WebKit::UserMediaCaptureManager::applyConstraintsFailed):

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

4 months agoUserMediaCaptureManagerProxy::SourceProxy should directly have access to its IPC...
youenn@apple.com [Wed, 29 May 2019 18:36:06 +0000 (18:36 +0000)]
UserMediaCaptureManagerProxy::SourceProxy should directly have access to its IPC connection
https://bugs.webkit.org/show_bug.cgi?id=198335

Reviewed by Eric Carlson.

Previously, SourceProxy was getting its IPC connection by going through its manager, then its process proxy.
As some calls can be done from a background thread, it is safer to directly make SourceProxy own a Ref of its IPC connection.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):

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

4 months agoWeakPtr breaks vtables when upcasting to base classes
ggaren@apple.com [Wed, 29 May 2019 18:22:00 +0000 (18:22 +0000)]
WeakPtr breaks vtables when upcasting to base classes
https://bugs.webkit.org/show_bug.cgi?id=188799

Reviewed by Youenn Fablet.

Source/WebCore:

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::MediaKeySession):
* Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
Removed redundant WeakPtrFactory.

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::existingWrapper):
* css/CSSFontFace.h: Moved functions out of line to avoid #include
explosion for .get().

* dom/ContainerNode.h:
* dom/Document.h:
* dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
subclasses except for DocumentFragment were already so, and we have
code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.

* dom/FullscreenManager.cpp:
(WebCore::FullscreenManager::fullscreenRenderer const):
* dom/FullscreenManager.h:
(WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
* html/FormAssociatedElement.cpp:
(WebCore::FormAssociatedElement::form const):
* html/FormAssociatedElement.h:
(WebCore::FormAssociatedElement::form const): Deleted. Moved functions
out of line to avoid #include explosion for .get().

* html/HTMLMediaElement.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::requestResource): Removed redundant .get().

* page/DOMWindowProperty.cpp:
(WebCore::DOMWindowProperty::window const):
* page/DOMWindowProperty.h:
(WebCore::DOMWindowProperty::window const): Deleted.
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
* page/FrameViewLayoutContext.h:
(WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
* page/UndoItem.cpp:
(WebCore::UndoItem::undoManager const):
* page/UndoItem.h:
(WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
line to avoid #include explosion for .get().

* platform/ScrollView.h: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

* platform/Widget.cpp:
(WebCore::Widget::parent const):
* platform/Widget.h:
(WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
explosion for .get().

* platform/encryptedmedia/CDMInstanceSession.h: Made
CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
CanMakeWeakPtr is inherited now.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::CMTimebaseEffectiveRateChangedCallback):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
(WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
(WebCore::SourceBufferPrivateAVFObjC::flushVideo):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
(WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
* rendering/RenderBlockFlow.h:
(WebCore::RenderBlockFlow::multiColumnFlow const):
* rendering/RenderMultiColumnFlow.cpp:
(WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
* rendering/RenderMultiColumnFlow.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::header const):
(WebCore::RenderTable::footer const):
(WebCore::RenderTable::firstBody const):
(WebCore::RenderTable::topSection const):
* rendering/RenderTable.h:
(WebCore::RenderTable::header const): Deleted.
(WebCore::RenderTable::footer const): Deleted.
(WebCore::RenderTable::firstBody const): Deleted.
(WebCore::RenderTable::topSection const): Deleted. Moved functions out
of line to avoid #include explosion for .get().

Source/WebKit:

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::networkSession):
* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.h:
* Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::suspendedPage const):
* Shared/WebBackForwardListItem.h:
(WebKit::WebBackForwardListItem::suspendedPage const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

* UIProcess/Authentication/cocoa/SecKeyProxyStore.h:
(WebKit::SecKeyProxyStore::get const):
(WebKit::SecKeyProxyStore::weakPtrFactory const): Deleted. Adopted
CanMakeWeakPtr.

* UIProcess/WebAuthentication/AuthenticatorManager.h:
* UIProcess/WebProcessProxy.cpp: It takes an extra using declaration
to disambiguate multiple CanMakeWeakPtr base classes now.

(WebKit::WebProcessProxy::processPool const):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::processPool const): Deleted. Moved
functions out of line to avoid #include explosion for .get().

Source/WTF:

This patch switches from reinterpret_cast to static_cast when loading
from WeakReference storage.

We know which type to cast *to* because it's specified by the type of
the calling WeakPtr.

We know which type to cast *from* because it's specified by a typedef
in CanMakeWeakPtr.

(Our convention is that we store a pointer to the class that derives
from CanMakeWeakPtr. We cast from that pointer to derived pointers when
we get(). This means that #include of the derived type header is now
required in order to get() the pointer.)

* wtf/WeakHashSet.h:
(WTF::HashTraits<Ref<WeakReference>>::isReleasedWeakValue): Definition
is now eagerly required because WeakReference is not a template anymore.

(WTF::WeakHashSet::WeakHashSetConstIterator::get const):
(WTF::WeakHashSet::WeakHashSetConstIterator::skipEmptyBuckets):
(WTF::WeakHashSet::remove):
(WTF::WeakHashSet::contains const):
(WTF::WeakHashSet::computesEmpty const):
(WTF::WeakHashSet::hasNullReferences const):
(WTF::WeakHashSet::computeSize const):
(WTF::HashTraits<Ref<WeakReference<T>>>::isReleasedWeakValue): Deleted.
Updated for new WeakReference get() API.

* wtf/WeakPtr.h: Use a macro for TestAPI support. We can't use template
specialization because WeakReference is not a class template anymore.
(Or maybe we could have kept it working with a dummy template argument?
Felt weird, so I switched.)

(WTF::WeakReference::create):
(WTF::WeakReference::~WeakReference):
(WTF::WeakReference::get const):
(WTF::WeakReference::operator bool const):
(WTF::WeakReference::WeakReference): WeakReference is just a void* now.
It's the caller's responsibility, when creating and getting, to use
a consistent storage type. We ensure a canonical storage type using a
typedef inside CanMakeWeakPtr.

(WTF::WeakPtr::WeakPtr):
(WTF::WeakPtr::get const):
(WTF::WeakPtr::operator bool const):
(WTF::WeakPtr::operator-> const):
(WTF::WeakPtr::operator* const): Adopted new WeakReference API.

(WTF::WeakPtrFactory::createWeakPtr const): No need for reinterpret_cast.

(WTF::weak_reference_cast): This isn't required for correctness, but it's
nice to show a complier error at WeakPtr construction sites when you know
that the types won't work. Otherwise, you get compiler errors at
dereference sites, which are slightly more mysterious ways of saying that
you constructed your WeakPtr incorrectly.

(WTF::WeakPtr<T>::WeakPtr):
(WTF::=):
(WTF::makeWeakPtr):
(WTF::weak_reference_upcast): Deleted.
(WTF::weak_reference_downcast): Deleted.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp: Adopt the new macro API instead
of template specialization for observing weak references.

(TestWebKitAPI::Int::Int):
(TestWebKitAPI::Int::operator int const):
(TestWebKitAPI::Int::operator== const): Use a class for integer tests
because WeakPtr doesn't naturally support pointing to non-class objects
now.

(TestWebKitAPI::Base::foo):
(TestWebKitAPI::Derived::foo): Inherit from CanMakeWeakPtr to enable
deduction of the weak pointer type.

(TestWebKitAPI::TEST): Updated to use Int.

(TestWebKitAPI::Base::weakPtrFactory const): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::WeakReference): Deleted.
(WTF::WeakReference<TestWebKitAPI::Base>::~WeakReference): Deleted.

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

4 months agoModernize getting proxies of UserMediaCaptureManagerProxy
youenn@apple.com [Wed, 29 May 2019 18:12:40 +0000 (18:12 +0000)]
Modernize getting proxies of UserMediaCaptureManagerProxy
https://bugs.webkit.org/show_bug.cgi?id=198336

Reviewed by Eric Carlson.

No change of behavior, use HashMap::get instead of find.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::startProducingData):
(WebKit::UserMediaCaptureManagerProxy::stopProducingData):
(WebKit::UserMediaCaptureManagerProxy::capabilities):
(WebKit::UserMediaCaptureManagerProxy::setMuted):
(WebKit::UserMediaCaptureManagerProxy::applyConstraints):

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

4 months ago[watchOS] Remove an unneeded #import
aestes@apple.com [Wed, 29 May 2019 17:59:31 +0000 (17:59 +0000)]
[watchOS] Remove an unneeded #import
https://bugs.webkit.org/show_bug.cgi?id=198339
<rdar://problem/51195415>

Reviewed by Wenson Hsieh.

* UIProcess/ios/forms/WKTimePickerViewController.mm:

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

4 months agoScrolling node ordering wrong when a layer has both positioning and fixed/sticky...
antti@apple.com [Wed, 29 May 2019 17:41:28 +0000 (17:41 +0000)]
Scrolling node ordering wrong when a layer has both positioning and fixed/sticky node
https://bugs.webkit.org/show_bug.cgi?id=198329

Reviewed by Darin Adler.

Source/WebCore:

Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow.html

With sticky positioning in non-stacking context overflow you currently get structure like

FrameScrollingNode
  OverflowScrollingNode
  StickyNode
    PositionedNode

where StickyNode and PositionedNode reference the same layer. Sticky doesn't get applied at all when the overflow moves.

This patch reverses the order of sticky and positioned. It doesn't fix sticky positioning during scrolling yet,
but it does make it less jumpy. It is a prerequisite for the full fix.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):

LayoutTests:

* platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/sticky-in-overflow.html: Added.

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

4 months agoPrepend KEY_ to the last key alias in PlatformEventKeyboardGtk
commit-queue@webkit.org [Wed, 29 May 2019 17:23:16 +0000 (17:23 +0000)]
Prepend KEY_ to the last key alias in PlatformEventKeyboardGtk
https://bugs.webkit.org/show_bug.cgi?id=198331

Patch by Ludovico de Nittis <ludovico.denittis@collabora.com> on 2019-05-29
Reviewed by Michael Catanzaro.

No behavior change.

With the commit
https://bugs.webkit.org/show_bug.cgi?id=198326
A gdk key slipped away from the renaming.

* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::modifiersForGdkKeyEvent):

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

4 months agoCorrect flaky WebAuthN test cases
bfulgham@apple.com [Wed, 29 May 2019 17:05:02 +0000 (17:05 +0000)]
Correct flaky WebAuthN test cases
https://bugs.webkit.org/show_bug.cgi?id=198308
<rdar://problem/48677219>

Reviewed by David Kilzer.

Correct offset math in the MockHidConnection implementation. The write position of
the payload buffer was computed using the value of 'size()', which is set to the full
capacity of the vector after a 'grow()' operation.

Tests: http/wpt/webauthn

* UIProcess/WebAuthentication/Mock/MockHidConnection.cpp:
(WebKit::MockHidConnection::feedReports):

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

4 months agoDisable Flaky API Test TestWebKitAPI._WKDownload.DownloadMonitorCancel
aakash_jain@apple.com [Wed, 29 May 2019 16:58:56 +0000 (16:58 +0000)]
Disable Flaky API Test TestWebKitAPI._WKDownload.DownloadMonitorCancel
https://bugs.webkit.org/show_bug.cgi?id=198328

Reviewed by Alexey Proskuryakov.

* TestWebKitAPI/Tests/WebKitCocoa/Download.mm:

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

4 months ago[LFC][IFC] Move Line class to a dedicated file
zalan@apple.com [Wed, 29 May 2019 16:07:19 +0000 (16:07 +0000)]
[LFC][IFC] Move Line class to a dedicated file
https://bugs.webkit.org/show_bug.cgi?id=198332
<rdar://problem/51221403>

Reviewed by Antti Koivisto.

An upcoming refactoring requires the Line class to be in a .h.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/displaytree/DisplayRun.h:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
(WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
(WebCore::Layout::halfLeadingMetrics): Deleted.
(WebCore::Layout::Line::availableWidth const): Deleted.
(WebCore::Layout::Line::contentLogicalRight const): Deleted.
(WebCore::Layout::Line::contentLogicalWidth const): Deleted.
(WebCore::Layout::Line::logicalTop const): Deleted.
(WebCore::Layout::Line::logicalLeft const): Deleted.
(WebCore::Layout::Line::logicalRight const): Deleted.
(WebCore::Layout::Line::logicalBottom const): Deleted.
(WebCore::Layout::Line::logicalWidth const): Deleted.
(WebCore::Layout::Line::logicalHeight const): Deleted.
(WebCore::Layout::Line::LineItem::LineItem): Deleted.
(WebCore::Layout::Line::Line): Deleted.
(WebCore::Layout::Line::reset): Deleted.
(WebCore::Layout::Line::close): Deleted.
(WebCore::Layout::Line::removeTrailingTrimmableContent): Deleted.
(WebCore::Layout::Line::moveLogicalLeft): Deleted.
(WebCore::Layout::Line::moveLogicalRight): Deleted.
(WebCore::Layout::isTrimmableContent): Deleted.
(WebCore::Layout::Line::trailingTrimmableWidth const): Deleted.
(WebCore::Layout::Line::hasContent const): Deleted.
(WebCore::Layout::Line::appendNonBreakableSpace): Deleted.
(WebCore::Layout::Line::appendInlineContainerStart): Deleted.
(WebCore::Layout::Line::appendInlineContainerEnd): Deleted.
(WebCore::Layout::Line::appendTextContent): Deleted.
(WebCore::Layout::Line::appendNonReplacedInlineBox): Deleted.
(WebCore::Layout::Line::appendReplacedInlineBox): Deleted.
(WebCore::Layout::Line::appendHardLineBreak): Deleted.
* layout/inlineformatting/InlineTextItem.h:
* layout/inlineformatting/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::isTrimmableContent):
* layout/inlineformatting/text/TextUtil.h:

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

4 months agoPlatformEventKeyboardGtk still uses old key aliases
commit-queue@webkit.org [Wed, 29 May 2019 13:07:02 +0000 (13:07 +0000)]
PlatformEventKeyboardGtk still uses old key aliases
https://bugs.webkit.org/show_bug.cgi?id=198326

Patch by Ludovico de Nittis <ludovico.denittis@collabora.com> on 2019-05-29
Reviewed by Carlos Garcia Campos.

No behavior change.

Use the new key names convention prepending "KEY_".

* platform/gtk/PlatformKeyboardEventGtk.cpp:
(WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode):
(WebCore::PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode):
(WebCore::PlatformKeyboardEvent::singleCharacterString):
(WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):

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

4 months ago[MSE][GStreamer] update the readyState correctly in MediaPlayerPrivateGStreamerMSE
commit-queue@webkit.org [Wed, 29 May 2019 06:00:40 +0000 (06:00 +0000)]
[MSE][GStreamer] update the readyState correctly in MediaPlayerPrivateGStreamerMSE
https://bugs.webkit.org/show_bug.cgi?id=197834

Patch by Yacine Bandou <yacine.bandou@softathome.com> on 2019-05-28
Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

The buffering state and the m_downloadFinished boolean aren't supported in the MSE case.
When the readyState is already "HaveEnoughData", we don't want to revert it to "HaveFutureData",
or else the MediaPlayer would send a "canplay" event instead of a "canplaythrough".

Test: media/media-source/media-source-canplaythrough-event.html

* platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
(WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):

LayoutTests:

Add a new test that checks if the MediaElement receives the "canplaythrough"
event when the media content is entirely injected to MSE sourceBuffer.

* media/media-source/media-source-canplaythrough-event-expected.txt: Added.
* media/media-source/media-source-canplaythrough-event.html: Added.

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

4 months ago[WinCairo] REGRESSION(r245186) Crash in NetworkCache::IOChannel::read in http/tests...
Hironori.Fujii@sony.com [Wed, 29 May 2019 04:40:00 +0000 (04:40 +0000)]
[WinCairo] REGRESSION(r245186) Crash in NetworkCache::IOChannel::read in http/tests/IndexedDB some tests
https://bugs.webkit.org/show_bug.cgi?id=197941

Reviewed by Don Olmstead.

http/tests/IndexedDB some tests were crashing in
NetworkCache::IOChannel::read in order to allocate a buffer with
std::numeric_limits<size_t>::max() as the size.

IOChannel::read should check the file size, and calculate the read
size.

* NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp:
(WebKit::NetworkCache::IOChannel::read): Limit the read buffer
size by calling FileSystem::getFileSize.

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

4 months ago[WinCairo] ASSERTION FAILED: !m_preparingToPlay in MediaPlayerPrivateMediaFoundation...
Hironori.Fujii@sony.com [Wed, 29 May 2019 04:38:04 +0000 (04:38 +0000)]
[WinCairo] ASSERTION FAILED: !m_preparingToPlay in MediaPlayerPrivateMediaFoundation::prepareToPlay
https://bugs.webkit.org/show_bug.cgi?id=190747

Reviewed by Alex Christensen.

HTMLMediaElement::prepareToPlay had a assertion ensuring that it
was not called twice. However, it was called twice. The first from
HTMLMediaElement::load, the second from
MediaPlayerPrivateMediaFoundation::onTopologySet.

prepareToPlay started loading. And, loading should be started
after onTopologySet is called back.

Covered by existing tests.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::onTopologySet): Moved code from prepareToPlay.
(WebCore::MediaPlayerPrivateMediaFoundation::prepareToPlay): Deleted and moved the code to onTopologySet.
* platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: Removed prepareToPlay declaration.

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

4 months ago[WinCairo][MediaFoundation] Assertion failure in MediaPlayerPrivateMediaFoundation...
Hironori.Fujii@sony.com [Wed, 29 May 2019 04:33:26 +0000 (04:33 +0000)]
[WinCairo][MediaFoundation] Assertion failure in MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample
https://bugs.webkit.org/show_bug.cgi?id=198290

Reviewed by Per Arne Vollan.

Covered by existing tests.

* platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
(WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
Call clear() of m_memSurface before assigning new value.

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

4 months ago[WHLSL] Type of dereference is the type of the thing we point to, not a pointer to...
sbarati@apple.com [Wed, 29 May 2019 04:13:53 +0000 (04:13 +0000)]
[WHLSL] Type of dereference is the type of the thing we point to, not a pointer to that type
https://bugs.webkit.org/show_bug.cgi?id=198321

Reviewed by Myles C. Maxfield.

Source/WebCore:

Consider this program:
```
thread int* x;
*x = 42
```

In the Checker, we were saying the type of "*x" was "int*" instead of "int".

Test: webgpu/whlsl-dereference-pointer-should-type-check.html

* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::Checker::visit):

LayoutTests:

* webgpu/whlsl-dereference-pointer-should-type-check-expected.html: Added.
* webgpu/whlsl-dereference-pointer-should-type-check.html: Added.

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

4 months agoAttempt to fix JSC test timeouts after adding collectContinuously to WASM tests.
justin_michaud@apple.com [Wed, 29 May 2019 03:27:47 +0000 (03:27 +0000)]
Attempt to fix JSC test timeouts after adding collectContinuously to WASM tests.
https://bugs.webkit.org/show_bug.cgi?id=198322

Reviewed by Saam Barati.

Increases the collection period from 1 to slightly higher to try to speed up the tests. Any higher and
the test runner does not detect the bug that required the memset in Wasm::Instance::Instance().

* Scripts/run-jsc-stress-tests:

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

4 months ago[iOS] Respect NSItemProvider's registered types when dropping files that are loaded...
wenson_hsieh@apple.com [Wed, 29 May 2019 02:56:09 +0000 (02:56 +0000)]
[iOS] Respect NSItemProvider's registered types when dropping files that are loaded in-place
https://bugs.webkit.org/show_bug.cgi?id=198315
<rdar://problem/51183762>

Reviewed by Tim Horton.

Source/WebCore:

Currently, logic in PasteboardIOS.mm and WebContentReaderCocoa.mm attempts to deduce the content type from the
file path when dropping attachments on iOS. Instead, we should be plumbing the content type through to the
reader.

Test: WKAttachmentTestsIOS.InsertDroppedImageWithNonImageFileExtension

* editing/WebContentReader.h:
* editing/cocoa/WebContentReaderCocoa.mm:
(WebCore::typeForAttachmentElement):

Add a helper method to determine which type to use in attachment elements. This makes the paste
(attachmentForData) and drop (attachmentForFilePaths) behave the same way, with respect to the type attribute
used to represent the attachment.

(WebCore::attachmentForFilePath):

Use the content type, if specified; otherwise, fall back to deducing it from the file path.

(WebCore::attachmentForData):
(WebCore::WebContentReader::readFilePath):
* platform/Pasteboard.h:
(WebCore::PasteboardWebContentReader::readFilePath):

Pass the highest fidelity representation's content type to the web content reader.

* platform/ios/PasteboardIOS.mm:
(WebCore::Pasteboard::readRespectingUTIFidelities):

Tools:

Adds a new API test to verify that when dropping a file that is loaded in-place with a file extension that is
not a .png (but was registered to the item provider as "public.png"), the resulting attachment is contained in
an image element, and the resulting attachment info indicates that the dropped attachment is a png file.

Additionally, rebaseline some existing tests.

* TestWebKitAPI/Tests/WebKitCocoa/WKAttachmentTests.mm:
(runTestWithTemporaryImageFile):
(TestWebKitAPI::TEST):

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

4 months agoMove idempotent text autosizing to StyleTreeResolver
mmaxfield@apple.com [Wed, 29 May 2019 02:27:20 +0000 (02:27 +0000)]
Move idempotent text autosizing to StyleTreeResolver
https://bugs.webkit.org/show_bug.cgi?id=197808
<rdar://problem/50283983>

Reviewed by Antti Koivisto.

Source/WebCore:

This patch migrates the idempotent text autosizing code to live inside style resolution. This is almost
the same as the algorithm that uses the result of layout to calculate autosizing, but this version only
operates on style (and thus doesn't require double layouts). Because it is being run in an environment
with less information, autosizing is occurring in more places, so the curves have been adjusted to make
autosizing not boost as much as the previous implementation did. The new algorithm is modelled after
text-decorations-in-effect. I've claimed 4 of the unused bits in RenderStyle to contain the state of the
autosizing algorithm. StyleResolver::adjustRenderStyle() is where the algorithm is implemented:
- Look at the inherited bits
- Interogate the element's RenderStyle
- Compute new bits for the element, and set them in its RenderStyle
- Based on the newly computed bits, determine whether we should increase the text size
- If so, determine how much using the specified font size, and apply the result to the computed font size

This works because StyleBuilderCustom::applyInheritFontSize() inherits from the specified font size, not
the computed font size.

This patch also will disable autosizing using the other methods (so there aren't two methods of autosizing
fighting each other) and will honor text-size-adjust:none. However, it won't honor text-size-adjust:100%.
If content says text-size-adjust:100%, we will disregard it and take this code path.

Tests: fast/text-autosizing/ios/idempotentmode/css-exposure.html
       fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html
       fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-identity.html
       fast/text-autosizing/ios/idempotentmode/idempotent-autosizing.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
* css/CSSProperties.json:
* css/StyleBuilderCustom.h:
(WebCore::computeBaseSpecifiedFontSize):
(WebCore::computeLineHeightMultiplierDueToFontSize):
* css/StyleResolver.cpp:
(WebCore::idempotentTextSize):
(WebCore::hasTextChildren):
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::checkForTextSizeAdjust):
* page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustComputedFontSizes):
(WebCore::idempotentTextSize): Deleted.
* rendering/RenderBlockFlow.h:
* rendering/RenderElement.cpp:
(WebCore::includeNonFixedHeight):
(WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
(WebCore::RenderElement::resetTextAutosizing):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::RenderStyle):
(WebCore::RenderStyle::autosizeStatus const):
(WebCore::RenderStyle::setAutosizeStatus):
* rendering/style/RenderStyle.h:
* rendering/style/TextSizeAdjustment.cpp: Added.
(WebCore::AutosizeStatus::AutosizeStatus):
(WebCore::AutosizeStatus::contains const):
(WebCore::AutosizeStatus::modifiedStatus const):
(WebCore::AutosizeStatus::shouldSkipSubtree const):
* rendering/style/TextSizeAdjustment.h:

LayoutTests:

* fast/text-autosizing/ios/idempotentmode/css-exposure-expected.txt: Added.
* fast/text-autosizing/ios/idempotentmode/css-exposure.html: Added.
* fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip-expected.html: Added.
* fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html: Added.
* platform/ipad/fast/text-autosizing/text-size-adjust-inline-style-expected.html: Removed.
* platform/ipad/fast/text-autosizing/text-size-adjust-inline-style.html: Removed.
We're intentionally not honoring percentages, because this is the most common way that
text autosizing is disabled (by setting it to 100%) on the Web today. However, Web authors
that have done this did it without knowing the full extent of the behavior change, and
the new idempotent text autosizing code path seems to be a progression in most cases
we've seen.

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

4 months agoUse scroll-velocity-based tile coverage for overflow:scroll
simon.fraser@apple.com [Wed, 29 May 2019 01:07:03 +0000 (01:07 +0000)]
Use scroll-velocity-based tile coverage for overflow:scroll
https://bugs.webkit.org/show_bug.cgi?id=198294
rdar://problem/48942184

Reviewed by Tim Horton.

Source/WebCore:

Start using a velocity-based tile coverage computation on layers with Type::ScrolledContents,
which is the content layers for overflow:scroll when they get big enough to get tiled.

Move legacy macOS coverage code into adjustTileCoverageForDesktopPageScrolling() because
I don't want to change its behavior in this patch. Use TileController::adjustTileCoverageRectForScrolling()
for iOS and macOS overflow scrolling. Since only iOS page scrolling gets velocity data from the UI
process, compute velocity in TileController using the visible rect top-left.

For overflow scroll, we have to plumb horizontal and vertical coverage in from
RenderLayerBacking.

Tests: tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage.html
       tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage.html
       tiled-drawing/scrolling/overflow/overflow-tile-coverage.html

* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::adjustCoverageRect const):
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setVelocity):
(WebCore::TileController::adjustTileCoverageRect):
(WebCore::TileController::adjustTileCoverageForDesktopPageScrolling const):
(WebCore::TileController::adjustTileCoverageWithScrollingVelocity const):
(WebCore::TileController::adjustTileCoverageRectForScrolling):
(WebCore::expandRectWithinRect): Deleted.
(WebCore::TileController::adjustTileCoverageRect const): Deleted.
(WebCore::TileController::adjustTileCoverageRectForScrolling const): Deleted.
* platform/graphics/ca/TileController.h:
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::computePageTiledBackingCoverage):
(WebCore::computeOverflowTiledBackingCoverage):
(WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
(WebCore::RenderLayerBacking::updateGeometry):

LayoutTests:

* tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage-expected.txt: Added.
* tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage.html: Added.
* tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage-expected.txt: Added.
* tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage.html: Added.
* tiled-drawing/scrolling/overflow/overflow-tile-coverage-expected.txt: Added.
* tiled-drawing/scrolling/overflow/overflow-tile-coverage.html: Added.

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

4 months agoGCHeapInspector should accept weird filename
ysuzuki@apple.com [Wed, 29 May 2019 01:05:45 +0000 (01:05 +0000)]
GCHeapInspector should accept weird filename
https://bugs.webkit.org/show_bug.cgi?id=198314

Reviewed by Simon Fraser.

GCHeapInspector filenameForPath should have a fallback path if regexp does not match against the given path.

* GCHeapInspector/script/interface.js:
(filenameForPath):

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

4 months agoFix sandbox violation when using QuickLook on iOS
bfulgham@apple.com [Wed, 29 May 2019 00:34:54 +0000 (00:34 +0000)]
Fix sandbox violation when using QuickLook on iOS
https://bugs.webkit.org/show_bug.cgi?id=198312
<rdar://problem/51134351>

Reviewed by Alexey Proskuryakov.

* Resources/SandboxProfiles/ios/com.apple.WebKit.WebContent.sb:

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

4 months agoWeb Inspector: Timelines: spacing around pie chart is different between CPU and Memory
drousso@apple.com [Wed, 29 May 2019 00:14:35 +0000 (00:14 +0000)]
Web Inspector: Timelines: spacing around pie chart is different between CPU and Memory
https://bugs.webkit.org/show_bug.cgi?id=198299

Reviewed by Matt Baker.

"Style Resolution" is a much longer string than any of the legend strings in the Memory
timeline, and causes the CPU timeline legend to shift as a result.

Rename "Script" to "JavaScript" and "Style Resolution" to "Styles" so that the strings are
roughly the same length between the CPU and Memory timelines, meaning that they will appear
in the same spot with similar sizing.

* UserInterface/Views/CPUTimelineView.js:
(WI.CPUTimelineView.displayNameForSampleType):
(WI.CPUTimelineView.prototype.initialLayout):
(WI.CPUTimelineView.prototype._computeStatisticsData):
Drive-by: remove the `WI` prefix from all `CPUTimelineView.SampleType` since it's within the
same class.

* UserInterface/Views/CPUTimelineView.css:
(.timeline-view.cpu > .content > .overview .legend > .row > .swatch.sample-type-javascript): Added.
(.timeline-view.cpu > .content > .overview .legend > .row > .swatch.sample-type-script): Deleted.
Drive-by: move the `.overview` rules lower to be in the same area as the `.overview *` rules.
* UserInterface/Views/MemoryTimelineView.css:
(.timeline-view.memory > .content > .overview):
Drive-by: remove duplicate CSS rule.
* Localizations/en.lproj/localizedStrings.js:

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

4 months agoHorizontal scrollbar flashes after scrolling vertically with keyboard
timothy_horton@apple.com [Tue, 28 May 2019 23:57:27 +0000 (23:57 +0000)]
Horizontal scrollbar flashes after scrolling vertically with keyboard
https://bugs.webkit.org/show_bug.cgi?id=197942
<rdar://problem/46169578>

Reviewed by Dean Jackson.

* UIProcess/ios/WKKeyboardScrollingAnimator.mm:
(axesForDelta):
(-[WKKeyboardScrollViewAnimator scrollToContentOffset:animated:]):
Only flash relevant axes.

* Platform/spi/ios/UIKitSPI.h:

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

4 months agoBuild Fix.
achristensen@apple.com [Tue, 28 May 2019 23:40:24 +0000 (23:40 +0000)]
Build Fix.

* UIProcess/WKImagePreviewViewController.mm:
(-[WKImagePreviewViewController IGNORE_WARNINGS_END]):
(-[WKImagePreviewViewController previewActionItems]): Deleted.

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

4 months agoREGRESSION(r245795): causing internal testers to exit early after 50 crashes.
timothy_horton@apple.com [Tue, 28 May 2019 23:27:54 +0000 (23:27 +0000)]
REGRESSION(r245795): causing internal testers to exit early after 50 crashes.
https://bugs.webkit.org/show_bug.cgi?id=198310
<rdar://problem/51192535>

Reviewed by Simon Fraser.

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(WebKit::touchActionsForPoint):
Initialize hitView to nil.

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

4 months agocreateAnswer() SDP Rejected by setLocalDescription()
youenn@apple.com [Tue, 28 May 2019 23:13:55 +0000 (23:13 +0000)]
createAnswer() SDP Rejected by setLocalDescription()
https://bugs.webkit.org/show_bug.cgi?id=195930
<rdar://problem/49030489>

Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

Make sure to check packetization mode parameter when matching H264 video codec.

* Source/webrtc/media/base/codec.cc:
* WebKit/0001-fix-195930.patch: Added.

LayoutTests:

* webrtc/h264-packetization-mode-expected.txt: Added.
* webrtc/h264-packetization-mode.html: Added.

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

4 months ago[MacOS] Filter GVA warning logged to stdout
eric.carlson@apple.com [Tue, 28 May 2019 22:41:05 +0000 (22:41 +0000)]
[MacOS] Filter GVA warning logged to stdout
https://bugs.webkit.org/show_bug.cgi?id=198303
<rdar://problem/50098041>

Reviewed by Jer Noble.

* Scripts/webkitpy/port/mac.py:
(MacPort.logging_patterns_to_strip): Filter GVA warnings.

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

4 months agoWeb Inspector: Provide UIString descriptions to improve localizations
nvasilyev@apple.com [Tue, 28 May 2019 22:22:20 +0000 (22:22 +0000)]
Web Inspector: Provide UIString descriptions to improve localizations
https://bugs.webkit.org/show_bug.cgi?id=195132
<rdar://problem/48457817>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/LoadLocalizedStrings.js:
(WI.UIString):
(WI.repeatedUIString.timelineRecordLayout):
(WI.repeatedUIString.timelineRecordPaint):
(WI.repeatedUIString.timelineRecordComposite):
(WI.repeatedUIString.allExceptions):
(WI.repeatedUIString.uncaughtExceptions):
(WI.repeatedUIString.assertionFailures):
(WI.repeatedUIString.allRequests):
(WI.repeatedUIString.fetch):
(WI.repeatedUIString.revealInDOMTree):
* UserInterface/Models/LayoutTimelineRecord.js:
(WI.LayoutTimelineRecord.displayNameForEventType):
* UserInterface/Models/RenderingFrameTimelineRecord.js:
(WI.RenderingFrameTimelineRecord.displayNameForTaskType):
* UserInterface/Models/Resource.js:
(WI.Resource.displayNameForType):
* UserInterface/Views/AuditTestGroupContentView.js:
(WI.AuditTestGroupContentView.prototype.layout):
* UserInterface/Views/CPUTimelineView.js:
(WI.CPUTimelineView.displayNameForSampleType):
* UserInterface/Views/ContextMenuUtilities.js:
* UserInterface/Views/DOMBreakpointTreeElement.js:
(WI.DOMBreakpointTreeElement.displayNameForType):
* UserInterface/Views/DOMNodeTreeElement.js:
(WI.DOMNodeTreeElement.prototype.populateContextMenu):
(WI.DOMNodeTreeElement):
* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.populateDOMNodeContextMenu):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WI.DebuggerSidebarPanel.prototype._addBreakpoint):
(WI.DebuggerSidebarPanel.prototype._handleCreateBreakpointMouseDown):
(WI.DebuggerSidebarPanel):
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WI.LayerTreeDetailsSidebarPanel.prototype._buildDataGridSection):
* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.shortDisplayNameForResourceType):
(WI.NetworkTableContentView.prototype.initialLayout):
* UserInterface/Views/SourcesNavigationSidebarPanel.js:
(WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint):
(WI.SourcesNavigationSidebarPanel.prototype._handleCreateBreakpointMouseDown):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._renderSelector):
* UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:
(WI.SpreadsheetRulesStyleDetailsPanel.prototype.layout):

Tools:

Allow WI.UIString to take:
- WI.UIString(string, key, comment)
- WI.UIString(string, comment)
- WI.UIString(string)

* Scripts/extract-localizable-js-strings:

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

4 months agoLimit run-benchmark http server to specific interface.
dewei_zhu@apple.com [Tue, 28 May 2019 21:55:50 +0000 (21:55 +0000)]
Limit run-benchmark http server to specific interface.
https://bugs.webkit.org/show_bug.cgi?id=198247

Reviewed by Ryosuke Niwa.

Add '--interface' option to 'twisted_http_server.py'.
'SimpleHTTPServerDriver' should specify interface for http server.
Update regex that determines http server port from 'lsof' output to support ipv6 address.

* Scripts/webkitpy/benchmark_runner/http_server_driver/http_server/twisted_http_server.py:
Added '--interface' argument.
* Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
Limited http server to a specific interfce.
Added '-P' option to 'lsof' invocation to inhibits the conversion of port numbers to port name so script won't
fail if it's listening on a 'well-known' port.
Abstracted '_check_http_server_is_running' to allow potential child class to have its own implementation.
(SimpleHTTPServerDriver.serve): Updated regex that determines http server port from 'lsof' output to support ipv6 address.
(SimpleHTTPServerDriver.kill_server): Added null check for 'self._server_process'.

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

4 months agoUnreviewed, rolling out r245475.
sroberts@apple.com [Tue, 28 May 2019 21:10:47 +0000 (21:10 +0000)]
Unreviewed, rolling out r245475.

Newly imported test is flaky. Features need flags.

Reverted changeset:

"Implement imagesrcset and imagesizes attributes on link
rel=preload"
https://bugs.webkit.org/show_bug.cgi?id=192950
https://trac.webkit.org/changeset/245475

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

4 months agowebkitpy: Switch run-webkit-tests to tailspin
commit-queue@webkit.org [Tue, 28 May 2019 21:04:44 +0000 (21:04 +0000)]
webkitpy: Switch run-webkit-tests to tailspin
https://bugs.webkit.org/show_bug.cgi?id=198144
<rdar://problem/32463212>

Patch by David Xiong <w_xiong@apple.com> on 2019-05-28
Reviewed by Jonathan Bedard.

Changes run-webkit-tests to run tailspin on test time out
rather than spindump, and edited tests to look for tailspin logs
instead.

* Scripts/webkitpy/port/darwin.py:
(DarwinPort.sample_process): Replaced spindump with tailspin (+ symbolication)
(DarwinPort):
(DarwinPort.tailspin_file_path):
(DarwinTest.spindump_file_path): Deleted.
* Scripts/webkitpy/port/darwin_testcase.py:
(DarwinTest.test_tailspin): Changed spindump test (below) to test for tailspin instead
(DarwinTest.test_spindump): Deleted.
(DarwinTest.test_spindump.logging_run_command): Deleted.
* Scripts/webkitpy/port/ios_device_unittest.py:
(IOSDeviceTest.test_tailspin): Changed spindump tests (inc. below) to test for tailspin instead
(IOSDeviceTest.test_sample_process.logging_run_command):
(IOSDeviceTest.test_sample_process_exception.throwing_run_command):
(IOSDeviceTest.test_spindump): Deleted.
(IOSDeviceTest.test_spindump.logging_run_command): Deleted.

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

4 months agoProtect frames during style and layout changes
bfulgham@apple.com [Tue, 28 May 2019 21:02:38 +0000 (21:02 +0000)]
Protect frames during style and layout changes
https://bugs.webkit.org/show_bug.cgi?id=198047
<rdar://problem/50954082>

Reviewed by Zalan Bujtas.

Be more careful about the scope and lifetime of objects that participate in layout or
style updates. If a method decides a layout or style update is needed, it needs to
confirm that the elements it was operating on are still valid and needed in the
current operation.

Source/WebCore:

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::getOrCreate):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityHitTest const):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
* css/CSSComputedStyleDeclaration.h:
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::svgPropertyValue):
* dom/Document.cpp:
(WebCore::Document::setFocusedElement):
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::insertTextRunWithoutNewlines):
(WebCore::TypingCommand::insertLineBreak):
(WebCore::TypingCommand::insertParagraphSeparator):
(WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
* editing/ios/EditorIOS.mm:
(WebCore::Editor::setDictationPhrasesAsChildOfElement):
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::focus):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::appendFormData):
* html/ImageDocument.cpp:
(WebCore::ImageDocument::imageClicked):
* html/ValidationMessage.cpp:
(WebCore::ValidationMessage::buildBubbleTree):
* page/FrameView.cpp:
(WebCore::FrameView::autoSizeIfEnabled):
(WebCore::FrameView::trackedRepaintRectsAsText const):
* page/PrintContext.cpp:
(WebCore::PrintContext::pageProperty):
(WebCore::PrintContext::numberOfPages):
(WebCore::PrintContext::spoolAllPagesWithBoundaries):

Source/WebKitLegacy/mac:

* DOM/DOM.mm:
(-[DOMRange renderedImageForcingBlackText:renderedImageForcingBlackText:]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView _selectionDraggingImage]):
(-[WebHTMLView selectionImageForcingBlackText:selectionImageForcingBlackText:]):

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

4 months agoRemove dead code from sandboxes
bfulgham@apple.com [Tue, 28 May 2019 19:29:25 +0000 (19:29 +0000)]
Remove dead code from sandboxes
https://bugs.webkit.org/show_bug.cgi?id=198300

Reviewed by Alexey Proskuryakov.

SSIA.

* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

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

4 months agoREGRESSION (r244182): inspector/canvas/recording-webgl-snapshots.html became flaky...
drousso@apple.com [Tue, 28 May 2019 19:10:23 +0000 (19:10 +0000)]
REGRESSION (r244182): inspector/canvas/recording-webgl-snapshots.html became flaky on WK1
https://bugs.webkit.org/show_bug.cgi?id=196875
<rdar://problem/49873252>

Reviewed by Said Abou-Hallawa.

Remove the `frameLimit` configuration on these tests, as they're short enough that when
running in debug, the timing between the `InspectorCanvasAgent` automatically stopping the
recording and the test page's `LastFrame` event (which will manually stop the recording) is
too close and can result in a race condition.

Instead, just wait for the test page to say "done" (`LastFrame`) before stopping the
recording, ensuring that the full "flow" of the recording is under the control of the test.

This isn't an issue when using Web Inspector "normally" (e.g. not in a test), because the
frontend UI will "ignore" these types of errors, not to mention it would be much harder for
a person to get the timing just right to even encounter this situation.

* inspector/canvas/recording-webgl-snapshots.html:
* inspector/canvas/recording-webgl2-snapshots.html:
* platform/mac/TestExpectations:

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

4 months ago[Pointer Events WPT] Unflake imported/w3c/web-platform-tests/pointerevents/pointereve...
commit-queue@webkit.org [Tue, 28 May 2019 19:08:21 +0000 (19:08 +0000)]
[Pointer Events WPT] Unflake imported/w3c/web-platform-tests/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html
https://bugs.webkit.org/show_bug.cgi?id=197008

Patch by Antoine Quint <graouts@apple.com> on 2019-05-28
Reviewed by Jon Lee.

We raised an issue on the WPT test which was testing the event timestamp in an invalid manner (see https://github.com/w3c/pointerevents/issues/284
and https://github.com/web-platform-tests/wpt/issues/170160). As a result this test now passes reliably, so we can update the expected out and
the TestExpectations.

LayoutTests/imported/w3c:

* web-platform-tests/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse-expected.txt:
* web-platform-tests/pointerevents/pointerevent_suppress_compat_events_on_drag_mouse.html:

LayoutTests:

* platform/mac/TestExpectations:

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

4 months agowebkitpy: Using sudo on iOS device during timeout spindumps
commit-queue@webkit.org [Tue, 28 May 2019 19:06:18 +0000 (19:06 +0000)]
webkitpy: Using sudo on iOS device during timeout spindumps
https://bugs.webkit.org/show_bug.cgi?id=198142

Patch by David Xiong <w_xiong@apple.com> on 2019-05-28
Reviewed by Jonathan Bedard.

* Scripts/webkitpy/port/darwin.py:
(DarwinPort.sample_process): Check target host instead of source host for sudo command.

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

4 months ago[async scrolling] Fixed positioning inside stacking context overflow scroll is jumpy
antti@apple.com [Tue, 28 May 2019 18:11:52 +0000 (18:11 +0000)]
[async scrolling] Fixed positioning inside stacking context overflow scroll is jumpy
https://bugs.webkit.org/show_bug.cgi?id=198292

Reviewed by Darin Adler.

Source/WebCore:

Tests: scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll-2.html
       scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll.html

We were computing delta from the layout scroll position in ScrollingTree::notifyRelatedNodesAfterScrollPositionChange
based on the passed in node only. If any other node had deltas they were not taken into account at all. This would occur
frequently since the function is always invoked for the root node after layer tree commit.

Fix by moving the delta computation (and fetching layoutViewport) to ScrollingTreeFixedNode.

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::applyLayerPositions):

No need to pass offset and layoutViewport around anymore.

(WebCore::ScrollingTree::applyLayerPositionsRecursive):
(WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):

Remove the offset and layoutViewport computations.

(WebCore::ScrollingTree::notifyRelatedNodesRecursive):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeFrameHostingNode.cpp:
(WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
* page/scrolling/ScrollingTreeFrameHostingNode.h:
* page/scrolling/ScrollingTreeNode.cpp:
(WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/cocoa/ScrollingTreeFixedNode.h:
* page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::applyLayerPositions):

Compute them here instead, always taking all overflow scrollers up to the closest frame into account.

* page/scrolling/cocoa/ScrollingTreePositionedNode.h:
* page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
(WebCore::ScrollingTreePositionedNode::applyLayerPositions):
(WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
* page/scrolling/cocoa/ScrollingTreeStickyNode.h:
* page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::applyLayerPositions):

LayoutTests:

* scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll-2-expected.html: Added.
* scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll-2.html: Added.
* scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll-expected.html: Added.
* scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll.html: Added.

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

4 months agoUpdate sandbox rules for more News use cases
bfulgham@apple.com [Tue, 28 May 2019 17:33:58 +0000 (17:33 +0000)]
Update sandbox rules for more News use cases
https://bugs.webkit.org/show_bug.cgi?id=198236
<rdar://problem/50054027>

Reviewed by Alexey Proskuryakov.

Update the WebContent and Network process sandboxes so that News has the same set of allowed
service access as regular WebKit views.

* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

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

4 months ago[LFC][Verification] Add additional inline and block checks
zalan@apple.com [Tue, 28 May 2019 17:29:33 +0000 (17:29 +0000)]
[LFC][Verification] Add additional inline and block checks
https://bugs.webkit.org/show_bug.cgi?id=198252
<rdar://problem/51140687>

Reviewed by Antti Koivisto.

Now we also test the geometry of the blocks with inline formatting contexts.

* layout/Verification.cpp:
(WebCore::Layout::checkForMatchingTextRuns):
(WebCore::Layout::verifyAndOutputSubtree):

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

4 months ago[YARR] Properly handle RegExp's that require large ParenContext space
msaboff@apple.com [Tue, 28 May 2019 17:19:09 +0000 (17:19 +0000)]
[YARR] Properly handle RegExp's that require large ParenContext space
https://bugs.webkit.org/show_bug.cgi?id=198065

Reviewed by Keith Miller.

JSTests:

New test.

* stress/regexp-large-paren-context.js: Added.
(testLargeRegExp):

Source/JavaScriptCore:

Changed what happens when we exceed VM::patternContextBufferSize when compiling a RegExp
that needs ParenCOntextSpace to fail the RegExp JIT compilation and fall back to the YARR
interpreter.  This can save large amounts of JIT memory for a
JIT'ed function that cannot ever succeed.

* yarr/YarrJIT.cpp:
(JSC::Yarr::YarrGenerator::initParenContextFreeList):
(JSC::Yarr::YarrGenerator::compile):

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

4 months ago[ews-build] Remove unused buildbot tabs
aakash_jain@apple.com [Tue, 28 May 2019 17:09:01 +0000 (17:09 +0000)]
[ews-build] Remove unused buildbot tabs
https://bugs.webkit.org/show_bug.cgi?id=198108

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/templates/build.jade: Removed unused 'Changes' and 'Responsible Users' tabs.

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

4 months agoJITOperations putByVal should mark negative array indices as out-of-bounds
tzagallo@apple.com [Tue, 28 May 2019 16:03:02 +0000 (16:03 +0000)]
JITOperations putByVal should mark negative array indices as out-of-bounds
https://bugs.webkit.org/show_bug.cgi?id=198271

Reviewed by Saam Barati.

JSTests:

* microbenchmarks/get-by-val-negative-array-index.js:
(foo):
Update the getByVal microbenchmark added in r245769. This now shows that r245769
is 4.2x faster than the previous commit.

* microbenchmarks/put-by-val-negative-array-index.js: Added.
(foo):

Source/JavaScriptCore:

Similar to what was done to getByVal in r245769, we should also mark put_by_val as out-of-bounds
when we exit from DFG for putting to a negative index. This avoids the same scenario where we keep
recompiling a CodeBlock with DFG and exiting at the same bytecode.

This is a 3.7x improvement in the microbenchmark being added: put-by-val-negative-array-index.js.

* jit/JITOperations.cpp:

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

4 months ago[LFC][IFC] Decouple line layout and processing inline runs.
zalan@apple.com [Tue, 28 May 2019 15:36:04 +0000 (15:36 +0000)]
[LFC][IFC] Decouple line layout and processing inline runs.
https://bugs.webkit.org/show_bug.cgi?id=198282
<rdar://problem/51167954>

Reviewed by Antti Koivisto.

This is in preparation for using "createInlineRunsForLine" logic when computing preferred width.

* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::UncommittedContent::size const):
(WebCore::Layout::InlineFormattingContext::LineLayout::createInlineRunsForLine const):
(WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
(WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
(WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const): Deleted.
* layout/inlineformatting/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::addInlineItem):
* layout/inlineformatting/InlineTextItem.cpp:
(WebCore::Layout::InlineTextItem::createAndAppendTextItems):

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

4 months ago[LFC][IFC] Move intrinsic width computation from InlineFormattingContext to LineLayout
zalan@apple.com [Tue, 28 May 2019 14:51:16 +0000 (14:51 +0000)]
[LFC][IFC] Move intrinsic width computation from InlineFormattingContext to LineLayout
https://bugs.webkit.org/show_bug.cgi?id=198258

Reviewed by Antti Koivisto.

This is in preparation for sharing even more code between line layout and preferred width computation.

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layout const):
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
(WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
(WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
(WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):

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

4 months ago[LFC[IFC] Ignore the initial strut's height when the line does not have any content.
zalan@apple.com [Tue, 28 May 2019 14:48:57 +0000 (14:48 +0000)]
[LFC[IFC] Ignore the initial strut's height when the line does not have any content.
https://bugs.webkit.org/show_bug.cgi?id=198268
<rdar://problem/51150057>

Reviewed by Antti Koivisto.

The strut (https://www.w3.org/TR/CSS22/visudet.html#leading) defines the initial logical height
for the line. This height should be ignored though when the line does not have any content.

* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):

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