WebKit.git
2 years agoAssemblyHelpers should not have a VM field
sbarati@apple.com [Wed, 29 Mar 2017 06:15:23 +0000 (06:15 +0000)]
AssemblyHelpers should not have a VM field
https://bugs.webkit.org/show_bug.cgi?id=170207

Reviewed by Yusuke Suzuki.

APIs that need VM should take one as a parameter. When doing position
independent code for Wasm, we can't tie code generation to a VM.

* b3/B3Compile.cpp:
(JSC::B3::compile):
* b3/air/testair.cpp:
* b3/testb3.cpp:
(JSC::B3::testEntrySwitchSimple):
(JSC::B3::testEntrySwitchNoEntrySwitch):
(JSC::B3::testEntrySwitchWithCommonPaths):
(JSC::B3::testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint):
(JSC::B3::testEntrySwitchLoop):
* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateWithGuard):
(JSC::AccessCase::generateImpl):
* bytecode/DOMJITAccessCasePatchpointParams.cpp:
(JSC::SlowPathCallGeneratorWithArguments::generateImpl):
* bytecode/InlineAccess.cpp:
(JSC::InlineAccess::dumpCacheSizesAndCrash):
(JSC::InlineAccess::generateSelfPropertyAccess):
(JSC::InlineAccess::generateSelfPropertyReplace):
(JSC::InlineAccess::generateArrayLength):
(JSC::InlineAccess::rewireStubAsJump):
* bytecode/InlineAccess.h:
* bytecode/PolymorphicAccess.cpp:
(JSC::AccessGenerationState::emitExplicitExceptionHandler):
(JSC::PolymorphicAccess::regenerate):
* bytecode/PolymorphicAccess.h:
(JSC::AccessGenerationState::AccessGenerationState):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::compileExceptionHandlers):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):
(JSC::DFG::JITCompiler::exceptionCheck):
* dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::exceptionCheckWithCallFrameRollback):
(JSC::DFG::JITCompiler::fastExceptionCheck):
(JSC::DFG::JITCompiler::vm):
* dfg/DFGOSRExitCompiler.cpp:
* dfg/DFGOSRExitCompiler.h:
* dfg/DFGOSRExitCompiler32_64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGOSRExitCompiler64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::adjustAndJumpToTarget):
* dfg/DFGOSRExitCompilerCommon.h:
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::emitAllocateRawObject):
(JSC::DFG::SpeculativeJIT::checkArray):
(JSC::DFG::SpeculativeJIT::compileCurrentBlock):
(JSC::DFG::SpeculativeJIT::compileInstanceOfForObject):
(JSC::DFG::SpeculativeJIT::compileMakeRope):
(JSC::DFG::SpeculativeJIT::compileGetGlobalObject):
(JSC::DFG::SpeculativeJIT::compileNewFunctionCommon):
(JSC::DFG::SpeculativeJIT::compileCreateActivation):
(JSC::DFG::SpeculativeJIT::compileCreateDirectArguments):
(JSC::DFG::SpeculativeJIT::compileSpread):
(JSC::DFG::SpeculativeJIT::compileArraySlice):
(JSC::DFG::SpeculativeJIT::compileNukeStructureAndSetButterfly):
(JSC::DFG::SpeculativeJIT::compileNewStringObject):
(JSC::DFG::SpeculativeJIT::compileNewTypedArray):
(JSC::DFG::SpeculativeJIT::compileStoreBarrier):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::emitAllocateJSObjectWithKnownSize):
(JSC::DFG::SpeculativeJIT::emitAllocateJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateVariableSizedJSObject):
(JSC::DFG::SpeculativeJIT::emitAllocateDestructibleObject):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNullOrUndefined):
(JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNullOrUndefined):
(JSC::DFG::SpeculativeJIT::emitCall):
(JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot):
(JSC::DFG::SpeculativeJIT::compileLogicalNot):
(JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch):
(JSC::DFG::SpeculativeJIT::emitBranch):
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize):
* dfg/DFGThunks.cpp:
(JSC::DFG::osrEntryThunkGenerator):
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLJITFinalizer.h:
* ftl/FTLLazySlowPath.cpp:
(JSC::FTL::LazySlowPath::generate):
* ftl/FTLLazySlowPathCall.h:
(JSC::FTL::createLazyCallGenerator):
* ftl/FTLLink.cpp:
(JSC::FTL::link):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateActivation):
(JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
(JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments):
(JSC::FTL::DFG::LowerDFGToB3::compileNewTypedArray):
(JSC::FTL::DFG::LowerDFGToB3::compileMakeRope):
(JSC::FTL::DFG::LowerDFGToB3::compileNotifyWrite):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileCallEval):
(JSC::FTL::DFG::LowerDFGToB3::compileIsObjectOrNull):
(JSC::FTL::DFG::LowerDFGToB3::compileIsFunction):
(JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject):
(JSC::FTL::DFG::LowerDFGToB3::compileMaterializeCreateActivation):
(JSC::FTL::DFG::LowerDFGToB3::compileCheckTraps):
(JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl):
(JSC::FTL::DFG::LowerDFGToB3::allocateObject):
(JSC::FTL::DFG::LowerDFGToB3::allocateJSArray):
(JSC::FTL::DFG::LowerDFGToB3::buildTypeOf):
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* ftl/FTLSlowPathCall.h:
(JSC::FTL::callOperation):
* ftl/FTLState.h:
(JSC::FTL::State::vm):
* ftl/FTLThunks.cpp:
(JSC::FTL::genericGenerationThunkGenerator):
(JSC::FTL::slowPathCallThunkGenerator):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::jitReleaseAssertNoException):
(JSC::AssemblyHelpers::callExceptionFuzz):
(JSC::AssemblyHelpers::emitJumpIfException):
(JSC::AssemblyHelpers::emitExceptionCheck):
(JSC::AssemblyHelpers::emitNonPatchableExceptionCheck):
(JSC::AssemblyHelpers::emitLoadStructure):
(JSC::AssemblyHelpers::emitRandomThunk):
(JSC::AssemblyHelpers::restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::emitConvertValueToBoolean):
(JSC::AssemblyHelpers::debugCall):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::AssemblyHelpers):
(JSC::AssemblyHelpers::codeBlock):
(JSC::AssemblyHelpers::copyCalleeSavesToVMEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::copyCalleeSavesFromFrameOrRegisterToVMEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::barrierBranch):
(JSC::AssemblyHelpers::barrierStoreLoadFence):
(JSC::AssemblyHelpers::mutatorFence):
(JSC::AssemblyHelpers::storeButterfly):
(JSC::AssemblyHelpers::nukeStructureAndStoreButterfly):
(JSC::AssemblyHelpers::jumpIfMutatorFenceNotNeeded):
(JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize):
(JSC::AssemblyHelpers::emitAllocateJSObject):
(JSC::AssemblyHelpers::emitAllocateVariableSizedCell):
(JSC::AssemblyHelpers::emitAllocateVariableSizedJSObject):
(JSC::AssemblyHelpers::emitAllocateDestructibleObject):
(JSC::AssemblyHelpers::vm): Deleted.
(JSC::AssemblyHelpers::debugCall): Deleted.
* jit/CCallHelpers.cpp:
(JSC::CCallHelpers::ensureShadowChickenPacket):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::CCallHelpers):
(JSC::CCallHelpers::jumpToExceptionHandler):
* jit/JIT.cpp:
(JSC::JIT::emitEnterOptimizationCheck):
(JSC::JIT::privateCompileExceptionHandlers):
* jit/JIT.h:
(JSC::JIT::exceptionCheck):
(JSC::JIT::exceptionCheckWithCallFrameRollback):
* jit/JITMathIC.h:
(JSC::JITMathIC::generateOutOfLine):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emit_op_is_undefined):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jeq_null):
(JSC::JIT::emit_op_jneq_null):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_throw):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_eq_null):
(JSC::JIT::emit_op_neq_null):
(JSC::JIT::emitSlow_op_loop_hint):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTINativeCall):
(JSC::JIT::emit_op_new_object):
(JSC::JIT::emit_op_jfalse):
(JSC::JIT::emit_op_jtrue):
(JSC::JIT::emit_op_throw):
(JSC::JIT::emit_op_catch):
(JSC::JIT::emit_op_create_this):
(JSC::JIT::emit_op_log_shadow_chicken_prologue):
(JSC::JIT::emit_op_log_shadow_chicken_tail):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::emitWriteBarrier):
* jit/JSInterfaceJIT.h:
(JSC::JSInterfaceJIT::JSInterfaceJIT):
(JSC::JSInterfaceJIT::vm):
* jit/Repatch.cpp:
(JSC::tryCacheGetByID):
(JSC::tryCachePutByID):
(JSC::linkPolymorphicCall):
(JSC::resetGetByID):
(JSC::resetPutByID):
* jit/SetupVarargsFrame.cpp:
(JSC::emitSetupVarargsFrameFastCase):
* jit/SetupVarargsFrame.h:
* jit/SpecializedThunkJIT.h:
(JSC::SpecializedThunkJIT::loadArgumentWithSpecificClass):
* jit/ThunkGenerators.cpp:
(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::linkCallThunkGenerator):
(JSC::linkPolymorphicCallThunkGenerator):
(JSC::virtualThunkFor):
(JSC::nativeForGenerator):
(JSC::randomThunkGenerator):
(JSC::boundThisNoArgsFunctionCallGenerator):
(JSC::throwExceptionFromWasmThunkGenerator):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::parseAndCompile):
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs):
(JSC::Wasm::wasmToWasm):

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

2 years agoFix `index-expected.txt` for dashboard test results.
jmarcell@apple.com [Wed, 29 Mar 2017 06:07:26 +0000 (06:07 +0000)]
Fix `index-expected.txt` for dashboard test results.
https://bugs.webkit.org/show_bug.cgi?id=170214

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/index-expected.txt:

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

2 years agoWebAssembly: We should have Origins
keith_miller@apple.com [Wed, 29 Mar 2017 05:32:45 +0000 (05:32 +0000)]
WebAssembly: We should have Origins
https://bugs.webkit.org/show_bug.cgi?id=170217

Reviewed by Mark Lam.

This patch adds wasm origins for B3::Values, called OpcodeOrigin. Currently,
OpcodeOrigin just tracks the original opcode and the location of that opcode.

Here's a sample:

BB#0: ; frequency = 1.000000
    Int64 @4 = Patchpoint(generator = 0x10f487fa8, earlyClobbered = [], lateClobbered = [], usedRegisters = [], resultConstraint = SomeRegister)
    Int64 @5 = FramePointer()
    Void @8 = Store(@4, @5, offset = 24, ControlDependent|Writes:Top)
    Int64 @10 = Const64(0)
    Void @12 = Store($0(@10), @5, offset = 16, ControlDependent|Writes:Top)
    Int64 @13 = Patchpoint(generator = 0x10f4be7f0, earlyClobbered = [], lateClobbered = [], usedRegisters = [], resultConstraint = SomeRegister, ExitsSideways|ControlDependent|WritesPinned|ReadsPinned|Fence|Writes:Top|Reads:Top)
    Int64 @16 = ArgumentReg(%rdi)
    Int64 @18 = ArgumentReg(%rsi)
    Int32 @22 = Trunc(@18, Wasm: {opcode: I64Rotl, location: 5})
    Int64 @23 = RotL(@16, @22, Wasm: {opcode: I64Rotl, location: 5})
    Void @27 = Return(@23, Terminal, Wasm: {opcode: End, location: 6})

* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/B3Value.cpp:
(JSC::B3::Value::deepDump):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::setParser):
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
(JSC::Wasm::B3IRGenerator::emitLoadOp):
(JSC::Wasm::B3IRGenerator::emitStoreOp):
(JSC::Wasm::B3IRGenerator::addConstant):
(JSC::Wasm::B3IRGenerator::addLoop):
(JSC::Wasm::B3IRGenerator::unify):
(JSC::Wasm::parseAndCompile):
(JSC::Wasm::B3IRGenerator::emitChecksForModOrDiv):
(JSC::Wasm::getMemoryBaseAndSize): Deleted.
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser::currentOpcode):
(JSC::Wasm::FunctionParser::currentOpcodeStartingOffset):
(JSC::Wasm::FunctionParser<Context>::FunctionParser):
* wasm/WasmOpcodeOrigin.cpp: Added.
(JSC::Wasm::OpcodeOrigin::dump):
* wasm/WasmOpcodeOrigin.h: Added.
(JSC::Wasm::OpcodeOrigin::OpcodeOrigin):
* wasm/WasmValidate.cpp:
(JSC::Wasm::Validate::setParser):
* wasm/generateWasmB3IRGeneratorInlinesHeader.py:
(CodeGenerator.generate):
(generateB3OpCode):
(generateConstCode):

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

2 years ago[WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dicti...
commit-queue@webkit.org [Wed, 29 Mar 2017 04:09:14 +0000 (04:09 +0000)]
[WebRTC] After r214441 addIceCandidate no longer accepts an RTCIceCandidateInit dictionary
https://bugs.webkit.org/show_bug.cgi?id=170192

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28
Reviewed by Jon Lee.

Source/WebCore:

Covered by updated tests.

* Modules/mediastream/RTCIceCandidate.idl: Candidate is no longer a required field in RTCIceCandidateInit.
* Modules/mediastream/RTCPeerConnectionInternals.js: Reworking defaultsToNull to handle both undefined and null cases.

LayoutTests:

* fast/mediastream/RTCIceCandidate-expected.txt:
* fast/mediastream/RTCIceCandidate.html: Removing no longer valid tests.
* fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-addIceCandidate.html: Adding more tests to cover null/undefined cases.
Ensuring sdpMid has a valid value.
* fast/mediastream/resources/promise-utils.js: Improving error logging.

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

2 years agoWebAssembly: option to crash if no fast memory is available
jfbastien@apple.com [Wed, 29 Mar 2017 04:02:17 +0000 (04:02 +0000)]
WebAssembly: option to crash if no fast memory is available
https://bugs.webkit.org/show_bug.cgi?id=170219

Reviewed by Mark Lam.

* runtime/Options.h:
* wasm/WasmMemory.cpp:
(JSC::Wasm::webAssemblyCouldntGetFastMemory):
(JSC::Wasm::tryGetFastMemory):

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

2 years agoLibWebRTCProvider should allow setting encoder and decoder factories
commit-queue@webkit.org [Wed, 29 Mar 2017 03:51:20 +0000 (03:51 +0000)]
LibWebRTCProvider should allow setting encoder and decoder factories
https://bugs.webkit.org/show_bug.cgi?id=170212

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28
Reviewed by Eric Carlson.

No change of behavior.
Adding the ability to set encoder/decoder libwebrtc factory getters.
Setting default cocoa factory getters.

* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::staticFactoryAndThreads):
(WebCore::initializePeerConnectionFactoryAndThreads):
(WebCore::LibWebRTCProvider::setDecoderFactoryGetter):
(WebCore::LibWebRTCProvider::setEncoderFactoryGetter):
(WebCore::LibWebRTCProvider::setPeerConnectionFactory):
* platform/mediastream/libwebrtc/LibWebRTCProvider.h:

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

2 years agoWeb Inspector: RTL: keyboard shortcuts with directionality need to be flipped (forwar...
bburg@apple.com [Wed, 29 Mar 2017 01:56:16 +0000 (01:56 +0000)]
Web Inspector: RTL: keyboard shortcuts with directionality need to be flipped (forward/back, etc)
https://bugs.webkit.org/show_bug.cgi?id=165761

Reviewed by Matt Baker.

Original patch by Devin Rousso.

* UserInterface/Views/ContentBrowser.js:
(WebInspector.ContentBrowser):
* UserInterface/Views/TabBrowser.js:
(WebInspector.TabBrowser):
Flip the functionality of keyboard shortcuts when in RTL so that the action of
pressing the left or right arrows/curly braces matches what happens when the
corresponding left or right buttons are clicked.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype._keyDown):
* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView.prototype._keyDown):
* UserInterface/Views/TreeOutline.js:
(WebInspector.TreeOutline.prototype._treeKeyDown):
Flip the Left and Right keyboard shortcuts to expand/collapse the selected item when in RTL.

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

2 years agoBot watcher's dashboard has separate settings for "mac" and "macos"
ap@apple.com [Wed, 29 Mar 2017 01:32:01 +0000 (01:32 +0000)]
Bot watcher's dashboard has separate settings for "mac" and "macos"
https://bugs.webkit.org/show_bug.cgi?id=170164

Reviewed by Tim Horton.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Settings.js:
(Settings.prototype.parsePlatformFamily): Aded a special case for "macos".

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

2 years agoFix dashboard test results on the dashboard
ap@apple.com [Wed, 29 Mar 2017 01:31:29 +0000 (01:31 +0000)]
Fix dashboard test results on the dashboard
https://bugs.webkit.org/show_bug.cgi?id=170158

Reviewed by Tim Horton.

Link to result diff instead of stdio. Looking at the diff, I wonder if it can be
further improved, as it's not super readable, but stdio is entirely useless in this context.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Buildbot.js:
(Buildbot.prototype.dashboardTestResultsURLForIteration): Generate formatted diff link.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
Fixed a typo in step name, so that it's actually treated as productive.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTesterQueueView.js:
(BuildbotTesterQueueView.prototype.appendBuilderQueueStatus):
(BuildbotTesterQueueView.prototype.update):
(BuildbotTesterQueueView.prototype._presentPopoverForGenericTestFailures):
Added special handling for dashboard test results.

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

2 years agoStop overriding scroll view inset defaults
timothy_horton@apple.com [Wed, 29 Mar 2017 01:14:49 +0000 (01:14 +0000)]
Stop overriding scroll view inset defaults
https://bugs.webkit.org/show_bug.cgi?id=170221
<rdar://problem/31260325>

Reviewed by Simon Fraser.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
The default behavior is sufficient for us.

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

2 years agoOnly attach Attributes to a given element one time
bfulgham@apple.com [Wed, 29 Mar 2017 01:00:09 +0000 (01:00 +0000)]
Only attach Attributes to a given element one time
https://bugs.webkit.org/show_bug.cgi?id=170125
<rdar://problem/31279676>

Reviewed by Chris Dumez.

Source/WebCore:

Attach the attribute node to the Element before calling 'setAttributeInternal', since that method may cause
arbitrary JavaScript events to fire.

Test: fast/dom/Attr/only-attach-attr-once.html

* dom/Element.cpp:
(WebCore::Element::attachAttributeNodeIfNeeded): Added.
(WebCore::Element::setAttributeNode): Use new method. Revise to attach attribute before calling 'setAttributeInternal'.
(WebCore::Element::setAttributeNodeNS): Ditto.
* dom/Element.h:

LayoutTests:

* fast/dom/Attr/make-unique-element-data-while-replacing-attr-expected.txt: Rebaselined.
* fast/dom/Attr/make-unique-element-data-while-replacing-attr.html: Add check before setting new value.
* fast/dom/Attr/only-attach-attr-once-expected.txt: Added.
* fast/dom/Attr/only-attach-attr-once.html: Added.

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

2 years agoThe Mutator should not be able to steal the conn if the Collector hasn't reached...
mark.lam@apple.com [Wed, 29 Mar 2017 00:43:09 +0000 (00:43 +0000)]
The Mutator should not be able to steal the conn if the Collector hasn't reached the NotRunning phase yet.
https://bugs.webkit.org/show_bug.cgi?id=170213
<rdar://problem/30755345>

Reviewed by Filip Pizlo.

The current condition for stealing the conn isn't tight enough.  Restricting the
stealing to when m_currentPhase == NotRunning ensures that the Collector is
really done running.

No test because this issue only manifests with a race condition that is difficult
to reproduce on demand.

* heap/Heap.cpp:
(JSC::Heap::requestCollection):

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

2 years agoStop RTCDataChannel when closing page
commit-queue@webkit.org [Wed, 29 Mar 2017 00:06:11 +0000 (00:06 +0000)]
Stop RTCDataChannel when closing page
https://bugs.webkit.org/show_bug.cgi?id=170166

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28
Reviewed by Eric Carlson.

Source/WebCore:

Test: webrtc/datachannel/datachannel-gc.html

Making RTCDataChannel an ActiveDOMObject.
Closing the data channel backend and freeing upon close and stop.

* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::create):
(WebCore::RTCDataChannel::RTCDataChannel):
(WebCore::RTCDataChannel::close):
(WebCore::RTCDataChannel::stop):
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCPeerConnection.h:

LayoutTests:

* webrtc/datachannel/datachannel-gc-expected.txt: Added.
* webrtc/datachannel/datachannel-gc.html: Added.

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

2 years agoRanges for variation font properties are not enforced
mmaxfield@apple.com [Tue, 28 Mar 2017 23:53:28 +0000 (23:53 +0000)]
Ranges for variation font properties are not enforced
https://bugs.webkit.org/show_bug.cgi?id=169979

Reviewed by David Hyatt.

Source/WebCore:

The spec specifies that:
- Font weights less than or equal to 0, or greater than or equal to 1000 are parse errors
- Font stretch values less than or equal to 0% are parse errors
- Font style values less than or equal to -90deg or greater than or equal to 90deg are parse errors

Test: fast/text/variations/out-of-bounds-selection-properties.html

* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeFontWeightRange):
(WebCore::fontStretchIsWithinRange):
(WebCore::consumeFontStretch):
(WebCore::consumeFontStretchRange):
(WebCore::fontStyleIsWithinRange):
(WebCore::consumeFontStyle):
(WebCore::consumeFontStyleRange):

LayoutTests:

* fast/text/font-selection-font-face-parse-expected.txt:
* fast/text/font-selection-font-face-parse.html:
* fast/text/font-selection-font-loading-api-parse-expected.txt:
* fast/text/font-selection-font-loading-api-parse.html:
* fast/text/font-style-parse-expected.txt:
* fast/text/font-style-parse.html:
* fast/text/variations/font-loading-api-parse-ranges-expected.txt:
* fast/text/variations/font-loading-api-parse-ranges.html:
* fast/text/variations/out-of-bounds-selection-properties-expected.txt: Added.
* fast/text/variations/out-of-bounds-selection-properties.html: Added.
* platform/mac-elcapitan/fast/text/font-selection-font-face-parse-expected.txt:

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

2 years ago[iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy...
aestes@apple.com [Tue, 28 Mar 2017 23:50:55 +0000 (23:50 +0000)]
[iOS] Crash in -[WebPreviewLoader failed] when running http/tests/multipart/policy-ignore-crash.php
https://bugs.webkit.org/show_bug.cgi?id=170197
<rdar://problem/30314067>

Reviewed by Brady Eidson.

Source/WebCore:

If QuickLook conversion fails, we call ResourceLoader::didFail() with the NSError from
QuickLook, which will call back into PreviewLoader::didFail(). We only care about network
failures in PreviewLoader, not conversion failures, so check if
m_finishedLoadingDataIntoConverter is set before continuing (like we do in
PreviewLoader::didFinishLoading()).

Fixes crash in http/tests/multipart/policy-ignore-crash.php.

* loader/ios/PreviewLoader.mm:
(WebCore::PreviewLoader::didFail):

LayoutTests:

* platform/ios/TestExpectations: Unskipped http/tests/multipart/policy-ignore-crash.php.
* platform/ios/http/tests/multipart/policy-ignore-crash-expected.txt: Added an iOS-specific result.

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

2 years agoAudio indicator is visible on uni-watch.com but there is no audible audio
cdumez@apple.com [Tue, 28 Mar 2017 23:12:45 +0000 (23:12 +0000)]
Audio indicator is visible on uni-watch.com but there is no audible audio
https://bugs.webkit.org/show_bug.cgi?id=170200
<rdar://problem/31289132>

Reviewed by Eric Carlson.

Cherry-pick the following patch from Blink by <rtoy@chromium.org>:
- https://chromium.googlesource.com/chromium/src.git/+/439de5bb2a31384666db1a0e2dadb2b97d2f3ce4

When the gain of a GainNode is 0 or 1, the operation of the node can
be optimized.  When gain = 1, just copy the input to the output.  When
gain = 0; just zero out the output.  Currently, the input is
multiplied by the gain to produce the output.  This just optimizes the
multiplication away for the two special cases.

Also, have the GainNode set the silence hint if the gain is 0.

And fix a bug in processIfNecessary when unsilenceOutputs was causing the
silence hint to be cleared after the node's process method was finished
and may have set the silence hint.  The processing should come after
unsilenceOutputs to preserve any hints from processing the node.

* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::processIfNecessary):
* Modules/webaudio/GainNode.cpp:
(WebCore::GainNode::process):
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::copyWithGainFrom):

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

2 years agoWebAssembly: Make WebAssembly.instantiate/compile truly asynchronous
keith_miller@apple.com [Tue, 28 Mar 2017 23:12:11 +0000 (23:12 +0000)]
WebAssembly: Make WebAssembly.instantiate/compile truly asynchronous
https://bugs.webkit.org/show_bug.cgi?id=169187

Reviewed by Saam Barati.

JSTests:

* wasm/assert.js:
* wasm/js-api/Module-compile.js:
(async.testPromiseAPI):
* wasm/js-api/web-assembly-compile-parallel.js: Added.
(async.throwExn):
(async.test):
* wasm/js-api/web-assembly-instantiate-parallel.js: Added.
(async.test):
* wasm/js-api/web-assembly-instantiate.js:
(assert.eq.async.test):
(assert.eq):
(assert.asyncTest.async.test):
(assert.asyncTest):
(assert.truthy.async.test): Deleted.
(assert.truthy): Deleted.

Source/JavaScriptCore:

This patch allows WebAssembly compilations to happen asynchronously.
To do so, it refactors how much of the compilation happens and adds
new infrastructure for async promises.

First, there is a new class, PromiseDeferredTimer that lives on
the VM.  PromiseDeferredTimer will manage the life-cycle of async
pending promises and any dependencies that promise
needs. PromiseDeferredTimer automagically releases the pending
promise and dependencies once the JSPromiseDeferred is resolved or
rejected. Additionally, PromiseDeferredTimer provides a mechanism
to poll the run-loop whenever the async task needs to synchronize
with the JS thread. Normally, that will be whenever the async task
finishes. In the case of Web Assembly we also use this feature for
the compile + instantiate case, where we might have more work
after the first async task completes (more on that later).

The next class is Wasm::Worklist, which is used to manage Wasm
compilation tasks. The worklist class works similarly to the
DFG/FTL Worklists. It has a pool of threads that it manages. One
interesting aspect of Wasm Worklist is that it can synchronously
compile a plan that is already potentially running
asynchronously. This can occur if a user calls
WebAssembly.instantiate() then new WebAssembly.instantiate() on
the same module. In that case the Wasm Worklist will bump the
priority of the running pending Plan and block the JS thread.

This patch also makes some of the Wasm Plan code cleaner. Since we
now defer all compilation to instantiation time, we no longer need
to guess at which memory we are going to get. Also, Wasm Plans now
track the work they have done with a state enum.

Finally, this patch makes renamed HeapTimer to JSRunLoopTimer. It
also adds changes test262AsyncTest to a more generic testing
infrastructure. Now, in addition to the old functionality, you can
call asyncTest() with the number of tests you expect. When the jsc
CLI exits, it will guarantee that asyncTestPassed() is called that
many times.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/GCActivityCallback.h:
* heap/IncrementalSweeper.cpp:
(JSC::IncrementalSweeper::scheduleTimer):
(JSC::IncrementalSweeper::IncrementalSweeper):
* heap/IncrementalSweeper.h:
* heap/StopIfNecessaryTimer.cpp:
(JSC::StopIfNecessaryTimer::StopIfNecessaryTimer):
* heap/StopIfNecessaryTimer.h:
* heap/StrongInlines.h:
* jsc.cpp:
(GlobalObject::finishCreation):
(printInternal):
(functionAsyncTestStart):
(functionAsyncTestPassed):
(functionTestWasmModuleFunctions):
(CommandLine::parseArguments):
(runJSC):
* runtime/JSPromiseDeferred.cpp:
(JSC::JSPromiseDeferred::resolve):
(JSC::JSPromiseDeferred::reject):
* runtime/JSPromiseDeferred.h:
(JSC::JSPromiseDeferred::promiseAsyncPending):
* runtime/JSRunLoopTimer.cpp: Renamed from Source/JavaScriptCore/heap/HeapTimer.cpp.
(JSC::JSRunLoopTimer::JSRunLoopTimer):
(JSC::JSRunLoopTimer::setRunLoop):
(JSC::JSRunLoopTimer::~JSRunLoopTimer):
(JSC::JSRunLoopTimer::timerDidFire):
(JSC::JSRunLoopTimer::scheduleTimer):
(JSC::JSRunLoopTimer::cancelTimer):
(JSC::JSRunLoopTimer::invalidate):
* runtime/JSRunLoopTimer.h: Copied from Source/JavaScriptCore/heap/HeapTimer.h.
* runtime/Options.h:
* runtime/PromiseDeferredTimer.cpp: Added.
(JSC::PromiseDeferredTimer::PromiseDeferredTimer):
(JSC::PromiseDeferredTimer::doWork):
(JSC::PromiseDeferredTimer::runRunLoop):
(JSC::PromiseDeferredTimer::addPendingPromise):
(JSC::PromiseDeferredTimer::cancelPendingPromise):
(JSC::PromiseDeferredTimer::scheduleWorkSoon):
(JSC::PromiseDeferredTimer::scheduleBlockedTask):
* runtime/PromiseDeferredTimer.h: Renamed from Source/JavaScriptCore/heap/HeapTimer.h.
(JSC::PromiseDeferredTimer::stopRunningTasks):
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::~VM):
* runtime/VM.h:
* wasm/JSWebAssembly.cpp:
(JSC::reject):
(JSC::webAssemblyCompileFunc):
(JSC::resolve):
(JSC::instantiate):
(JSC::compileAndInstantiate):
(JSC::webAssemblyInstantiateFunc):
(JSC::webAssemblyValidateFunc):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::emitCheckAndPreparePointer):
(JSC::Wasm::B3IRGenerator::memoryKind):
(JSC::Wasm::parseAndCompile):
* wasm/WasmB3IRGenerator.h:
* wasm/WasmFormat.h:
(JSC::Wasm::ModuleInformation::internalFunctionCount):
* wasm/WasmFunctionParser.h:
* wasm/WasmMemory.h:
* wasm/WasmMemoryInformation.cpp:
(JSC::Wasm::MemoryInformation::MemoryInformation):
* wasm/WasmMemoryInformation.h:
(JSC::Wasm::MemoryInformation::maximum):
(JSC::Wasm::MemoryInformation::hasReservedMemory): Deleted.
(JSC::Wasm::MemoryInformation::takeReservedMemory): Deleted.
(JSC::Wasm::MemoryInformation::mode): Deleted.
* wasm/WasmModuleParser.cpp:
* wasm/WasmModuleParser.h:
(JSC::Wasm::ModuleParser::ModuleParser):
* wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::Plan):
(JSC::Wasm::Plan::stateString):
(JSC::Wasm::Plan::moveToState):
(JSC::Wasm::Plan::fail):
(JSC::Wasm::Plan::parseAndValidateModule):
(JSC::Wasm::Plan::prepare):
(JSC::Wasm::Plan::ThreadCountHolder::ThreadCountHolder):
(JSC::Wasm::Plan::ThreadCountHolder::~ThreadCountHolder):
(JSC::Wasm::Plan::compileFunctions):
(JSC::Wasm::Plan::complete):
(JSC::Wasm::Plan::waitForCompletion):
(JSC::Wasm::Plan::cancel):
(JSC::Wasm::Plan::run): Deleted.
(JSC::Wasm::Plan::initializeCallees): Deleted.
* wasm/WasmPlan.h:
(JSC::Wasm::Plan::dontFinalize):
(JSC::Wasm::Plan::exports):
(JSC::Wasm::Plan::internalFunctionCount):
(JSC::Wasm::Plan::takeModuleInformation):
(JSC::Wasm::Plan::takeCallLinkInfos):
(JSC::Wasm::Plan::takeWasmExitStubs):
(JSC::Wasm::Plan::setModeAndPromise):
(JSC::Wasm::Plan::mode):
(JSC::Wasm::Plan::pendingPromise):
(JSC::Wasm::Plan::vm):
(JSC::Wasm::Plan::errorMessage):
(JSC::Wasm::Plan::failed):
(JSC::Wasm::Plan::hasWork):
(JSC::Wasm::Plan::hasBeenPrepared):
* wasm/WasmPlanInlines.h: Copied from Source/JavaScriptCore/wasm/WasmB3IRGenerator.h.
(JSC::Wasm::Plan::initializeCallees):
* wasm/WasmValidate.cpp:
* wasm/WasmWorklist.cpp: Added.
(JSC::Wasm::Worklist::priorityString):
(JSC::Wasm::Worklist::QueueElement::setToNextPriority):
(JSC::Wasm::Worklist::iterate):
(JSC::Wasm::Worklist::enqueue):
(JSC::Wasm::Worklist::completePlanSynchronously):
(JSC::Wasm::Worklist::stopAllPlansForVM):
(JSC::Wasm::Worklist::Worklist):
(JSC::Wasm::Worklist::~Worklist):
(JSC::Wasm::existingWorklistOrNull):
(JSC::Wasm::ensureWorklist):
* wasm/WasmWorklist.h: Added.
(JSC::Wasm::Worklist::nextTicket):
(JSC::Wasm::Worklist::Comparator::operator()):
* wasm/js/JSWebAssemblyCallee.h:
* wasm/js/JSWebAssemblyCodeBlock.cpp:
(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):
(JSC::JSWebAssemblyCodeBlock::initialize):
(JSC::JSWebAssemblyCodeBlock::isSafeToRun):
* wasm/js/JSWebAssemblyCodeBlock.h:
(JSC::JSWebAssemblyCodeBlock::create):
(JSC::JSWebAssemblyCodeBlock::initialized):
(JSC::JSWebAssemblyCodeBlock::plan):
(JSC::JSWebAssemblyCodeBlock::runnable):
(JSC::JSWebAssemblyCodeBlock::errorMessage):
(JSC::JSWebAssemblyCodeBlock::callees):
* wasm/js/JSWebAssemblyHelpers.h:
(JSC::createSourceBufferFromValue):
* wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::finishCreation):
(JSC::JSWebAssemblyInstance::visitChildren):
(JSC::JSWebAssemblyInstance::addUnitializedCodeBlock):
(JSC::JSWebAssemblyInstance::finalizeCreation):
(JSC::JSWebAssemblyInstance::create):
(JSC::JSWebAssemblyInstance::setMemory): Deleted.
* wasm/js/JSWebAssemblyInstance.h:
(JSC::JSWebAssemblyInstance::codeBlock):
(JSC::JSWebAssemblyInstance::initialized):
(JSC::JSWebAssemblyInstance::module):
(JSC::JSWebAssemblyInstance::importFunction):
(JSC::JSWebAssemblyInstance::setMemory):
(JSC::JSWebAssemblyInstance::table):
(JSC::JSWebAssemblyInstance::importFunctions):
(JSC::JSWebAssemblyInstance::setImportFunction): Deleted.
(JSC::JSWebAssemblyInstance::setTable): Deleted.
* wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::createStub):
(JSC::JSWebAssemblyModule::JSWebAssemblyModule):
(JSC::JSWebAssemblyModule::finishCreation):
(JSC::JSWebAssemblyModule::setCodeBlock):
(JSC::JSWebAssemblyModule::buildCodeBlock): Deleted.
(JSC::JSWebAssemblyModule::create): Deleted.
(JSC::JSWebAssemblyModule::codeBlock): Deleted.
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::moduleInformation):
(JSC::JSWebAssemblyModule::codeBlock):
(JSC::JSWebAssemblyModule::source):
(JSC::JSWebAssemblyModule::takeReservedMemory): Deleted.
(JSC::JSWebAssemblyModule::codeBlockFor): Deleted.
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::constructJSWebAssemblyInstance):
(JSC::WebAssemblyInstanceConstructor::createInstance): Deleted.
* wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::WebAssemblyModuleConstructor::createModule):
* wasm/js/WebAssemblyModulePrototype.cpp:
(JSC::webAssemblyModuleProtoImports):
(JSC::webAssemblyModuleProtoExports):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::finishCreation):
(JSC::WebAssemblyModuleRecord::link):
(JSC::WebAssemblyModuleRecord::evaluate):
* wasm/js/WebAssemblyModuleRecord.h:

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

2 years agoAnimated SVG images are not paused when outside viewport
cdumez@apple.com [Tue, 28 Mar 2017 23:11:35 +0000 (23:11 +0000)]
Animated SVG images are not paused when outside viewport
https://bugs.webkit.org/show_bug.cgi?id=170155
<rdar://problem/31288893>

Reviewed by Antti Koivisto.

Source/WebCore:

Make sure animated SVG images get paused when outside the viewport,
similarly to what was already done for animated GIF images. Also
make sure they are paused when they no longer have any renderers
using them.

Tests: svg/animations/animated-svg-image-outside-viewport-paused.html
       svg/animations/animated-svg-image-removed-from-document-paused.html

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::didAddClient):
Restart the animation whenever a new CachedImage client is added. This
will cause us the re-evaluate if the animation should run. The animation
will pause again if the new renderer is not inside the viewport.

(WebCore::CachedImage::animationAdvanced):
Add a flag to newImageAnimationFrameAvailable() so that the renderers can
let us know if we can pause the animation. Pause the animation if all no
renderer requires it (i.e. they are all outside the viewport, or there
are no renderers).

* loader/cache/CachedImageClient.h:
(WebCore::CachedImageClient::newImageAnimationFrameAvailable):
By default, the CachedImageClients allow pausing. Only renderer will
potentially prevent pausing if they are inside the viewport.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::isAnimating):
* platform/graphics/BitmapImage.h:
* platform/graphics/Image.h:
(WebCore::Image::isAnimating):
Add isAnimating() flag on Image for layout testing purposes.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::newImageAnimationFrameAvailable):
Set canPause flag to true if the renderer is not inside the viewport.

(WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
Call startAnimation() if the renderer is now visible to resume SVG
animations. Repainting is enough for GIF animations but not for SVG
animations, we have to explicitly resume them.

* rendering/RenderElement.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::addRendererWithPausedImageAnimations):
(WebCore::RenderView::removeRendererWithPausedImageAnimations):
(WebCore::RenderView::resumePausedImageAnimationsIfNeeded):
* rendering/RenderView.h:
Store CachedImages with the renderers that have paused animations.
This is required for SVG where we need to explicitly resume the
animation on the CachedImage when the renderer becomes visible
again. Having access to the Image will also allow us to do smarter
visibility checks in RenderElement's shouldRepaintForImageAnimation(),
in the future.

* svg/SVGSVGElement.cpp:
(WebCore::SVGSVGElement::hasActiveAnimation):
* svg/SVGSVGElement.h:
Add hasActiveAnimation() method.

* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::startAnimation):
Check that animations are paused before starting them. This avoid
jumping due to unnecessary calls to rootElement->setCurrentTime(0).

(WebCore::SVGImage::isAnimating):
Add isAnimating() method for layout tests purposes.

* svg/graphics/SVGImage.h:
* svg/graphics/SVGImageClients.h:
Call animationAdvanced() on the observer instead of the generic
changedInRect() when the SVGImage is animating. This way, we go
through the same code path as GIF animations and we end up calling
CachedImage::animationAdvanced() which calls newImageAnimationFrameAvailable()
on RenderElement, which determines if the animation should keep
running or not.

* testing/Internals.cpp:
(WebCore::Internals::isImageAnimating):
* testing/Internals.h:
* testing/Internals.idl:
Add layout testing infrastructure.

LayoutTests:

Add layout test coverage.

* platform/mac-wk1/TestExpectations:
* svg/animations/animated-svg-image-outside-viewport-paused-expected.txt: Added.
* svg/animations/animated-svg-image-outside-viewport-paused.html: Added.
* svg/animations/animated-svg-image-removed-from-document-paused-expected.txt: Added.
* svg/animations/animated-svg-image-removed-from-document-paused.html: Added.
* svg/animations/resources/smilAnimation.svg: Added.

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

2 years agoModernize AnalysisTaskPage
rniwa@webkit.org [Tue, 28 Mar 2017 23:00:36 +0000 (23:00 +0000)]
Modernize AnalysisTaskPage
https://bugs.webkit.org/show_bug.cgi?id=170165

Reviewed by Antti Koivisto.

Modernized AnalysisTaskPage and related components. The main refactoring happened in AnalysisTaskPage
from which AnalysisTaskResultsPane and AnalysisTaskTestGroupPane have been extracted.

Decoupled BuildRequest from its results. AnalysisResultsViewer and TestGroupResultsTable now stores
a reference to AnalysisResultsView and Metric to find the results for each build request.
This refactoring is necessary in order to view results of an arbitrary metric in the future.

Also refactored ResultsTable and its subclasses extensively. Instead of making its render() to invoke
subclass' methods such as buildRowGroups, heading, and additionalHeading, rely on each subclass call
to invoke renderTable(), renamed from render(), with callbacks to add extra headers and columns.

This patch also fixes a number of usability issues found by the user such as changing the test name
resets the customized revisions by the virtue of the modern code being naturally more correct.

* public/v3/components/analysis-results-viewer.js:
(AnalysisResultsViewer):
(AnalysisResultsViewer.prototype.setTestGroupCallback): Deleted. Replaced by "testGroupClick" action.
(AnalysisResultsViewer.prototype.setRangeSelectorLabels): Moved here from ResultsTable since it's
never used in ResultsTable or TestGroupResultsTable.
(AnalysisResultsViewer.prototype.selectedRange): Ditto.
(AnalysisResultsViewer.prototype.setPoints): Now takes metric as the third argument.
(AnalysisResultsViewer.prototype.setTestGroups): Now takes the current test group.
(AnalysisResultsViewer.prototype.didUpdateResults): Deleted.
(AnalysisResultsViewer.prototype.setAnalysisResultsView): Added.
(AnalysisResultsViewer.prototype.render): Invoke _renderTestGroups lazily. Also simplified the logic
to find the selected list item. Since we always use a shadow DOM now, we can simply look for an element
with ".seleted" instead of crafting a unique class name.
(AnalysisResultsViewer.prototype.renderTestGroups): Renamed from buildRowGroups. Specify callbacks to
insert headers for A/B radio buttons, which has been moved from ResultsTable.prototype.render, and the
stacked blocks of testing results.
(AnalysisResultsViewer.prototype._classForTestGroup): Deleted.
(AnalysisResultsViewer.prototype._openStackingBlock): Deleted.
(AnalysisResultsViewer.prototype._expandBetween): Create a new set for expandedPoints to make
_renderTestGroupsLazily.evaluate do the work.
(AnalysisResultsViewer._layoutBlocks): Moved from TestGroupStackingGrid.layout.
(AnalysisResultsViewer._sortBlocksByRow): Moved from AnalysisResultsViewer.TestGroupStackingGrid.
(AnalysisResultsViewer._insertAfterBlockWithSameRange): Ditto.
(AnalysisResultsViewer._insertBlockInFirstAvailableColumn): Ditto.
(AnalysisResultsViewer._createCellsForRow): Ditto.

(AnalysisResultsViewer.TestGroupStackingBlock):
(AnalysisResultsViewer.TestGroupStackingBlock.prototype.addRowIndex):
(AnalysisResultsViewer.TestGroupStackingBlock.prototype.createStackingCell): No longer creates a unique
class name here. See the inline comment for AnalysisResultsViewer.prototype.render.
(AnalysisResultsViewer.TestGroupStackingBlock.prototype.isThin): Deleted. We used to collapse "failed"
test groups as a thin vertical line, and we wanted to show them next to each other in _layoutBlock but
we don't do that anymore.
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForCommitSet): Added. Uses
this._analysisResultsView to extract the results for the current metrics.
(AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus):

* public/v3/components/analysis-task-bug-list.js: Added.
(AnalysisTaskBugList): Added. Extracted from AnalysisTaskChartPane.
(AnalysisTaskBugList.prototype.setTask): Added.
(AnalysisTaskBugList.prototype.didConstructShadowTree): Added.
(AnalysisTaskBugList.prototype.render): Added.
(AnalysisTaskBugList.prototype._associateBug): Added.
(AnalysisTaskBugList.prototype._dissociateBug): Added.
(AnalysisTaskBugList.htmlTemplate): Added.

* public/v3/components/chart-pane-base.js:
(ChartPaneBase.htmlTemplate): Added a hook to insert more content at the end in AnalysisTaskChartPane.
(ChartPaneBase.paneFooterTemplate): Added.

* public/v3/components/customizable-test-group-form.js:
(CustomizableTestGroupForm):
(CustomizableTestGroupForm.prototype.setCommitSetMap):
(CustomizableTestGroupForm.prototype.startTesting): Renamed from _submitted. Now dispatches an action
by the name of "startTesting" instead of calling this._startCallback.
(CustomizableTestGroupForm.prototype.didConstructShadowTree): Added. Moved the logic to attach event
handlers here to avoid eagerly creating the shadow tree in the constructor.
(CustomizableTestGroupForm.prototype._computeCommitSetMap): Use the newly added this._revisionEditorMap
to find the relevant input element instead of running a querySelector.
(CustomizableTestGroupForm.prototype.render): Lazily invoke _renderCustomRevisionTable. This avoids
overriding the customized revisions when the user finally types in the test group name.
(CustomizableTestGroupForm.prototype._renderCustomRevisionTable): Extracted from render.
(CustomizableTestGroupForm.prototype._constructRevisionRadioButtons): Made this a non-static method
since it needs to update this._revisionEditorMap now. Merged _constructRevisionRadioButtons.
(CustomizableTestGroupForm.prototype._createRadioButton): Deleted. See above.
(CustomizableTestGroupForm.cssTemplate):
(CustomizableTestGroupForm.formContent): Use IDs instead of classes to make this.content(ID) work.

* public/v3/components/mutable-list-view.js:
(MutableListView.prototype.setList):
(MutableListView.prototype.setKindList):
(MutableListView.prototype.setAddCallback): Deleted. Replaced by "addItem" action.
(MutableListView.prototype.render):
(MutableListItem.prototype.content):

* public/v3/components/results-table.js:
(ResultsTable): Removed this._rangeSelectorLabels, this._rangeSelectorCallback, and this._selectedRange
as they are only used by AnalysisResultsViewer. Also replaced this._valueFormatter by
this._analysisResultsView which knows a metric.
(ResultsTable.prototype.setValueFormatter): Deleted.
(ResultsTable.prototype.setRangeSelectorLabels): Deleted.
(ResultsTable.prototype.setRangeSelectorCallback): Deleted.
(ResultsTable.prototype.selectedRange): Deleted.
(ResultsTable.prototype._rangeSelectorClicked): Deleted.
(ResultsTable.prototype.setAnalysisResultsView): Added.
(ResultsTable.prototype.renderTable): Added. Removed the logic to add _rangeSelectorLabels since it has
been moved to AnalysisResultsViewer.prototype.render inside buildColumns, which also inserts additional
columns which used to be stored on each ResultsTableRow. Use the same technique to insert additional
headers. Also take the name (thead tr th) of row header (tbody tr td) as an argument and automatically
create a table cell of an appropriate colspan.
(ResultsTable.prototype._createRevisionListCells):
(ResultsTable.prototype.heading): Deleted. Superseded by buildHeaders callback.
(ResultsTable.prototype.additionalHeading): Ditto.
(ResultsTable.prototype.buildRowGroups): Deleted. It is now the responsibility of each subclass to call
ResultsTable's renderTable() in the subclass' render() function.
(ResultsTable.prototype._computeRepositoryList): No longer takes extraRepositories as an argument.
Instead, this function now returns a pair of the repository list and the list of constant commits.
(ResultsTable.htmlTemplate):
(ResultsTable.cssTemplate):

* public/v3/components/test-group-form.js:
(TestGroupForm): Avoid eagerly creating the shadow tree. Also removed the removed the dead code.
(TestGroupForm.prototype.setRepetitionCount): Simply override the value of the select element.
(TestGroupForm.prototype.didConstructShadowTree): Added. Attach event handlers here to avoid eagerly
creating the shadow tree in the constructor.
(TestGroupForm.prototype.startTesting): Renamed from _submitted. Dispatch "startTesting" action instead
of invoking _startCallback which has been removed.
(TestGroupForm.htmlTemplate):
(TestGroupForm.formContent):

* public/v3/components/test-group-results-table.js:
(TestGroupResultsTable):
(TestGroupResultsTable.prototype.didUpdateResults): Deleted. No longer neeed per setAnalysisResultsView
in ResultsTable.
(TestGroupResultsTable.prototype.setTestGroup):
(TestGroupResultsTable.prototype.heading): Deleted.
(TestGroupResultsTable.prototype.render):
(TestGroupResultsTable.prototype._renderTestGroup): Extracted from render.
(TestGroupResultsTable.prototype._buildRowGroups): Renamed from buildRowGroups.
(TestGroupResultsTable.prototype._buildRowGroupForCommitSet): Extracted from buildRowGroups.
(TestGroupResultsTable.prototype._buildComparisonRow): Extracted from buildRowGroups.buildRowGroups

* public/v3/index.html: Include analysis-task-bug-list.js.

* public/v3/models/analysis-results.js:
(AnalysisResults): Inverted the map so that we can easily create a view based on metric.
(AnalysisResults.prototype.find): Ditto.
(AnalysisResults.prototype.add): Ditto.
(AnalysisResults.prototype.viewForMetric): Added.
(AnalysisResults.fetch):
(AnalysisResultsView): Added.
(AnalysisResultsView.prototype.metric): Added.
(AnalysisResultsView.prototype.resultForBuildId): Added.

* public/v3/models/build-request.js:
(BuildRequest.result): Deleted.
(BuildRequest.setResult): Deleted.

* public/v3/models/test-group.js:
(TestGroup): Removed this._allCommitSets since it was never used.
(TestGroup.prototype.didSetResult): Deleted since it was never used.
(TestGroup.prototype.compareTestResults): Now takes an array of measurement set values.
(TestGroup.prototype._valuesForCommitSet): Deleted.

* public/v3/pages/analysis-task-page.js:
(AnalysisTaskChartPane): This class now includes the form to cutomize the revisions.
(AnalysisTaskChartPane.prototype.setShowForm): Added.
(AnalysisTaskChartPane.prototype._mainSelectionDidChange):
(AnalysisTaskChartPane.prototype.didConstructShadowTree): Added. Dispatches "newTestGroup" action when
the user presses the button to start a new A/B testing from the chart.
(AnalysisTaskChartPane.prototype.render): Added.
(AnalysisTaskChartPane.prototype.paneFooterTemplate): Added.
(AnalysisTaskChartPane.cssTemplate):

(AnalysisTaskResultsPane): Added. Encapsulates AnalysisResultsViewer and CustomizableTestGroupForm.
(AnalysisTaskResultsPane.prototype.setPoints): Added.
(AnalysisTaskResultsPane.prototype.setTestGroups): Added.
(AnalysisTaskResultsPane.prototype.setAnalysisResultsView): Added.
(AnalysisTaskResultsPane.prototype.setShowForm): Added.
(AnalysisTaskResultsPane.prototype.didConstructShadowTree): Added. Dispatches "newTestGroup" action
when the user presses the button to start a new A/B testing from the chart.
(AnalysisTaskResultsPane.prototype.render): Added.
(AnalysisTaskResultsPane.htmlTemplate): Added.
(AnalysisTaskResultsPane.cssTemplate): Added.

(AnalysisTaskTestGroupPane): Added. Encapsulates TestGroupResultsTable and CustomizableTestGroupForm.
(AnalysisTaskTestGroupPane.prototype.didConstructShadowTree): Added.
(AnalysisTaskTestGroupPane.prototype.setTestGroups): Added.
(AnalysisTaskTestGroupPane.prototype.setAnalysisResultsView): Added.
(AnalysisTaskTestGroupPane.prototype.render): Added.
(AnalysisTaskTestGroupPane.prototype._renderTestGroups): Added. Updates the list of test groups. Hide
the hidden groups unless showHiddenGroups is set. Updates this._testGroupMap so that the visibility of
groups and their names can be updated without having to re-render the entire list.
(AnalysisTaskTestGroupPane.prototype._renderTestGroupVisibility): Added.
(AnalysisTaskTestGroupPane.prototype._renderTestGroupNames): Added.
(AnalysisTaskTestGroupPane.prototype._renderCurrentTestGroup): Added. Update TestGroupResultsTable with
the selected test group. Also highlight the list view, and update the hide-unhide toggle button's label
as needed.
(AnalysisTaskTestGroupPane.htmlTemplate): Added.
(AnalysisTaskTestGroupPane.cssTemplate): Added.

(AnalysisTaskPage): Deleted a massive number of instance variables. They are now manged by newly added
AnalysisTaskChartPane, AnalysisTaskResultsPane, and AnalysisTaskTestGroupPane
(AnalysisTaskPage.prototype.didConstructShadowTree): Added. Attach various event handlers here to avoid
eagerly creating the shadow tree in the constructor.
(AnalysisTaskPage.prototype._fetchRelatedInfoForTaskId):
(AnalysisTaskPage.prototype._didFetchTask): No longer sets the value formatter to the results viewer
and the results table as they now recieve AnalysisResultsView later in _assignTestResultsIfPossible.
(AnalysisTaskPage.prototype._didFetchMeasurement): Set the metric to the results viewer.
(AnalysisTaskPage.prototype._didUpdateTestGroupHiddenState):
(AnalysisTaskPage.prototype._assignTestResultsIfPossible): Create AnalysisResultsView from the newly
retrieved AnalysisResults and pass it to AnalysisTaskResultsPane and AnalysisTaskTestGroupPane.
(AnalysisTaskPage.prototype.render): Dramatically simplified.
(AnalysisTaskPage.prototype._renderTaskNameAndStatus): Extracted from render.
(AnalysisTaskPage.prototype._renderRelatedTasks): Ditto.
(AnalysisTaskPage.prototype._renderCauseAndFixes): Ditto.
(AnalysisTaskPage.prototype._showTestGroup):
(AnalysisTaskPage.prototype._updateTaskName): Now takes the new name as an argument.
(AnalysisTaskPage.prototype._updateTestGroupName): Now takes the new name as the second argument.
(AnalysisTaskPage.prototype._hideCurrentTestGroup): Now takes the test group to hide.
(AnalysisTaskPage.prototype._associateCommit): Moved to AnalysisTaskBugList.
(AnalysisTaskPage.prototype._dissociateCommit): Ditto.
(AnalysisTaskPage.prototype._retryCurrentTestGroup): Now takes the test group as the first argument.
(AnalysisTaskPage.prototype._chartSelectionDidChange): Deleted.
(AnalysisTaskPage.prototype._createNewTestGroupFromChart): Deleted.
(AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): Deleted.
(AnalysisTaskPage.prototype._createNewTestGroupFromViewer): Deleted.
(AnalysisTaskPage.htmlTemplate):
(AnalysisTaskPage.cssTemplate):

* unit-tests/test-groups-tests.js: Updated a test case which was expecting BuildReqeust's result, which
has been removed, to exist.

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

2 years agoMissing render tree position invalidation when tearing down renderers for display...
antti@apple.com [Tue, 28 Mar 2017 22:48:26 +0000 (22:48 +0000)]
Missing render tree position invalidation when tearing down renderers for display:contents subtree
https://bugs.webkit.org/show_bug.cgi?id=170199
<rdar://problem/31260856>

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/shadow-dom/slot-renderer-teardown.html

* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateElementRenderer):

    Invalidate the render tree position in case we do a teardown for an element without renderer.

LayoutTests:

* fast/shadow-dom/slot-renderer-teardown-expected.txt: Added.
* fast/shadow-dom/slot-renderer-teardown.html: Added.

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

2 years agoUnreviewed, rolling out r214485.
ryanhaddad@apple.com [Tue, 28 Mar 2017 22:32:43 +0000 (22:32 +0000)]
Unreviewed, rolling out r214485.

This change caused LayoutTest crashes.

Reverted changeset:

"Stop RTCDataChannel when closing page"
https://bugs.webkit.org/show_bug.cgi?id=170166
http://trac.webkit.org/changeset/214485

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

2 years agoApplePayShippingContactUpdate.idl shouldn't have status field
andersca@apple.com [Tue, 28 Mar 2017 22:26:25 +0000 (22:26 +0000)]
ApplePayShippingContactUpdate.idl shouldn't have status field
https://bugs.webkit.org/show_bug.cgi?id=170202
rdar://problem/31307106

Reviewed by Beth Dakin.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):
If status isn't set, infer it based on whether there are errors present or not.

* Modules/applepay/ApplePayShippingContactUpdate.h:
Make status optional here; it's still used by the old code path.

* Modules/applepay/ApplePayShippingContactUpdate.idl:
Remove status here.

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

2 years agoWebAssembly: add fallback to use pinned register to load/store state
utatane.tea@gmail.com [Tue, 28 Mar 2017 22:16:01 +0000 (22:16 +0000)]
WebAssembly: add fallback to use pinned register to load/store state
https://bugs.webkit.org/show_bug.cgi?id=169773

Reviewed by Saam Barati.

This patch adds a new pinned register to hold JSWebAssemblyInstance,
which is used to represent the context of running Wasm code.
While we use fast TLS to hold the context in macOS, we do not have
any system reserved fast TLS slot in the other systems. This pinned
register approach is used in these systems. These changes decouple
VM from Wasm module to make Wasm module position independent code.

While using fast TLS could be beneficial in x64 systems which number of
registers is relatively small, pinned register approach could be
beneficial in ARM64 which has plenty of registers. In macOS, we can
switch the implementation with the runtime flag. Thus macOS port can
compare the performance and decide which implementation is used after
landing this patch.

* heap/MarkedBlock.h:
(JSC::MarkedBlock::offsetOfVM):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::loadWasmContext):
(JSC::AssemblyHelpers::storeWasmContext):
(JSC::AssemblyHelpers::loadWasmContextNeedsMacroScratchRegister):
(JSC::AssemblyHelpers::storeWasmContextNeedsMacroScratchRegister):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::loadWasmContext): Deleted.
(JSC::AssemblyHelpers::storeWasmContext): Deleted.
(JSC::AssemblyHelpers::loadWasmContextNeedsMacroScratchRegister): Deleted.
(JSC::AssemblyHelpers::storeWasmContextNeedsMacroScratchRegister): Deleted.
* jit/Repatch.cpp:
(JSC::webAssemblyOwner):
(JSC::linkFor):
(JSC::linkPolymorphicCall):
(JSC::isWebAssemblyToJSCallee): Deleted.
* jit/ThunkGenerators.cpp:
(JSC::throwExceptionFromWasmThunkGenerator):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* runtime/JSCell.cpp:
(JSC::JSCell::isAnyWasmCallee):
* runtime/JSCellInlines.h:
(JSC::isWebAssemblyToJSCallee):
* runtime/JSType.h:
* runtime/StackFrame.cpp:
(JSC::StackFrame::functionName):
* runtime/VM.cpp:
(JSC::VM::VM):
* runtime/VM.h:
(JSC::VM::wasmContextOffset):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::materializeWasmContext):
(JSC::Wasm::B3IRGenerator::restoreWasmContext):
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::getMemoryBaseAndSize):
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
(JSC::Wasm::createJSToWasmWrapper):
(JSC::Wasm::loadWasmContext): Deleted.
(JSC::Wasm::storeWasmContext): Deleted.
(JSC::Wasm::restoreWebAssemblyGlobalState): Deleted.
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs):
* wasm/WasmContext.cpp:
(JSC::loadWasmContext):
(JSC::storeWasmContext):
* wasm/WasmContext.h:
* wasm/WasmMemoryInformation.cpp:
(JSC::Wasm::getPinnedRegisters):
(JSC::Wasm::PinnedRegisterInfo::get):
(JSC::Wasm::PinnedRegisterInfo::PinnedRegisterInfo):
* wasm/WasmMemoryInformation.h:
(JSC::Wasm::PinnedRegisterInfo::toSave):
(JSC::Wasm::useFastTLS):
(JSC::Wasm::useFastTLSForWasmContext):
* wasm/js/JSWebAssemblyInstance.cpp:
(JSC::JSWebAssemblyInstance::finishCreation):
(JSC::JSWebAssemblyInstance::visitChildren):
* wasm/js/JSWebAssemblyInstance.h:
(JSC::JSWebAssemblyInstance::offsetOfCallee):
* wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::finishCreation):
(JSC::JSWebAssemblyModule::visitChildren):
* wasm/js/JSWebAssemblyModule.h:
(JSC::JSWebAssemblyModule::callee):
* wasm/js/WebAssemblyFunction.cpp:
(JSC::callWebAssemblyFunction):
(JSC::WebAssemblyFunction::create):
* wasm/js/WebAssemblyToJSCallee.cpp:
(JSC::WebAssemblyToJSCallee::create):
(JSC::WebAssemblyToJSCallee::createStructure):
(JSC::WebAssemblyToJSCallee::finishCreation):
(JSC::WebAssemblyToJSCallee::visitChildren):
(JSC::WebAssemblyToJSCallee::destroy): Deleted.
* wasm/js/WebAssemblyToJSCallee.h:

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

2 years agoFix Dashboard test _presentPopoverForJavaScriptCoreTestRegressions
aakash_jain@apple.com [Tue, 28 Mar 2017 22:14:49 +0000 (22:14 +0000)]
Fix Dashboard test _presentPopoverForJavaScriptCoreTestRegressions
https://bugs.webkit.org/show_bug.cgi?id=170193

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/resources/tests.js:
Fixed the order of arguments.

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

2 years agoDashboard tests fails to fetch the revision from commits
aakash_jain@apple.com [Tue, 28 Mar 2017 21:56:10 +0000 (21:56 +0000)]
Dashboard tests fails to fetch the revision from commits
https://bugs.webkit.org/show_bug.cgi?id=170191

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/resources/MockTrac.js:
Added recordedCommitIndicesByRevisionNumber.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/resources/tests.js:
(setup): Populated trac.recordedCommitIndicesByRevisionNumber since the dashboard code uses this variable.

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

2 years agoSafari crashes when attempting to close tab that is displaying PDF
timothy_horton@apple.com [Tue, 28 Mar 2017 21:43:49 +0000 (21:43 +0000)]
Safari crashes when attempting to close tab that is displaying PDF
https://bugs.webkit.org/show_bug.cgi?id=170201
<rdar://problem/31242019>

Reviewed by Wenson Hsieh.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _doAfterNextStablePresentationUpdate:]):
Adopt BlockPtr to fix a leak.

(-[WKWebView _firePresentationUpdateForPendingStableStatePresentationCallbacks]):
dispatch_async in the doAfterNextPresentationUpdate callback; since this
recursively calls itself, in cases where doAfterNextPresentationUpdate
returns synchronously (e.g. if the Web Process is missing), we would
recurse infinitely.

* TestWebKitAPI/Tests/WebKit2Cocoa/DoAfterNextPresentationUpdateAfterCrash.mm:
(TEST):
Add a test for doAfterNextStablePresentationUpdate just like the existing
non-stable one.

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

2 years agoWeb Inspector: Add "Disable Caches" option that only applies to the inspected page...
bburg@apple.com [Tue, 28 Mar 2017 21:41:24 +0000 (21:41 +0000)]
Web Inspector: Add "Disable Caches" option that only applies to the inspected page while Web Inspector is open
https://bugs.webkit.org/show_bug.cgi?id=169865
<rdar://problem/31250573>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Rename the command for disabling resource caching to match the WebCore::Page
flag. This also removes the possibility that this could be confused for the old,
buggy command that this patch rips out.

Source/WebCore:

Rewrite the network agent's command for disabling resource caching to use Page::setResourceCachingEnabled.
The old implementation was doing weird stuff like setting no-cache headers and evicting the
contents of the memory cache, neither of which is correct. The new approach has no side effects
on the network, disk, or memory cache so it can be turned on temporarily without causing problems.

New tests:
- http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html
- http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html

* inspector/InspectorNetworkAgent.h:
* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::setCacheDisabled): Deleted.
(WebCore::InspectorNetworkAgent::setResourceCachingDisabled): Added.
Implement new command.

(WebCore::InspectorNetworkAgent::willSendRequest):
(WebCore::InspectorNetworkAgent::mainFrameNavigated):
Remove crufty attempts to break caches. I believe these are intended to defeat caching
proxies and similar middlemen, but this is just as likely to cause unusual loading behavior.

* page/Page.h:
(WebCore::Page::isResourceCachingDisabled):
(WebCore::Page::setResourceCachingDisabledOverride):
Add an override setting so that Web Inspector's override does not mess up the value
of isResourceCachingDisabled that may have been set by a WebKit API client.

Source/WebInspectorUI:

Hook up a button in the Network tab to WebCore::Page's resourceCachingDisabled flag.
If it is active, resource loads are subject to a cache policy that never uses a cached response.

* Localizations/en.lproj/localizedStrings.js:
Add localized strings.

* UserInterface/Base/Main.js:
(WebInspector.loaded):
Add a setting for whether to disable resource caching and inform the backend
of our preference. If someone changes the setting, tell the backend again.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
(WebInspector.NetworkGridContentView.prototype.get navigationItems):
(WebInspector.NetworkGridContentView.prototype._resourceCachingDisabledSettingChanged):
(WebInspector.NetworkGridContentView.prototype._toggleDisableResourceCache):
Add a new activatable navigation item that toggles disableResourceCaching for the inspected page.

* UserInterface/Protocol/Legacy/10.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/10.3/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/7.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/8.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/9.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/9.3/InspectorBackendCommands.js:
* Versions/Inspector-iOS-10.0.json:
* Versions/Inspector-iOS-10.3.json:
* Versions/Inspector-iOS-7.0.json:
* Versions/Inspector-iOS-8.0.json:
* Versions/Inspector-iOS-9.0.json:
* Versions/Inspector-iOS-9.3.json:
Update legacy backend commands to remove the old/broken Network.setCacheDisabled command.

LayoutTests:

Add tests that verify the new command works as expected when it disables resource caching.
I also manually verified that the override setting is cleared when Web Inspector disconnects.
This is not easy to check in a layout test since we rely on the Web Inspector to tell whether
a load happened or not.

* http/tests/inspector/network/set-resource-caching-disabled-disk-cache-expected.txt: Added.
* http/tests/inspector/network/set-resource-caching-disabled-disk-cache.html: Added.
* http/tests/inspector/network/set-resource-caching-disabled-memory-cache-expected.txt: Added.
* http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html: Added.

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

2 years agoUpdate LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html to get...
commit-queue@webkit.org [Tue, 28 Mar 2017 21:17:12 +0000 (21:17 +0000)]
Update LayoutTests/fast/mediastream/RTCPeerConnection-addIceCandidate.html to get more coverage
https://bugs.webkit.org/show_bug.cgi?id=170194

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28
Reviewed by Chris Dumez.

* fast/mediastream/RTCPeerConnection-addIceCandidate-expected.txt:
* fast/mediastream/RTCPeerConnection-addIceCandidate.html: Making test more robust to failures to get more coverage.

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

2 years agoWeb Inspector: Inspecting a Main Resource that is JS/JSON does not format / syntax...
commit-queue@webkit.org [Tue, 28 Mar 2017 20:57:11 +0000 (20:57 +0000)]
Web Inspector: Inspecting a Main Resource that is JS/JSON does not format / syntax highlight it properly
https://bugs.webkit.org/show_bug.cgi?id=166862
<rdar://problem/29835977>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-03-28
Reviewed by Brian Burg.

Source/WebInspectorUI:

* UserInterface/Models/Resource.js:
(WebInspector.Resource.prototype.get syntheticMIMEType):
Don't override the mime type for Document resources. They should always
have a mime type and we should use whatever it is.

LayoutTests:

* http/tests/inspector/network/resource-mime-type-expected.txt: Added.
* http/tests/inspector/network/resource-mime-type.html: Added.
Test resource mime types for different resources.

* http/tests/inspector/network/resources/json.php: Added.
* http/tests/inspector/network/resources/script.js: Added.
* http/tests/inspector/network/resources/script.txt: Added.
* http/tests/inspector/network/resources/stylesheet.css: Added.
* http/tests/inspector/network/resources/stylesheet.txt: Added.
* http/tests/resources/square20.jpg: Added.
Resources for various requests and different mime types.

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

2 years agoMark http/tests/xmlhttprequest/simple-cross-origin-progress-events.html as flaky.
ryanhaddad@apple.com [Tue, 28 Mar 2017 20:50:36 +0000 (20:50 +0000)]
Mark http/tests/xmlhttprequest/simple-cross-origin-progress-events.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=168132

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoFix addIceCandidate after r214441
commit-queue@webkit.org [Tue, 28 Mar 2017 20:40:18 +0000 (20:40 +0000)]
Fix addIceCandidate after r214441
https://bugs.webkit.org/show_bug.cgi?id=170146

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt:

Source/WebCore:

Covered by rebased test.

* Modules/mediastream/RTCPeerConnection.js:
(addIceCandidate): Setting function length to 1 and throwing if no parameter is passed.

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

2 years ago[JSC] Move platformThreadSignal to WTF
utatane.tea@gmail.com [Tue, 28 Mar 2017 20:08:49 +0000 (20:08 +0000)]
[JSC] Move platformThreadSignal to WTF
https://bugs.webkit.org/show_bug.cgi?id=170097

Reviewed by Mark Lam.

Source/JavaScriptCore:

It is a small clean up towards https://bugs.webkit.org/show_bug.cgi?id=170027.
platformThreadSignal uses PlatformThread in JSC, but it can be implemented in
WTF ThreadIdentifier.

* runtime/JSLock.cpp:
(JSC::JSLock::lock):
* runtime/JSLock.h:
(JSC::JSLock::ownerThread):
(JSC::JSLock::currentThreadIsHoldingLock):
* runtime/PlatformThread.h:
(JSC::platformThreadSignal): Deleted.
* runtime/VM.h:
(JSC::VM::ownerThread):
* runtime/VMTraps.cpp:
(JSC::VMTraps::SignalSender::send):

Source/WTF:

* wtf/Threading.h:
* wtf/ThreadingPthreads.cpp:
(WTF::signalThread):

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

2 years agoMark two fast/scrolling/ios/touch-scroll tests as failing.
ryanhaddad@apple.com [Tue, 28 Mar 2017 20:02:10 +0000 (20:02 +0000)]
Mark two fast/scrolling/ios/touch-scroll tests as failing.
https://bugs.webkit.org/show_bug.cgi?id=170153

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:

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

2 years agoWeb Inspector: Unable to Format JSON Request Data
commit-queue@webkit.org [Tue, 28 Mar 2017 19:21:00 +0000 (19:21 +0000)]
Web Inspector: Unable to Format JSON Request Data
https://bugs.webkit.org/show_bug.cgi?id=170189

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-03-28
Reviewed by Matt Baker.

* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype._startWorkerPrettyPrint):
When we are viewing request data we are looking at a TextResourceContentView
which has a TextEditor without a delegate. In these cases we can just assume
a JavaScript Program. In the majority of cases this will typically be JSON
data, and either Program or Module will highlight and format as expected.

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

2 years agoRemove failure expectation for media/modern-media-controls/media-controller/media...
ryanhaddad@apple.com [Tue, 28 Mar 2017 19:05:42 +0000 (19:05 +0000)]
Remove failure expectation for media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html.

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

2 years agoStop RTCDataChannel when closing page
commit-queue@webkit.org [Tue, 28 Mar 2017 19:03:21 +0000 (19:03 +0000)]
Stop RTCDataChannel when closing page
https://bugs.webkit.org/show_bug.cgi?id=170166

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28
Reviewed by Eric Carlson.

Source/WebCore:

Test: webrtc/datachannel/datachannel-gc.html

Making RTCDataChannel an ActiveDOMObject.
Closing the data channel backend and freeing upon close and stop.

* Modules/mediastream/RTCDataChannel.cpp:
(WebCore::RTCDataChannel::create):
(WebCore::RTCDataChannel::RTCDataChannel):
(WebCore::RTCDataChannel::close):
(WebCore::RTCDataChannel::stop):
* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCPeerConnection.h:

LayoutTests:

* webrtc/datachannel/datachannel-gc-expected.txt: Added.
* webrtc/datachannel/datachannel-gc.html: Added.

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

2 years agoWebAssembly: implement Module imports/exports
jfbastien@apple.com [Tue, 28 Mar 2017 18:41:53 +0000 (18:41 +0000)]
WebAssembly: implement Module imports/exports
https://bugs.webkit.org/show_bug.cgi?id=166982

Reviewed by Saam Barati.

JSTests:

* wasm/js-api/Module.exports.js: Added.
(assert.throws.WebAssembly.Module.prototype.exports):
(assert.eq):
* wasm/js-api/Module.imports.js: Added.
(assert.throws.WebAssembly.Module.prototype.imports):
(assert.eq):

Source/JavaScriptCore:

As defined in: https://github.com/WebAssembly/design/commit/18cbacb90cd3584dd5c9aa3d392e4e55f66af6ab

* wasm/WasmFormat.h:
(JSC::Wasm::makeString): use uppercase instead, it was only used
for diagnostic but is now used for the expected JS property's
capitalization
* wasm/js/WebAssemblyModulePrototype.cpp:
(JSC::webAssemblyModuleProtoImports):
(JSC::webAssemblyModuleProtoExports):

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

2 years agoEnhance the touch region debug overlay to show regions for the different events
simon.fraser@apple.com [Tue, 28 Mar 2017 18:29:40 +0000 (18:29 +0000)]
Enhance the touch region debug overlay to show regions for the different events
https://bugs.webkit.org/show_bug.cgi?id=170162

Reviewed by Tim Horton.

Have NonFastScrollableRegionOverlay use a different color for each region in EventTrackingRegions,
and to draw a legend showing what the colors mean.

On Mac, this overlay displays the non-fast scrollable region (which we don't keep separate from the wheel event
region).

* page/DebugPageOverlays.cpp:
(WebCore::NonFastScrollableRegionOverlay::updateRegion):
(WebCore::touchEventRegionColors):
(WebCore::drawRightAlignedText):
(WebCore::NonFastScrollableRegionOverlay::drawRect):
(WebCore::RegionOverlay::drawRect):
(WebCore::RegionOverlay::drawRegion):

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

2 years agoMake sure the non-fast scrolling debug overlay is correctly updated
simon.fraser@apple.com [Tue, 28 Mar 2017 18:29:37 +0000 (18:29 +0000)]
Make sure the non-fast scrolling debug overlay is correctly updated
https://bugs.webkit.org/show_bug.cgi?id=170142

Reviewed by Tim Horton.

AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged() is called on a timer
from Document code, so the existing DebugPageOverlays::didLayout() call at the end
of FrameView::layout() wasn't sufficient to keep the non-fast scrollable region up-to-date
on iOS.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged):

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

2 years ago[Modern Media Controls] AirPlay placard text looks bad on 1x displays
commit-queue@webkit.org [Tue, 28 Mar 2017 18:27:02 +0000 (18:27 +0000)]
[Modern Media Controls] AirPlay placard text looks bad on 1x displays
https://bugs.webkit.org/show_bug.cgi?id=170183
<rdar://problem/30663416>

Patch by Antoine Quint <graouts@apple.com> on 2017-03-28
Reviewed by Dean Jackson.

Use subpixel antialiasing for all text in modern media controls.

* Modules/modern-media-controls/controls/media-controls.css:
(.media-controls-container,):

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

2 years agoREGRESSION (r214386): [ios-simulator] LayoutTest media/modern-media-controls/media...
commit-queue@webkit.org [Tue, 28 Mar 2017 17:36:50 +0000 (17:36 +0000)]
REGRESSION (r214386): [ios-simulator] LayoutTest media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html is failing
https://bugs.webkit.org/show_bug.cgi?id=170180

Unreviewed. Restore a value that was mistakenly changed in the fix for webkit.org/b/169962.

Patch by Antoine Quint <graouts@apple.com> on 2017-03-28

* media/modern-media-controls/media-controller/media-controller-scale-factor-audio-expected.txt:
* media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html:

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

2 years agoMark fast/history/ios/history-scroll-restoration.html as flaky.
ryanhaddad@apple.com [Tue, 28 Mar 2017 16:42:05 +0000 (16:42 +0000)]
Mark fast/history/ios/history-scroll-restoration.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169558

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:

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

2 years agoMark media/modern-media-controls/media-controller/media-controller-scale-factor-audio...
ryanhaddad@apple.com [Tue, 28 Mar 2017 16:29:15 +0000 (16:29 +0000)]
Mark media/modern-media-controls/media-controller/media-controller-scale-factor-audio.html as failing on ios-simulator.
https://bugs.webkit.org/show_bug.cgi?id=170180

Unreviewed test gardening.

* platform/ios/TestExpectations:

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

2 years agoLayoutTest webrtc/video-getParameters.html is failing
commit-queue@webkit.org [Tue, 28 Mar 2017 16:12:42 +0000 (16:12 +0000)]
LayoutTest webrtc/video-getParameters.html is failing
https://bugs.webkit.org/show_bug.cgi?id=170148

Unreviewed.

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-28

* TestExpectations: Marking webrtc/video-getParameters.html as failing.

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

2 years agoMark webrtc/video-replace-track-to-null.html as flaky.
ryanhaddad@apple.com [Tue, 28 Mar 2017 16:09:11 +0000 (16:09 +0000)]
Mark webrtc/video-replace-track-to-null.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170178

Unreviewed test gardening.

* TestExpectations:

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

2 years ago[Modern Media Controls] Improve appearance of tracks panel on macOS
commit-queue@webkit.org [Tue, 28 Mar 2017 15:55:20 +0000 (15:55 +0000)]
[Modern Media Controls] Improve appearance of tracks panel on macOS
https://bugs.webkit.org/show_bug.cgi?id=168929
<rdar://problem/30741589>

Patch by Antoine Quint <graouts@apple.com> on 2017-03-28
Reviewed by Eric Carlson.

We use a solid color for the focus state that matches the style used on macOS
and blend the titles the same way we blend other non-solid labels in the controls bar.

* Modules/modern-media-controls/controls/tracks-panel.css:
(.tracks-panel section):
(.tracks-panel section > h3):
(.tracks-panel section > ul > li:focus):

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

2 years agoMoved gardened ios-simulator tests to ios folders
jbedard@apple.com [Tue, 28 Mar 2017 15:30:06 +0000 (15:30 +0000)]
Moved gardened ios-simulator tests to ios folders
<rdar://problem/30948691>

Unreviewed test re-organization.

Moving ios-simulator test expectations to share as many expectations
as possible with on-device testing.

* platform/ios: Moved from platform/ios-simulator.
* platform/ios-device: Added.
* platform/ios-device-wk1: Added.
* platform/ios-device-wk2: Added.
* platform/ios-simulator: Moved to platform/ios.
* platform/ios-simulator-wk1: Moved to platform/ios-wk1.
* platform/ios-simulator-wk2: Moved to platform/ios-wk2.
* platform/ios-wk1: Moved from platform/ios-simulator-wk1.
* platform/ios-wk2: Moved from platform/ios-simulator-wk2.

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

2 years agowebkitpy: Use host pattern for devices
jbedard@apple.com [Tue, 28 Mar 2017 14:06:49 +0000 (14:06 +0000)]
webkitpy: Use host pattern for devices
https://bugs.webkit.org/show_bug.cgi?id=170121

Reviewed by Daniel Bates.

Devices should be treated like hosts throughout webkitpy
so that more code can be re-used.  Add the needed properties
and use executive over custom implemented polling/killing
functions.

* Scripts/webkitpy/port/device.py:
(Device):
(Device.executive): Add optional executive property.
(Device.filesystem): Add optional filesystem property.
(Device.user): Add optional user property.
(Device.platform): Add optional platform property.
(Device.workspace): Add optional workspace property.
(Device.poll): Deleted.
* Scripts/webkitpy/port/simulator_process.py:
(SimulatorProcess.Popen.poll): Use the devices executive.
(SimulatorProcess.stop): Ditto.
(SimulatorProcess._kill): Ditto.
* Scripts/webkitpy/xcode/simulated_device.py:
(SimulatedDevice.__init__): Add executive, filesystem, user, platform
and workspace to the platform device.
(SimulatedDevice.poll): Deleted.

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

2 years agoAdd a warning for unused link preloads.
yoav@yoav.ws [Tue, 28 Mar 2017 11:56:52 +0000 (11:56 +0000)]
Add a warning for unused link preloads.
https://bugs.webkit.org/show_bug.cgi?id=165670

Reviewed by Youenn Fablet.

Source/WebCore:

Tests: http/tests/preload/single_download_preload_headers_charset.php
       http/tests/preload/unused_preload_warning.html

* dom/Document.cpp:
(WebCore::Document::prepareForDestruction): Stop the timer once the document is destructed.
* loader/LinkPreloadResourceClients.h: Add shouldMarkAsReferenced overides for the LinkPreloadResourceClient classes.
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::addClientToSet): Make sure LinkPreloadResourceClients don't set resource to be referenced.
* loader/cache/CachedResourceClient.h:
(WebCore::CachedResourceClient::shouldMarkAsReferenced): Make sure that ResourceClients mark preloads as referenced by default.
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::CachedResourceLoader): Initialize timer.
(WebCore::CachedResourceLoader::~CachedResourceLoader): Stop timer.
(WebCore::CachedResourceLoader::documentDidFinishLoadEvent): Trigger a timer if preloads weren't cleared at load time.
(WebCore::CachedResourceLoader::stopUnusedPreloadsTimer): Stop the timer.
(WebCore::CachedResourceLoader::warnUnusedPreloads): Iterate over m_preloads and issue a warning for non-referenced preloads.
* loader/cache/CachedResourceLoader.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::willDetachDocumentFromFrame): Clear Resource Timing buffer when document detaches, to avoid test flakiness.

LayoutTests:

* TestExpectations: Added a "Failure Pass" for the flaky charset header test.
* http/tests/preload/download_resources-expected.txt:
* http/tests/preload/download_resources.html: Added references to preloaded resources.
* http/tests/preload/onerror_event-expected.txt:
* http/tests/preload/onerror_event.html: Added references to preloaded resources.
* http/tests/preload/onload_event-expected.txt:
* http/tests/preload/onload_event.html: Added references to preloaded resources.
* http/tests/preload/single_download_preload.html: Deflaked.
* http/tests/preload/single_download_preload_headers.php: Removed the charset to avoid double download bug.
* http/tests/preload/single_download_preload_headers_charset-expected.txt: Added.
* http/tests/preload/single_download_preload_headers_charset.php: Flaky test showing the double download bug when charset is declared.
* http/tests/preload/unused_preload_warning-expected.txt: Added.
* http/tests/preload/unused_preload_warning.html: Added.

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

2 years agoREGRESSION: Double-clicking the captions button while the captions popover is open...
commit-queue@webkit.org [Tue, 28 Mar 2017 10:42:39 +0000 (10:42 +0000)]
REGRESSION: Double-clicking the captions button while the captions popover is open prevents the popover from being opened again
https://bugs.webkit.org/show_bug.cgi?id=170171
<rdar://problem/31095500>

Patch by Antoine Quint <graouts@apple.com> on 2017-03-28
Reviewed by Dean Jackson.

Source/WebCore:

We used to consider that the tracks panel was presented as long as it had a parent, but since we were using for the animated
transition to complete before actually removing the panel from the node hierarchy, consecutive calls to hide then present
would fail to present the panel. We now use a private instance variable to track the presented state which is set immediately
as presentInParent() and hide() are called.

Test: media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html

* Modules/modern-media-controls/controls/tracks-panel.js:
(TracksPanel.prototype.get presented):
(TracksPanel.prototype.presentInParent):
(TracksPanel.prototype.hide):

LayoutTests:

Adding a new test that runs the steps to reproduce the issue, and rebaselining an existing one now that
the "presented" property returns false immediately after calling hide() on the panel.

* media/modern-media-controls/tracks-panel/tracks-panel-hide-expected.txt:
* media/modern-media-controls/tracks-panel/tracks-panel-hide.html:
* media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button-expected.txt: Added.
* media/modern-media-controls/tracks-support/tracks-support-show-panel-then-double-click-on-tracks-button.html: Added.

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

2 years agoDashboard test fails with error: latestIterationGetter is not a function
aakash_jain@apple.com [Tue, 28 Mar 2017 09:33:21 +0000 (09:33 +0000)]
Dashboard test fails with error: latestIterationGetter is not a function
https://bugs.webkit.org/show_bug.cgi?id=170167

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/resources/tests.js:
(this.view._latestProductiveIteration): Configure _latestProductiveIteration in setup.

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

2 years agoAX: Media controls should be able to be re-activated after faded away
commit-queue@webkit.org [Tue, 28 Mar 2017 07:49:56 +0000 (07:49 +0000)]
AX: Media controls should be able to be re-activated after faded away
https://bugs.webkit.org/show_bug.cgi?id=170048
<rdar://problem/30157179>

Patch by Aaron Chu <aaron_chu@apple.com> on 2017-03-28
Reviewed by Antoine Quint.

Source/WebCore:

Added a "foucsin" listener for the controls bar so that when an element
within fires a "focusin" event, the controls bar reappears if it is faded.

Test: media/modern-media-controls/media-controls/media-controls-appear-when-focus.html

* Modules/modern-media-controls/controls/controls-bar.js:
(ControlsBar.prototype.handleEvent):

LayoutTests:

* media/modern-media-controls/media-controls/media-controls-appear-when-focus-expected.txt: Added.
* media/modern-media-controls/media-controls/media-controls-appear-when-focus.html: Added.

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

2 years ago[Modern Media Controls] Improve media documents across macOS, iPhone and iPad
graouts@webkit.org [Tue, 28 Mar 2017 07:34:18 +0000 (07:34 +0000)]
[Modern Media Controls] Improve media documents across macOS, iPhone and iPad
https://bugs.webkit.org/show_bug.cgi?id=169145
<rdar://problem/17048858>

Reviewed by Dean Jackson.

Source/WebCore:

There were a variety of issues with media documents, some longstanding, and some specifically
about modern media controls.

One issue was that fullscreen and picture-in-picture buttons would show for audio media documents,
due to using a <video> element to load the audio file. We now have additional logic in MediaController
to identify if the loaded media is really an audio file, and using this information to hide the
fullscreen and picture-in-picture buttons.

Another issue was that we would inject style in MediaDocument.cpp that was specific to modern media
controls when we could have the modern-media-controls module injected CSS handle this styling. We now
use the injected style in the shadow root to size media documents based on the device characteristics
and ensuring that page styles are overridden.

We also simplify how MediaDocument.cpp sets the source of the media element to simply use the "src"
attribute and not a <source> element.

Finally, we introduce a MediaDocumentController class that is instantiated when we're dealing with
a media document to hide the controls while we determine the type of media we're loading (audio vs.
video) in order to apply the appropriate styling without flashes.

As a result of the new styles applied by the modern-media-controls module, media documents have a
similar behavior on macOS and iPad, where we only enforce a min-width for video allowing them
to play at their natural size otherwise, and enforcing a fixed width for audio. On iPhone however,
we want to always play the media at full width, with some padding in the case of audio.

Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html
       media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html
       media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html
       media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html
       media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html
       media/modern-media-controls/media-documents/media-document-video-ios-sizing.html
       media/modern-media-controls/media-documents/media-document-video-mac-sizing.html
       media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html

* Modules/modern-media-controls/controls/ios-inline-media-controls.css:
(:host(audio) .media-controls.ios.inline > .controls-bar:before,):
(:host(audio) .media-controls.ios.inline > .controls-bar:before): Deleted.
* Modules/modern-media-controls/controls/macos-media-controls.css:
(:host(audio) .media-controls.mac.inline > .controls-bar,):
(:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint,):
(:host(audio) .media-controls.mac.inline > .controls-bar): Deleted.
(:host(audio) .media-controls.mac.inline > .controls-bar > .background-tint): Deleted.
* Modules/modern-media-controls/controls/media-document.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/macos-media-controls.css.
(:host(.media-document)):
(:host(.media-document.ready)):
(:host(.media-document.audio.mac)):
(:host(.media-document.audio.ipad)):
(:host(.media-document.audio.iphone)):
(:host(.media-document.video.mac)):
(:host(.media-document.video.ipad)):
(:host(.media-document.video.iphone)):
* Modules/modern-media-controls/js-files:
* Modules/modern-media-controls/media/fullscreen-support.js:
(FullscreenSupport.prototype.syncControl):
(FullscreenSupport):
* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.get isAudio):
* Modules/modern-media-controls/media/media-document-controller.js: Copied from Source/WebCore/Modules/modern-media-controls/media/fullscreen-support.js.
(MediaDocumentController):
(MediaDocumentController.prototype.handleEvent):
(MediaDocumentController.prototype._mediaDocumentHasMetadata):
(MediaDocumentController.prototype._mediaDocumentHasSize):
* Modules/modern-media-controls/media/pip-support.js:
(PiPSupport.prototype.syncControl):
(PiPSupport):
* html/MediaDocument.cpp:
(WebCore::MediaDocumentParser::createDocumentStructure):

LayoutTests:

We add new tests for media documents and related features that cover the following cases:

    - checking <video> with only audio tracks does not show the fullscreen button
    - checking <video> with only audio tracks does not show the picture-in-picture button
    - checking the size used in media documents for audio and video across macOS, iPhone and iPad

* media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only-expected.txt: Added.
* media/modern-media-controls/fullscreen-support/fullscreen-support-disabled-video-with-audio-tracks-only.html: Added.
* media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing-expected.txt: Added.
* media/modern-media-controls/media-documents/ipad/media-document-audio-ios-sizing.html: Added.
* media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing-expected.txt: Added.
* media/modern-media-controls/media-documents/ipad/media-document-video-ios-sizing.html: Added.
* media/modern-media-controls/media-documents/media-document-audio-ios-sizing-expected.txt: Added.
* media/modern-media-controls/media-documents/media-document-audio-ios-sizing.html: Added.
* media/modern-media-controls/media-documents/media-document-audio-mac-sizing-expected.txt: Added.
* media/modern-media-controls/media-documents/media-document-audio-mac-sizing.html: Added.
* media/modern-media-controls/media-documents/media-document-video-ios-sizing-expected.txt: Added.
* media/modern-media-controls/media-documents/media-document-video-ios-sizing.html: Added.
* media/modern-media-controls/media-documents/media-document-video-mac-sizing-expected.txt: Added.
* media/modern-media-controls/media-documents/media-document-video-mac-sizing.html: Added.
* media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only-expected.txt: Added.
* media/modern-media-controls/pip-support/pip-support-disabled-video-with-audio-tracks-only.html: Added.
* platform/ios-simulator/TestExpectations:
* platform/mac/TestExpectations:

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

2 years agoFollow-up patch after r214364.
mmaxfield@apple.com [Tue, 28 Mar 2017 07:31:28 +0000 (07:31 +0000)]
Follow-up patch after r214364.
https://bugs.webkit.org/show_bug.cgi?id=168895

Unreviewed.

* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):

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

2 years agoFixes for libwebrtc logging after r214288
commit-queue@webkit.org [Tue, 28 Mar 2017 06:35:18 +0000 (06:35 +0000)]
Fixes for libwebrtc logging after r214288
https://bugs.webkit.org/show_bug.cgi?id=170116

Patch by Alejandro G. Castro <alex@igalia.com> on 2017-03-27
Reviewed by Youenn Fablet.

* Source/webrtc/base/logging.cc: Added the critical section
requirement and the call to the new getter for g_log_crit.

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

2 years agoWebAssembly: JSWebAssemblyCodeBlock.h belongs in JavaScriptCore/wasm/js not JavaScrip...
jfbastien@apple.com [Tue, 28 Mar 2017 06:20:55 +0000 (06:20 +0000)]
WebAssembly: JSWebAssemblyCodeBlock.h belongs in JavaScriptCore/wasm/js not JavaScriptCore/wasm
https://bugs.webkit.org/show_bug.cgi?id=170160

Reviewed by Mark Lam.

* JavaScriptCore.xcodeproj/project.pbxproj:
* wasm/js/JSWebAssemblyCodeBlock.h: Renamed from Source/JavaScriptCore/wasm/JSWebAssemblyCodeBlock.h.

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

2 years agoWeb Inspector: Option-clicking the close tab button should close all other tabs
webkit@devinrousso.com [Tue, 28 Mar 2017 06:17:58 +0000 (06:17 +0000)]
Web Inspector: Option-clicking the close tab button should close all other tabs
https://bugs.webkit.org/show_bug.cgi?id=169046

Reviewed by Matt Baker.

* UserInterface/Views/TabBar.js:
(WebInspector.TabBar.prototype._handleClick):

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

2 years agoAnother test v8.
lforschler@apple.com [Tue, 28 Mar 2017 05:43:48 +0000 (05:43 +0000)]
Another test v8.

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

2 years agoAnother test v7.
lforschler@apple.com [Tue, 28 Mar 2017 05:30:06 +0000 (05:30 +0000)]
Another test v7.

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

2 years agoAnother test v6.
lforschler@apple.com [Tue, 28 Mar 2017 05:19:19 +0000 (05:19 +0000)]
Another test v6.

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

2 years agoRemove WebPage::m_shouldDoICECandidateFiltering
commit-queue@webkit.org [Tue, 28 Mar 2017 04:39:39 +0000 (04:39 +0000)]
Remove WebPage::m_shouldDoICECandidateFiltering
https://bugs.webkit.org/show_bug.cgi?id=170150

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-27
Reviewed by Sam Weinig.

It is redundant with RTCController::m_shouldFilterICECandidates.
Manually tested on webrtc test samples.
This code path is currently untested by rwt as we hook it to getUserMedia which is mocked in rwt.
Additional testing will be added as a follow-up patch.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::disableICECandidateFiltering):
(WebKit::WebPage::enableICECandidateFiltering):
* WebProcess/WebPage/WebPage.h:

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

2 years agomake build fix for WebDefaultUIDelegate.m
jfbastien@apple.com [Tue, 28 Mar 2017 04:08:13 +0000 (04:08 +0000)]
make build fix for WebDefaultUIDelegate.m
https://bugs.webkit.org/show_bug.cgi?id=170163

Unreviewed build fix.

* PlatformMac.cmake: WebDefaultUIDelegate.m was renamed

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

2 years agoAnother test v5.
lforschler@apple.com [Tue, 28 Mar 2017 03:55:48 +0000 (03:55 +0000)]
Another test v5.

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

2 years agoAnother test v4.
lforschler@apple.com [Tue, 28 Mar 2017 03:50:21 +0000 (03:50 +0000)]
Another test v4.

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

2 years agoAnother test v3.
lforschler@apple.com [Tue, 28 Mar 2017 03:41:13 +0000 (03:41 +0000)]
Another test v3.

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

2 years ago[WK2] UIKit assertion when rotating device after dismissing popover
wenson_hsieh@apple.com [Tue, 28 Mar 2017 03:06:09 +0000 (03:06 +0000)]
[WK2] UIKit assertion when rotating device after dismissing popover
https://bugs.webkit.org/show_bug.cgi?id=170159
<rdar://problem/31283829>

Reviewed by Tim Horton.

Ensure that when we are finished presenting a WKActionSheet, we unregister with the shared notifications center.

* UIProcess/ios/WKActionSheet.mm:
(-[WKActionSheet dealloc]):
(-[WKActionSheet _cleanup]):
(-[WKActionSheet doneWithSheet:]):

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

2 years agoAnother test v2.
lforschler@apple.com [Tue, 28 Mar 2017 03:05:07 +0000 (03:05 +0000)]
Another test v2.

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

2 years agoAnother test.
lforschler@apple.com [Tue, 28 Mar 2017 03:03:43 +0000 (03:03 +0000)]
Another test.

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

2 years ago<rdar://problem/30949128>
lforschler@apple.com [Tue, 28 Mar 2017 02:53:46 +0000 (02:53 +0000)]
<rdar://problem/30949128>
Update build.webkit.org to use port 16000 for PBChangeSource.

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:

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

2 years agoTest commit to verify post-commit hook.
lforschler@apple.com [Tue, 28 Mar 2017 02:43:37 +0000 (02:43 +0000)]
Test commit to verify post-commit hook.

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

2 years agoREGRESSION(213764): Large images should not be decoded asynchronously when they are...
commit-queue@webkit.org [Tue, 28 Mar 2017 02:23:10 +0000 (02:23 +0000)]
REGRESSION(213764): Large images should not be decoded asynchronously when they are drawn on a canvas
https://bugs.webkit.org/show_bug.cgi?id=169771

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-03-27
Reviewed by Simon Fraser.

Source/WebCore:

Sometimes we have to draw the image immediately like when a canvas calls
drawImage. In this case we have to decode the image synchronously to guarantee
the drawing. Other times we need to decode with the native size of the image.
The animated images have to be decoded with native size always. Otherwise
the frame cache will be messed up if the same image is animated with different
sizes. Currently we always decode asynchronously with sizeForDrawing. We need
to decouple the decoding mode from the sizeForDrawing.

This patch introduce the DecodingOptions class which can store and compare the
following four cases:
    -- Synchronous: The frame has be decoded with native size only.
    -- Asynchronous + anySize: This is passed from the Image::draw() callers.
    -- Asynchronous + fullSize: The image has to be decoded with its full size.
    -- Asynchronous + sizeForDrawing: The image can be decoded with sizeForDrawing unless
    it was decoded with either a full size or sizeForDrawing which is larger than the
    requested sizeForDrawing.

A new argument of type DecodingMode will be added to Image::draw() function.
Only when the drawing comes from the render tree, it will be Asynchronous.
Otherwise it will be Synchronous.

Tests: fast/images/animated-image-different-dest-size.html
       fast/images/async-image-background-image.html
       fast/images/async-image-canvas-draw-image.html

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::frameImageAtIndexCacheIfNeeded): Gets the frame image, cache it synchronously if
the current one is invalid. frameImageAtIndex() returns whatever stored in the cache.
(WebCore::BitmapImage::nativeImage): Call frameImageAtIndexCacheIfNeeded() instead of frameImageAtIndex().
(WebCore::BitmapImage::nativeImageForCurrentFrame): Ditto.
(WebCore::BitmapImage::nativeImageOfSize): Ditto.
(WebCore::BitmapImage::framesNativeImages): Ditto.
(WebCore::BitmapImage::draw): Change the logic to do the following:
-- The animated image has to be decoded with its full size.
-- The animated image expects the current frame to be ready for drawing.
-- The large image decoding does not need to call internalStartAnimation().
-- The large image has to request async image decoding but draw the current one if it exists.
(WebCore::BitmapImage::drawPattern): Draw the pattern synchronously.
(WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): Delete the call to shouldUseAsyncDecodingForTesting()
since it is only applied for animated images.
(WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages): Call shouldUseAsyncDecodingForAnimatedImageForTesting().
(WebCore::BitmapImage::internalStartAnimation): Request decoding with the full size.
(WebCore::BitmapImage::advanceAnimation): Call shouldUseAsyncDecodingForAnimatedImageForTesting().
(WebCore::BitmapImage::internalAdvanceAnimation): Assert the current frame is not being decoding asynchronously for any size.
(WebCore::BitmapImage::frameImageAtIndex): Deleted. Moved to the header file but with a new purpose: return
the current frame from the frame cache as is; do not cache a new one.
(WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImage): Deleted. Function was renamed to shouldUseAsyncDecodingForLargeImages.
(WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImage): Deleted. Function was renamed to shouldUseAsyncDecodingForAnimatedImages.
* platform/graphics/BitmapImage.h:
* platform/graphics/CrossfadeGeneratedImage.cpp:
(WebCore::CrossfadeGeneratedImage::draw): Add a new argument of type DecodingMode.
* platform/graphics/CrossfadeGeneratedImage.h:
* platform/graphics/DecodingOptions.h: Added.
(WebCore::DecodingOptions::DecodingOptions): Default constructor: Synchronous mode.
(WebCore::DecodingOptions::operator==): Compares two DecodingOptions for equality.
(WebCore::DecodingOptions::isSynchronous): Is the frame decoded synchronously?
(WebCore::DecodingOptions::isAsynchronous): Is the frame decoded asynchronously?
(WebCore::DecodingOptions::isAsynchronousCompatibleWith): Is this DecodingOptions compatible with another one?
(WebCore::DecodingOptions::hasFullSize): Is the decoding mode asynchronous but for the image full size?
(WebCore::DecodingOptions::hasSizeForDrawing): Is this decoding mode asynchronous but for a sizeForDrawing?
(WebCore::DecodingOptions::sizeForDrawing): Returns the sizeForDrawing. m_decodingModeOrSize has to hold an IntSize.
(WebCore::DecodingOptions::maxDimension): Moved form ImageFrame.cpp.
(WebCore::DecodingOptions::has): A helper function.
(WebCore::DecodingOptions::hasDecodingMode): Does m_decodingModeOrSize a DecodingMode?
(WebCore::DecodingOptions::hasSize): Does m_decodingModeOrSize an IntSize?
* platform/graphics/GeneratedImage.h: Add a new argument of type DecodingMode.
* platform/graphics/GradientImage.cpp:
(WebCore::GradientImage::draw): Ditto.
* platform/graphics/GradientImage.h: Ditto.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage): Pass the ImagePaintingOptions::m_DecodingMode to Image::draw().
* platform/graphics/GraphicsContext.h:
(WebCore::ImagePaintingOptions::ImagePaintingOptions): Add a new member of type DecodingMode to ImagePaintingOptions.
* platform/graphics/Image.cpp:
(WebCore::Image::drawTiled): Pass DecodingMode::Synchronous to Image::draw().
* platform/graphics/Image.h: Add a new argument of type DecodingMode to Image::draw().
* platform/graphics/ImageFrame.cpp:
(WebCore::ImageFrame::operator=): Replace m_sizeForDrawing by m_decodingOptions.
(WebCore::ImageFrame::hasNativeImage): Check if m_nativeImage is valid and the subsamplingLevels match.
(WebCore::ImageFrame::hasFullSizeNativeImage): Checks hasNativeImage() and whether the image frame was
decoded for the image full size.
(WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions): Checks hasNativeImage() and the DecodingOptions match.
(WebCore::maxDimension): Deleted. Moved to DecodingOptions.h.
(WebCore::ImageFrame::isBeingDecoded): Deleted. The check for having an ImageFrame being decoded is
moved to ImageFrameCache.
(WebCore::ImageFrame::hasValidNativeImage): Deleted. No need to this function.
* platform/graphics/ImageFrame.h:
(WebCore::ImageFrame::hasNativeImage): Add an std::optional<SubsamplingLevel> argument.
(WebCore::ImageFrame::hasFullSizeNativeImage): Checks whether the ImageFrame was decoded for the image full size.
(WebCore::ImageFrame::enqueueSizeForDecoding): Deleted.
(WebCore::ImageFrame::dequeueSizeForDecoding): Deleted.
(WebCore::ImageFrame::clearSizeForDecoding): Deleted.
(WebCore::ImageFrame::isBeingDecoded): Deleted.
(WebCore::ImageFrame::sizeForDrawing): Deleted.
(WebCore::ImageFrame::hasDecodedNativeImage): Deleted.
The logic of knowing whether an ImageFrame is being decoded is moved to ImageFrameCache.
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::cacheFrameMetadataAtIndex): Caches the metadata of an ImageFrame. If the NativeImage
was decoded for a sizeForDrawing, the size of the ImageFrame will be the nativeImageSize(). Otherwise, the
frameSizeAtIndex() will be called.
(WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Cache a new NativeImage which involves caching new
metadata and updating the memory cache. No need to check if the existing native image is valid or not for the
DecodingOptions. Actually it would be a bug if it happens. This is why cacheNativeImageForFrameRequest() asserts
!frame.hasAsyncNativeImage() before calling cacheFrameNativeImageAtIndex().
(WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Cache new NativeImage which was decoded asynchronously.
(WebCore::ImageFrameCache::startAsyncDecodingQueue): Call cacheAsyncFrameNativeImageAtIndex() instead of
cacheNativeImageForFrameRequest() for clarity.
(WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Call hasAsyncNativeImage() instead of hasValidNativeImage()
Call frameIsDecodingCompatibleWithOptionsAtIndex() instead of frame.isBeingDecoded(). Replace the call to enqueueSizeForDecoding()
by appending the same ImageFrameRequest to m_frameCommitQueue.
(WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): Use m_frameCommitQueue to answer the question whether the decodingQueue is idle.
(WebCore::ImageFrameCache::stopAsyncDecodingQueue): Use m_frameCommitQueue to loop through all the ImageFrames which are currently being decoded.
(WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): For getting the metadata, this function needs a valid frame. If it is requested
to decode the nativeImage, it has to do it synchronously.
(WebCore::ImageFrameCache::singlePixelSolidColor): Don't cache the frame if it is an animated image or the size is not a single pixel.
(WebCore::ImageFrameCache::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex): Use m_frameCommitQueue to answer the question whether an ImageFrame
is being decoded and is compatible with DecodingOptions.
(WebCore::ImageFrameCache::frameHasFullSizeNativeImageAtIndex): Calls ImageFrame::hasFullNativeImage() for a frame.
(WebCore::ImageFrameCache::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex): Calls ImageFrame::hasDecodedNativeImageCompatibleWithOptions() for a frame.
(WebCore::ImageFrameCache::frameImageAtIndex): Returns the current NativeImage without caching.
(WebCore::ImageFrameCache::frameImageAtIndexCacheIfNeeded): Returns the current NativeImage but cache it synchronously if needed.
(WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Deleted.
(WebCore::ImageFrameCache::setFrameMetadataAtIndex): Deleted.
(WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): Deleted.
(WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Deleted.
(WebCore::ImageFrameCache::frameHasImageAtIndex): Deleted.
(WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Deleted.
(WebCore::ImageFrameCache::frameHasDecodedNativeImage): Deleted.
* platform/graphics/ImageFrameCache.h: Two ImageFrameRequest queues will be used.
-- The existing one m_frameRequestQueue which is shared between the main thread and decoding thread. The requests will be
dequeued from it before starting the decoding. The decoded NativeImage will be cached only on the main thread. The decoding
thread is not blocked by the callOnMainThread(). This means there might be multiple ImageFrameRequests which were dequeued
while their NativeImages have not been cached yet.
-- A new one m_frameCommitQueue which is track all the ImageFrameRequests whose NativeImages have not been cached yet.
(WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded): Be explicit about caching the image frame. frameImageAtIndex()
returns the current image frame without caching. frameAtIndexCacheIfNeeded(). returns the current image frame but cache
it if needed.
(WebCore::ImageFrameCache::ImageFrameRequest::operator==): Compares two ImageFrameRequests for equality.
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::frameImageAtIndexCacheIfNeeded):
(WebCore::ImageSource::frameImageAtIndex): Deleted.
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Change the type of the argument from IntSize to be const std::optional<IntSize>.
(WebCore::ImageSource::frameIsBeingDecodedAndIsCompatibleWithOptionsAtIndex): Rename of frameIsBeingDecodedAtIndex(). Replace the argument of type
std::optional<IntSize> by an argument of type DecodingOptions.
(WebCore::ImageSource::frameHasFullSizeNativeImageAtIndex): A wrapper around the ImageFrameCache function.
(WebCore::ImageSource::frameHasDecodedNativeImageCompatibleWithOptionsAtIndex): Ditto.
(WebCore::ImageSource::frameImageAtIndex): Ditto.
(WebCore::ImageSource::frameIsBeingDecodedAtIndex): Deleted.
(WebCore::ImageSource::frameHasValidNativeImageAtIndex): Deleted.
(WebCore::ImageSource::frameHasDecodedNativeImage): Deleted.
* platform/graphics/NamedImageGeneratedImage.cpp:
(WebCore::NamedImageGeneratedImage::draw): Add a new argument of type DecodingMode.
* platform/graphics/NamedImageGeneratedImage.h: Ditto.
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::draw): Add a new argument of type DecodingMode.
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument. Add a new handling
for decoding asynchronously for the image full size.
* platform/graphics/cg/ImageDecoderCG.h: Change the prototype of the function.
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::draw): Add a new argument of type DecodingMode.
* platform/graphics/cg/PDFDocumentImage.h:
* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::getHBITMAPOfSize): Pass DecodingMode::Synchronous to Image::draw().
(WebCore::BitmapImage::drawFrameMatchingSourceSize): Ditto.
* platform/graphics/win/ImageDecoderDirect2D.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument.
* platform/graphics/win/ImageDecoderDirect2D.h: Change the prototype of the function.
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::createFrameImageAtIndex): Replace the sizeForDrawing argument by a DecodingMode argument.
* platform/image-decoders/ImageDecoder.h: Change the prototype of the function.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended): Draw the background image asynchronously if the image size is large.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintIntoRect): Draw the background image element asynchronously if the image size is large.
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::drawForContainer): Pass DecodingMode::Synchronous to draw().
(WebCore::SVGImage::nativeImageForCurrentFrame): Ditto.
(WebCore::SVGImage::nativeImage): Ditto.
(WebCore::SVGImage::draw): Add a new argument of type DecodingMode.
* svg/graphics/SVGImage.h: Change the prototype of the function.
* svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::draw): Add a new argument of type DecodingMode.
* svg/graphics/SVGImageForContainer.h: Change the prototype of the function.

LayoutTests:

* fast/images/animated-image-different-dest-size-expected.html: Added.
* fast/images/animated-image-different-dest-size.html: Added.
This test crashes without this patch.

* fast/images/animated-image-loop-count.html:
Clear the memory cache so the test can be not flaky. Running it with -repeat-each was failing.

* fast/images/async-image-background-image-expected.html: Added.
* fast/images/async-image-background-image.html: Added.
Ensures the background image can be drawn asynchronously if it is large.

* fast/images/async-image-canvas-draw-image-expected.html: Added.
* fast/images/async-image-canvas-draw-image.html: Added.
Ensures the image is drawn synchronously on the canvas regardless of its size.

* fast/images/ordered-animated-image-frames.html:
Clear the memory cache so the test can be not flaky. Running it with -repeat-each was failing.

* fast/images/reset-image-animation-expected.txt:
* fast/images/reset-image-animation.html:
Change how the steps of the test are ordered so the test can be not flaky.
Running it with -repeat-each was failing.

* fast/images/resources/red-green-blue-900-300.png: Added.

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

2 years ago[iOS] Suppress page count recalc when setting a snapshot paper rect
aestes@apple.com [Tue, 28 Mar 2017 02:06:11 +0000 (02:06 +0000)]
[iOS] Suppress page count recalc when setting a snapshot paper rect
https://bugs.webkit.org/show_bug.cgi?id=170156
<rdar://problem/30787872>

Reviewed by Tim Horton.

When _WKWebViewPrintFormatter computes a page count for snapshotting, it updates the paper
rect, which triggers UIKit to ask for the page count again while we're in the middle of
printing, putting us in a bad state.

Suppress page count recalc while setting the new paper rect, since we know this will not
cause it to change.

* UIProcess/_WKWebViewPrintFormatter.mm:
(-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Temporarily set
_suppressPageCountRecalc to YES before updating the paper rect.
(-[_WKWebViewPrintFormatter _setNeedsRecalc]): Only call [super _setNeedsRecalc] if
_suppressPageCountRecalc is NO.
* UIProcess/_WKWebViewPrintFormatterInternal.h: Declared -_setNeedsRecalc.

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

2 years ago[WK2] Callout Bar should be dismissed during data interaction
wenson_hsieh@apple.com [Tue, 28 Mar 2017 02:02:21 +0000 (02:02 +0000)]
[WK2] Callout Bar should be dismissed during data interaction
https://bugs.webkit.org/show_bug.cgi?id=170109
<rdar://problem/31171570>

Reviewed by Tim Horton.

Minor tweak to get the callout bar to duck during data interaction. Import a new UIKit SPI header in WebKit2.

* Platform/spi/ios/UIKitSPI.h:

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

2 years agoTest commit against new svn server.
lforschler@apple.com [Tue, 28 Mar 2017 01:48:09 +0000 (01:48 +0000)]
Test commit against new svn server.

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

2 years ago<rdar://problem/30949128>
lforschler@apple.com [Tue, 28 Mar 2017 01:31:58 +0000 (01:31 +0000)]
<rdar://problem/30949128>
Update build.webkit.org to use port 16000 for PBChangeSource.

Reviewed by Alexey Proskuryakov.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:

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

2 years agoActivate release libwebrtc logging when WebRTC log channel is on
commit-queue@webkit.org [Tue, 28 Mar 2017 00:32:56 +0000 (00:32 +0000)]
Activate release libwebrtc logging when WebRTC log channel is on
https://bugs.webkit.org/show_bug.cgi?id=169659

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-27
Reviewed by Alex Christensen.

* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::initializePeerConnectionFactoryAndThreads):

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

2 years agoUpdate NetworkResourceLoader logging statement
krollin@apple.com [Tue, 28 Mar 2017 00:16:09 +0000 (00:16 +0000)]
Update NetworkResourceLoader logging statement
https://bugs.webkit.org/show_bug.cgi?id=170126

Reviewed by Alex Christensen.

NetworkResourceLoader contains a logging statement that prints, in
part: "start: Retrieving resource from cache". This is misleading,
since it's not necessarily the case that the resource will be loaded
from the cache. What is actually happening at the point where that is
logged is that the cache is being checked for the resource. It still
remains to be seen if the resource will be found in it. To address
this, change the logging to say "start: Checking cache for resource".

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::start):

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

2 years agoMove visibleInViewportStateChanged callback from Element to render tree
antti@apple.com [Tue, 28 Mar 2017 00:06:28 +0000 (00:06 +0000)]
Move visibleInViewportStateChanged callback from Element to render tree
https://bugs.webkit.org/show_bug.cgi?id=170039

Reviewed by Zalan Bujtas.

Make it easier to use from the render tree.

Also for simplicity move the bits from RenderObject rare data to RenderElement.
There is plenty of space there.

* dom/Element.h:
(WebCore::Element::isVisibleInViewportChanged): Deleted.
* html/HTMLMediaElement.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::RenderElement):
(WebCore::RenderElement::willBeDestroyed):
(WebCore::RenderElement::registerForVisibleInViewportCallback):
(WebCore::RenderElement::unregisterForVisibleInViewportCallback):
(WebCore::RenderElement::setVisibleInViewportState):
(WebCore::RenderElement::visibleInViewportStateChanged):
* rendering/RenderElement.h:
(WebCore::RenderElement::visibleInViewportState):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::setIsRegisteredForVisibleInViewportCallback): Deleted.
(WebCore::RenderObject::setVisibleInViewportState): Deleted.
* rendering/RenderObject.h:
(WebCore::RenderObject::hasOutlineAutoAncestor):
(WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
(WebCore::RenderObject::isRegisteredForVisibleInViewportCallback): Deleted.
(WebCore::RenderObject::visibleInViewportState): Deleted.
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::visibleInViewportStateChanged):
* rendering/RenderVideo.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::updateVisibleViewportRect):

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

2 years agoWeb Inspector: Saving files should not suggest the top level directory
commit-queue@webkit.org [Mon, 27 Mar 2017 23:37:40 +0000 (23:37 +0000)]
Web Inspector: Saving files should not suggest the top level directory
https://bugs.webkit.org/show_bug.cgi?id=170085
<rdar://problem/30197794>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-03-27
Reviewed by Matt Baker.

Source/WebKit/mac:

* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorFrontendClient::save):
Don't set panel.directoryURL unless we have a good suggestion.

Source/WebKit2:

* UIProcess/mac/RemoteWebInspectorProxyMac.mm:
(WebKit::RemoteWebInspectorProxy::platformSave):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformSave):
Don't set panel.directoryURL unless we have a good suggestion.

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

2 years agoaddIceCandidate should not throw if passed null or undefined
commit-queue@webkit.org [Mon, 27 Mar 2017 23:36:36 +0000 (23:36 +0000)]
addIceCandidate should not throw if passed null or undefined
https://bugs.webkit.org/show_bug.cgi?id=170118

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-27
Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

* web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-idl-expected.txt:

Source/WebCore:

Covered by updated test.

A null/undefined candidate passed to addIceCandidate means end of Ice candidate..

* Modules/mediastream/PeerConnectionBackend.cpp:
(WebCore::PeerConnectionBackend::addIceCandidate):
* Modules/mediastream/PeerConnectionBackend.h:
(WebCore::PeerConnectionBackend::endOfIceCandidates):
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::queuedAddIceCandidate):
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCPeerConnection.js:
(addIceCandidate):

LayoutTests:

Updating test to log addIceCandidate rejection.

* webrtc/datachannel/basic.html:
* webrtc/routines.js:
(iceCallback1):
(iceCallback2):
(onAddIceCandidateError):

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

2 years agoAdd delegate method to let an WebKit client provide a custom image preview controller.
commit-queue@webkit.org [Mon, 27 Mar 2017 23:32:56 +0000 (23:32 +0000)]
Add delegate method to let an WebKit client provide a custom image preview controller.
https://bugs.webkit.org/show_bug.cgi?id=170076
rdar://problem/31153051

Add a new delegate method (_webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:) to
WKUIDelegatePrivate, an client can use this method to provide a custom image preview view controller if the image
has alternated URL or custom image info.

Patch by Yongjun Zhang <yongjun_zhang@apple.com> on 2017-03-27
Reviewed by Beth Dakin.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Add delegate method _webView:previewViewControllerForImage:alternateURL:defaultActions:elementInfo:.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _presentedViewControllerForPreviewItemController:]): If the image has alternated URL or custom info, try to use the client-provided
    preview view controller. Otherwise, use the default WKImagePreviewViewController.

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

2 years agoWeb Inspector: The inspector sidebar has weird sub-column sizing issues
webkit@devinrousso.com [Mon, 27 Mar 2017 23:31:01 +0000 (23:31 +0000)]
Web Inspector: The inspector sidebar has weird sub-column sizing issues
https://bugs.webkit.org/show_bug.cgi?id=161966

Reviewed by Joseph Pecoraro.

* UserInterface/Views/Sidebar.js:
(WebInspector.Sidebar.prototype.resizerDragEnded):
(WebInspector.Sidebar.prototype._recalculateWidth):
Ensure that the selected sidebar panel is notified of the size change (sizeDidChange) when
the resizer drag ends.

* UserInterface/Views/DetailsSectionDataGridRow.js:
(WebInspector.DetailsSectionDataGridRow.prototype.sizeDidChange):
* UserInterface/Views/ProbeSetDetailsSection.js:
(WebInspector.ProbeSetDetailsSection.prototype.sizeDidChange):
Add/update the sizeDidChange protected function.

* UserInterface/Views/ComputedStyleDetailsPanel.js:
(WebInspector.ComputedStyleDetailsPanel.prototype.initialLayout):
(WebInspector.ComputedStyleDetailsPanel.prototype.sizeDidChange):
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel.prototype.sizeDidChange):
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WebInspector.LayerTreeDetailsSidebarPanel.prototype.sizeDidChange):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype.sizeDidChange):
* UserInterface/Views/ProbeDetailsSidebarPanel.js:
(WebInspector.ProbeDetailsSidebarPanel.prototype.sizeDidChange):
Update the contained DataGrid elements whenever the sidebar size changes so that the resizer
elements are positioned correctly.

* UserInterface/Views/View.js:
(WebInspector.View.prototype.updateLayoutIfNeeded):
* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview.prototype.updateLayoutIfNeeded):
* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.updateLayoutIfNeeded):
Ensure the layoutReason is also propagated.

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

2 years agoWebAssembly: misc memory testing
jfbastien@apple.com [Mon, 27 Mar 2017 23:24:31 +0000 (23:24 +0000)]
WebAssembly: misc memory testing
https://bugs.webkit.org/show_bug.cgi?id=170137

Reviewed by Keith Miller.

JSTests:

* wasm/assert.js: handle newlines in code we print out, avoid regex
* wasm/function-tests/memory-import-and-grow.js: Added.
(const.instantiate):
(const.test):
* wasm/function-tests/memory-section-and-import.js: Added.
(const.instantiate):

Source/JavaScriptCore:

* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::WebAssemblyInstanceConstructor::createInstance): improve error messages

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

2 years agoRebaseline svg/css/getComputedStyle-basic.xhtml for macOS.
ryanhaddad@apple.com [Mon, 27 Mar 2017 23:21:19 +0000 (23:21 +0000)]
Rebaseline svg/css/getComputedStyle-basic.xhtml for macOS.

Unreviewed test gardening.

* platform/mac-elcapitan/svg/css/getComputedStyle-basic-expected.txt: Added.
* platform/mac/svg/css/getComputedStyle-basic-expected.txt: Added.

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

2 years agoWeb Inspector: Resource Details Sidebar displays previous image metrics when viewing...
commit-queue@webkit.org [Mon, 27 Mar 2017 23:19:21 +0000 (23:19 +0000)]
Web Inspector: Resource Details Sidebar displays previous image metrics when viewing resource where content load failed
https://bugs.webkit.org/show_bug.cgi?id=170065
<rdar://problem/27081591>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-03-27
Reviewed by Matt Baker.

* UserInterface/Models/Resource.js:
(WebInspector.Resource.prototype.getImageSize.imageDidLoad):
(WebInspector.Resource.prototype.getImageSize.requestContentFailure):
(WebInspector.Resource.prototype.getImageSize):
If the requestContent failed, return a null image size.

* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshImageSizeSection.hideImageSection):
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshImageSizeSection):
If the callback is called with a null size, hide the image size section.

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

2 years agoSource/WebCore:
antti@apple.com [Mon, 27 Mar 2017 22:56:32 +0000 (22:56 +0000)]
Source/WebCore:
Allow the page to render before <link> stylesheet tags in body
https://bugs.webkit.org/show_bug.cgi?id=149157
<rdar://problem/24658830>

Reviewed by Simon Fraser.

Currently we block style and renderer building completely if document has any loading
stylesheets. In case a script queries something layout dependent we construct the render
tree with whatever style we have but block painting in it.

This patch changes behavior so that a loading stylesheet in body only blocks rendering for elements
that are after it. The expectation is that such stylesheets rarely affect elements before them
and the elements can be rendered without causing ugly visible styling changes.

The patch replaces the old flash-of-unstyled-content (FOUC) preventation mechanism with a more
fine-grained one. Paint blocking is now done on per-renderer basis with based on isNonFinal flag in
RenderStyle.

For stylesheets in head the behavior should be largely unchanged.

Test: http/tests/incremental/stylesheet-body-incremental-rendering.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::pseudoStyleRulesForElement):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::resolveStyle):
(WebCore::Document::updateLayoutIgnorePendingStylesheets):

    Remove the old FOUC preventation state tracking.

(WebCore::Document::shouldScheduleLayout):
(WebCore::Document::didRemoveAllPendingStylesheet):

    Repaints will now get triggered by the normal style mechanism.

* dom/Document.h:
(WebCore::Document::hasNodesWithNonFinalStyle):
(WebCore::Document::setHasNodesWithNonFinalStyle):

    Track if we need to recompute the style later because non-final or unstyled elements.

(WebCore::Document::didLayoutWithPendingStylesheets): Deleted.
(WebCore::Document::hasNodesWithPlaceholderStyle): Deleted.
(WebCore::Document::setHasNodesWithPlaceholderStyle): Deleted.
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::rendererIsNeeded):
* page/FrameView.cpp:
(WebCore::FrameView::qualifiesAsVisuallyNonEmpty):

    Don't qualify as visually non-empty if we have loading stylesheets in head (even if there is
    a fouc-prevented render tree).

(WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintContents):

    Instead of a global test, block painting if isNonFinal is set in the renderer's style.

* rendering/RenderLayer.cpp:
(WebCore::shouldSuppressPaintingLayer):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresRepaint):

    The isNonFinal flag prevents painting so we need to trigger repaint when it gets cleared.

* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::isNotFinal):
(WebCore::RenderStyle::setIsNotFinal):
(WebCore::RenderStyle::isPlaceholderStyle): Deleted.
(WebCore::RenderStyle::setIsPlaceholderStyle): Deleted.

    There is no need for placeholder styles anymore. Reuse the bit for isNotFinal.

* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
* style/StyleScope.cpp:
(WebCore::Style::Scope::analyzeStyleSheetChange):
(WebCore::Style::Scope::updateActiveStyleSheets):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForElement):
(WebCore::Style::TreeResolver::resolveElement):

    If we have seens a loading stylesheet and don't have a renderer yet don't style the element.
    In case there is a renderer or we are ignoring pending sheets, resolve the style normally
    but mark it as non-final.

(WebCore::Style::makePlaceholderStyle): Deleted.

LayoutTests:
Loading in-body stylesheets should not block rendering of elements before them
https://bugs.webkit.org/show_bug.cgi?id=169345

Reviewed by Simon Fraser.

* http/tests/incremental/resources/delayed-css.php: Added.
* http/tests/incremental/stylesheet-body-incremental-rendering-expected.html: Added.
* http/tests/incremental/stylesheet-body-incremental-rendering.html: Added.

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

2 years agoBots should run the dashboard tests
jmarcell@apple.com [Mon, 27 Mar 2017 22:22:40 +0000 (22:22 +0000)]
Bots should run the dashboard tests
https://bugs.webkit.org/show_bug.cgi?id=168994

Reviewed by Daniel Bates and David Kilzer.

We pull the `--results-directory` argument value out so that `RunDashboardTests` can override it so that we can separately run the dashboard layout tests.

* BuildSlaveSupport/build.webkit.org-config/master.cfg:
(RunWebKitTests): Define a class variable called resultDirectory for the `--results-directory` argument so that subclasses can override this if needed.
(RunWebKitTests.start): Set the `--results-directory` argument value to the value of self.resultDirectory.
(RunDashboardTests): Subclass of RunWebKitTests in which we run the layout tests for the Bot Watcher's Dashboard.
(RunDashboardTests.start): Override the `--layout-tests-directory` to point to the dashboard layout tests.
(ExtractTestResults.addCustomURLs): Update the current results URL label to indicate that it links to layout tests results and add a new link to link to dashboard layout test results.
(TestFactory.__init__): Update unit tests to account for new RunDashboardTests step.
* BuildSlaveSupport/build.webkit.org-config/mastercfg_unittest.py:
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:

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

2 years agoTest variation font ranges in the CSS Font Loading API
mmaxfield@apple.com [Mon, 27 Mar 2017 22:09:14 +0000 (22:09 +0000)]
Test variation font ranges in the CSS Font Loading API
https://bugs.webkit.org/show_bug.cgi?id=170022

Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/text/variations/font-loading-api-parse-ranges.html

Don't use keywords when reporting font variation range values.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::fontNonKeywordWeightFromStyleValue):
(WebCore::ComputedStyleExtractor::fontWeightFromStyleValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordStretchFromStyleValue):
(WebCore::ComputedStyleExtractor::fontStretchFromStyleValue):
(WebCore::ComputedStyleExtractor::fontNonKeywordStyleFromStyleValue):
(WebCore::ComputedStyleExtractor::fontStyleFromStyleValue):
* css/CSSComputedStyleDeclaration.h:
* css/FontFace.cpp:
(WebCore::FontFace::style):
(WebCore::FontFace::weight):
(WebCore::FontFace::stretch):

LayoutTests:

* fast/text/variations/font-loading-api-parse-ranges-expected.txt: Added.
* fast/text/variations/font-loading-api-parse-ranges.html: Added.

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

2 years agowebkitpy: Look for 'ios' test expectations for IOSPorts
jbedard@apple.com [Mon, 27 Mar 2017 21:49:09 +0000 (21:49 +0000)]
webkitpy: Look for 'ios' test expectations for IOSPorts
https://bugs.webkit.org/show_bug.cgi?id=169413

Reviewed by Alexey Proskuryakov.

Test expectations for iOS tests should include the 'ios' folder.  Modify
default_baseline_search_path to include 'ios' folder and derivatives for
IOSPort.

* Scripts/webkitpy/port/ios.py:
(IOSPort._generate_all_test_configurations): Moved from IOSSimulatorPort.
(IOSPort.default_baseline_search_path): Add ios expectations along with port specific expectations.
(IOSPort.test_expectations_file_position): Added for testing.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort._generate_all_test_configurations): Moved to IOSPort.
(IOSSimulatorPort.default_baseline_search_path): Moved to IOSPort.

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

2 years agoREGRESSION: Reseting _device_map on each child process
jbedard@apple.com [Mon, 27 Mar 2017 21:42:50 +0000 (21:42 +0000)]
REGRESSION: Reseting _device_map on each child process
<rdar://problem/31274476>

Unreviewed infrastructure fix.

* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort): Add _DEVICE_MAP class variable.
(IOSSimulatorPort.__init__): Use shared class variable
(IOSSimulatorPort._device_for_worker_number_map): Use _DEVICE_MAP class variable
(IOSSimulatorPort._create_devices): Ditto.
(IOSSimulatorPort._quit_ios_simulator): Ditto.
(IOSSimulatorPort.clean_up_test_run): Ditto.

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

2 years agoPropagate shipping contact update errors
andersca@apple.com [Mon, 27 Mar 2017 21:32:17 +0000 (21:32 +0000)]
Propagate shipping contact update errors
https://bugs.webkit.org/show_bug.cgi?id=170141
rdar://problem/31276576

Reviewed by Tim Horton.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::convertAndValidate):

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

2 years agoUnreviewed, rolling out r214411.
ryanhaddad@apple.com [Mon, 27 Mar 2017 21:20:30 +0000 (21:20 +0000)]
Unreviewed, rolling out r214411.

Two of the LayoutTests for this change time out on ios-
simulator.

Reverted changeset:

"[Modern Media Controls] Improve media documents across macOS,
iPhone and iPad"
https://bugs.webkit.org/show_bug.cgi?id=169145
http://trac.webkit.org/changeset/214411

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

2 years agoFix uses of deprecated API
andersca@apple.com [Mon, 27 Mar 2017 20:55:45 +0000 (20:55 +0000)]
Fix uses of deprecated API
https://bugs.webkit.org/show_bug.cgi?id=170138
rdar://problem/28882449

Reviewed by Tim Horton.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toPKContactFields):
(WebKit::toPKAddressField):
(WebKit::toPKPaymentRequest):
Don't use deprecated APIs.

(WebKit::toNSError):
Don't try to insert nil in a dictionary.

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

2 years agoBuild libwebrtc with even more warnings
achristensen@apple.com [Mon, 27 Mar 2017 19:57:22 +0000 (19:57 +0000)]
Build libwebrtc with even more warnings
https://bugs.webkit.org/show_bug.cgi?id=169997

Reviewed by Tim Horton.

There are still OSAtomic* functions I don't want to worry about right now,
so I'm keeping a few -Wno-deprecated-declarations, but everything else can go.

* Configurations/libsrtp.xcconfig:
* Configurations/libwebrtc.xcconfig:
* Configurations/libwebrtcpcrtc.xcconfig:

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

2 years ago[Modern Media Controls] Clicking on the tracks button when the tracks panel is up...
graouts@webkit.org [Mon, 27 Mar 2017 19:44:09 +0000 (19:44 +0000)]
[Modern Media Controls] Clicking on the tracks button when the tracks panel is up in a media document pauses the video
https://bugs.webkit.org/show_bug.cgi?id=168517
<rdar://problem/30577636>

Reviewed by Dean Jackson.

Source/WebCore:

We completely turn off default event handling in MediaDocument.cpp since we're implementing the
behavior we expect to pause and resume the video in the modern-media-controls module already. This
gets rid of this odd case where the content would not see the "click" event while the C++ side would
handle it and pause the video.

* Modules/modern-media-controls/media/media-controller.js:
(MediaController):
(MediaController.prototype.handleEvent):
(MediaController.prototype._containerWasClicked): Deleted.
* html/MediaDocument.cpp:
(WebCore::MediaDocument::defaultEventHandler):

LayoutTests:

* media/video-click-dblckick-standalone.html: We disable modern-media-controls here since we know that this test won't pass with them on.

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

2 years agoMark media/modern-media-controls/time-label/time-label-white-space-nowrap.html as...
ryanhaddad@apple.com [Mon, 27 Mar 2017 19:40:01 +0000 (19:40 +0000)]
Mark media/modern-media-controls/time-label/time-label-white-space-nowrap.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169679

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoMark inspector/dom-debugger/dom-breakpoints.html as flaky.
ryanhaddad@apple.com [Mon, 27 Mar 2017 19:36:55 +0000 (19:36 +0000)]
Mark inspector/dom-debugger/dom-breakpoints.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=170127

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoMark media/modern-media-controls/time-label/time-label.html as flaky.
ryanhaddad@apple.com [Mon, 27 Mar 2017 19:16:50 +0000 (19:16 +0000)]
Mark media/modern-media-controls/time-label/time-label.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=169678

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

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

2 years agoMarking two modern-media-controls tests as timeouts.
ryanhaddad@apple.com [Mon, 27 Mar 2017 19:09:48 +0000 (19:09 +0000)]
Marking two modern-media-controls tests as timeouts.
https://bugs.webkit.org/show_bug.cgi?id=170123

Unreviewed test gardening.

* platform/ios-simulator/TestExpectations:

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

2 years agoTighten RTCDatachannel creation and parameter getters
commit-queue@webkit.org [Mon, 27 Mar 2017 18:13:19 +0000 (18:13 +0000)]
Tighten RTCDatachannel creation and parameter getters
https://bugs.webkit.org/show_bug.cgi?id=170081

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-27
Reviewed by Eric Carlson.

Source/WebCore:

Covered by updated tests.

Adding some parameter checks when creating data channels.
Making some getters nullable as per the spec.

* Modules/mediastream/RTCDataChannel.h:
* Modules/mediastream/RTCDataChannel.idl:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::createDataChannel):
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::createDataChannel):
(WebCore::LibWebRTCMediaEndpoint::addDataChannel):
* platform/mediastream/RTCDataChannelHandler.h:
(): Deleted.

LayoutTests:

* webrtc/datachannel/basic-expected.txt:
* webrtc/datachannel/basic.html:

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