WebKit-https.git
5 years ago[Re-landing] Implement a StackTrace utility object that can capture stack traces...
mark.lam@apple.com [Fri, 10 Mar 2017 19:01:57 +0000 (19:01 +0000)]
[Re-landing] Implement a StackTrace utility object that can capture stack traces for debugging.
https://bugs.webkit.org/show_bug.cgi?id=169454

Reviewed by Michael Saboff.

The underlying implementation is hoisted right out of Assertions.cpp from the
implementations of WTFPrintBacktrace().

The reason we need this StackTrace object is because during heap debugging, we
sometimes want to capture the stack trace that allocated the objects of interest.
Dumping the stack trace directly to stdout (using WTFReportBacktrace()) may
perturb the execution profile sufficiently that an issue may not reproduce,
while alternatively, just capturing the stack trace and deferring printing it
till we actually need it later perturbs the execution profile less.

In addition, just capturing the stack traces (instead of printing them
immediately at each capture site) allows us to avoid polluting stdout with tons
of stack traces that may be irrelevant.

For now, we only capture the native stack trace.  We'll leave capturing and
integrating the JS stack trace as an exercise for the future if we need it then.

Here's an example of how to use this StackTrace utility:

    // Capture a stack trace of the top 10 frames.
    std::unique_ptr<StackTrace> trace(StackTrace::captureStackTrace(10));
    // Print the trace.
    dataLog(*trace);

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* tools/StackTrace.cpp: Added.
(JSC::StackTrace::instanceSize):
(JSC::StackTrace::captureStackTrace):
(JSC::StackTrace::dump):
* tools/StackTrace.h: Added.
(JSC::StackTrace::size):
(JSC::StackTrace::StackTrace):

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

5 years agoUnreviewed, rolling out r213618.
commit-queue@webkit.org [Fri, 10 Mar 2017 18:05:46 +0000 (18:05 +0000)]
Unreviewed, rolling out r213618.
https://bugs.webkit.org/show_bug.cgi?id=169475

Suspect this is the cause of a large memory regression
(Requested by jonlee_ on #webkit).

Reverted changeset:

"Enable async image decoding for large images"
https://bugs.webkit.org/show_bug.cgi?id=165039
http://trac.webkit.org/changeset/213618

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

5 years agoB3 should have comprehensive support for atomic operations
fpizlo@apple.com [Fri, 10 Mar 2017 17:49:42 +0000 (17:49 +0000)]
B3 should have comprehensive support for atomic operations
https://bugs.webkit.org/show_bug.cgi?id=162349

Reviewed by Keith Miller.

Source/JavaScriptCore:

This adds the following capabilities to B3:

- Atomic weak/strong unfenced/fenced compare-and-swap
- Atomic add/sub/or/and/xor/xchg
- Acquire/release fencing on loads/stores
- Fenceless load-load dependencies

This adds lowering to the following instructions on x86:

- lock cmpxchg
- lock xadd
- lock add/sub/or/and/xor/xchg

This adds lowering to the following instructions on ARM64:

- ldar and friends
- stlr and friends
- ldxr and friends (unfenced LL)
- stxr and friends (unfended SC)
- ldaxr and friends (fenced LL)
- stlxr and friends (fenced SC)
- eor as a fenceless load-load dependency

This does instruction selection pattern matching to ensure that weak/strong CAS and all of the
variants of fences and atomic math ops get lowered to the best possible instruction sequence.
For example, we support the Equal(AtomicStrongCAS(expected, ...), expected) pattern and a bunch
of its friends. You can say Branch(Equal(AtomicStrongCAS(expected, ...), expected)) and it will
generate the best possible branch sequence on x86 and ARM64.

B3 now knows how to model all of the kinds of fencing. It knows that acq loads are ordered with
respect to each other and with respect to rel stores, creating sequential consistency that
transcends just the acq/rel fences themselves (see Effects::fence). It knows that the phantom
fence effects may only target some abstract heaps but not others, so that load elimination and
store sinking can still operate across fences if you just tell B3 that the fence does not alias
those accesses. This makes it super easy to teach B3 that some of your heap is thread-local.
Even better, it lets you express fine-grained dependencies where the atomics that affect one
property in shared memory do not clobber non-atomics that ffect some other property in shared
memory.

One of my favorite features is Depend, which allows you to express load-load dependencies. On
x86 it lowers to nothing, while on ARM64 it lowers to eor.

This also exposes a common atomicWeakCAS API to the x86_64/ARM64 MacroAssemblers. Same for
acq/rel. JSC's 64-bit JITs are now a happy concurrency playground.

This doesn't yet expose the functionality to JS or wasm. SAB still uses the non-intrinsic
implementations of the Atomics object, for now.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::ldar):
(JSC::ARM64Assembler::ldxr):
(JSC::ARM64Assembler::ldaxr):
(JSC::ARM64Assembler::stxr):
(JSC::ARM64Assembler::stlr):
(JSC::ARM64Assembler::stlxr):
(JSC::ARM64Assembler::excepnGenerationImmMask):
(JSC::ARM64Assembler::exoticLoad):
(JSC::ARM64Assembler::storeRelease):
(JSC::ARM64Assembler::exoticStore):
* assembler/AbstractMacroAssembler.cpp: Added.
(WTF::printInternal):
* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssemblerBase::invert):
* assembler/MacroAssembler.h:
* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::loadAcq8SignedExtendTo32):
(JSC::MacroAssemblerARM64::loadAcq8):
(JSC::MacroAssemblerARM64::storeRel8):
(JSC::MacroAssemblerARM64::loadAcq16SignedExtendTo32):
(JSC::MacroAssemblerARM64::loadAcq16):
(JSC::MacroAssemblerARM64::storeRel16):
(JSC::MacroAssemblerARM64::loadAcq32):
(JSC::MacroAssemblerARM64::loadAcq64):
(JSC::MacroAssemblerARM64::storeRel32):
(JSC::MacroAssemblerARM64::storeRel64):
(JSC::MacroAssemblerARM64::loadLink8):
(JSC::MacroAssemblerARM64::loadLinkAcq8):
(JSC::MacroAssemblerARM64::storeCond8):
(JSC::MacroAssemblerARM64::storeCondRel8):
(JSC::MacroAssemblerARM64::loadLink16):
(JSC::MacroAssemblerARM64::loadLinkAcq16):
(JSC::MacroAssemblerARM64::storeCond16):
(JSC::MacroAssemblerARM64::storeCondRel16):
(JSC::MacroAssemblerARM64::loadLink32):
(JSC::MacroAssemblerARM64::loadLinkAcq32):
(JSC::MacroAssemblerARM64::storeCond32):
(JSC::MacroAssemblerARM64::storeCondRel32):
(JSC::MacroAssemblerARM64::loadLink64):
(JSC::MacroAssemblerARM64::loadLinkAcq64):
(JSC::MacroAssemblerARM64::storeCond64):
(JSC::MacroAssemblerARM64::storeCondRel64):
(JSC::MacroAssemblerARM64::atomicStrongCAS8):
(JSC::MacroAssemblerARM64::atomicStrongCAS16):
(JSC::MacroAssemblerARM64::atomicStrongCAS32):
(JSC::MacroAssemblerARM64::atomicStrongCAS64):
(JSC::MacroAssemblerARM64::atomicRelaxedStrongCAS8):
(JSC::MacroAssemblerARM64::atomicRelaxedStrongCAS16):
(JSC::MacroAssemblerARM64::atomicRelaxedStrongCAS32):
(JSC::MacroAssemblerARM64::atomicRelaxedStrongCAS64):
(JSC::MacroAssemblerARM64::branchAtomicWeakCAS8):
(JSC::MacroAssemblerARM64::branchAtomicWeakCAS16):
(JSC::MacroAssemblerARM64::branchAtomicWeakCAS32):
(JSC::MacroAssemblerARM64::branchAtomicWeakCAS64):
(JSC::MacroAssemblerARM64::branchAtomicRelaxedWeakCAS8):
(JSC::MacroAssemblerARM64::branchAtomicRelaxedWeakCAS16):
(JSC::MacroAssemblerARM64::branchAtomicRelaxedWeakCAS32):
(JSC::MacroAssemblerARM64::branchAtomicRelaxedWeakCAS64):
(JSC::MacroAssemblerARM64::depend32):
(JSC::MacroAssemblerARM64::depend64):
(JSC::MacroAssemblerARM64::loadLink):
(JSC::MacroAssemblerARM64::loadLinkAcq):
(JSC::MacroAssemblerARM64::storeCond):
(JSC::MacroAssemblerARM64::storeCondRel):
(JSC::MacroAssemblerARM64::signExtend):
(JSC::MacroAssemblerARM64::branch):
(JSC::MacroAssemblerARM64::atomicStrongCAS):
(JSC::MacroAssemblerARM64::atomicRelaxedStrongCAS):
(JSC::MacroAssemblerARM64::branchAtomicWeakCAS):
(JSC::MacroAssemblerARM64::branchAtomicRelaxedWeakCAS):
(JSC::MacroAssemblerARM64::extractSimpleAddress):
(JSC::MacroAssemblerARM64::signExtend<8>):
(JSC::MacroAssemblerARM64::signExtend<16>):
(JSC::MacroAssemblerARM64::branch<64>):
* assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::add32):
(JSC::MacroAssemblerX86Common::and32):
(JSC::MacroAssemblerX86Common::and16):
(JSC::MacroAssemblerX86Common::and8):
(JSC::MacroAssemblerX86Common::neg32):
(JSC::MacroAssemblerX86Common::neg16):
(JSC::MacroAssemblerX86Common::neg8):
(JSC::MacroAssemblerX86Common::or32):
(JSC::MacroAssemblerX86Common::or16):
(JSC::MacroAssemblerX86Common::or8):
(JSC::MacroAssemblerX86Common::sub16):
(JSC::MacroAssemblerX86Common::sub8):
(JSC::MacroAssemblerX86Common::sub32):
(JSC::MacroAssemblerX86Common::xor32):
(JSC::MacroAssemblerX86Common::xor16):
(JSC::MacroAssemblerX86Common::xor8):
(JSC::MacroAssemblerX86Common::not32):
(JSC::MacroAssemblerX86Common::not16):
(JSC::MacroAssemblerX86Common::not8):
(JSC::MacroAssemblerX86Common::store16):
(JSC::MacroAssemblerX86Common::atomicStrongCAS8):
(JSC::MacroAssemblerX86Common::atomicStrongCAS16):
(JSC::MacroAssemblerX86Common::atomicStrongCAS32):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS8):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS16):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS32):
(JSC::MacroAssemblerX86Common::atomicWeakCAS8):
(JSC::MacroAssemblerX86Common::atomicWeakCAS16):
(JSC::MacroAssemblerX86Common::atomicWeakCAS32):
(JSC::MacroAssemblerX86Common::branchAtomicWeakCAS8):
(JSC::MacroAssemblerX86Common::branchAtomicWeakCAS16):
(JSC::MacroAssemblerX86Common::branchAtomicWeakCAS32):
(JSC::MacroAssemblerX86Common::atomicRelaxedWeakCAS8):
(JSC::MacroAssemblerX86Common::atomicRelaxedWeakCAS16):
(JSC::MacroAssemblerX86Common::atomicRelaxedWeakCAS32):
(JSC::MacroAssemblerX86Common::branchAtomicRelaxedWeakCAS8):
(JSC::MacroAssemblerX86Common::branchAtomicRelaxedWeakCAS16):
(JSC::MacroAssemblerX86Common::branchAtomicRelaxedWeakCAS32):
(JSC::MacroAssemblerX86Common::atomicAdd8):
(JSC::MacroAssemblerX86Common::atomicAdd16):
(JSC::MacroAssemblerX86Common::atomicAdd32):
(JSC::MacroAssemblerX86Common::atomicSub8):
(JSC::MacroAssemblerX86Common::atomicSub16):
(JSC::MacroAssemblerX86Common::atomicSub32):
(JSC::MacroAssemblerX86Common::atomicAnd8):
(JSC::MacroAssemblerX86Common::atomicAnd16):
(JSC::MacroAssemblerX86Common::atomicAnd32):
(JSC::MacroAssemblerX86Common::atomicOr8):
(JSC::MacroAssemblerX86Common::atomicOr16):
(JSC::MacroAssemblerX86Common::atomicOr32):
(JSC::MacroAssemblerX86Common::atomicXor8):
(JSC::MacroAssemblerX86Common::atomicXor16):
(JSC::MacroAssemblerX86Common::atomicXor32):
(JSC::MacroAssemblerX86Common::atomicNeg8):
(JSC::MacroAssemblerX86Common::atomicNeg16):
(JSC::MacroAssemblerX86Common::atomicNeg32):
(JSC::MacroAssemblerX86Common::atomicNot8):
(JSC::MacroAssemblerX86Common::atomicNot16):
(JSC::MacroAssemblerX86Common::atomicNot32):
(JSC::MacroAssemblerX86Common::atomicXchgAdd8):
(JSC::MacroAssemblerX86Common::atomicXchgAdd16):
(JSC::MacroAssemblerX86Common::atomicXchgAdd32):
(JSC::MacroAssemblerX86Common::atomicXchg8):
(JSC::MacroAssemblerX86Common::atomicXchg16):
(JSC::MacroAssemblerX86Common::atomicXchg32):
(JSC::MacroAssemblerX86Common::loadAcq8):
(JSC::MacroAssemblerX86Common::loadAcq8SignedExtendTo32):
(JSC::MacroAssemblerX86Common::loadAcq16):
(JSC::MacroAssemblerX86Common::loadAcq16SignedExtendTo32):
(JSC::MacroAssemblerX86Common::loadAcq32):
(JSC::MacroAssemblerX86Common::storeRel8):
(JSC::MacroAssemblerX86Common::storeRel16):
(JSC::MacroAssemblerX86Common::storeRel32):
(JSC::MacroAssemblerX86Common::storeFence):
(JSC::MacroAssemblerX86Common::loadFence):
(JSC::MacroAssemblerX86Common::replaceWithJump):
(JSC::MacroAssemblerX86Common::maxJumpReplacementSize):
(JSC::MacroAssemblerX86Common::patchableJumpSize):
(JSC::MacroAssemblerX86Common::supportsFloatingPointRounding):
(JSC::MacroAssemblerX86Common::supportsAVX):
(JSC::MacroAssemblerX86Common::updateEax1EcxFlags):
(JSC::MacroAssemblerX86Common::x86Condition):
(JSC::MacroAssemblerX86Common::atomicStrongCAS):
(JSC::MacroAssemblerX86Common::branchAtomicStrongCAS):
* assembler/MacroAssemblerX86_64.h:
(JSC::MacroAssemblerX86_64::add64):
(JSC::MacroAssemblerX86_64::and64):
(JSC::MacroAssemblerX86_64::neg64):
(JSC::MacroAssemblerX86_64::or64):
(JSC::MacroAssemblerX86_64::sub64):
(JSC::MacroAssemblerX86_64::xor64):
(JSC::MacroAssemblerX86_64::not64):
(JSC::MacroAssemblerX86_64::store64):
(JSC::MacroAssemblerX86_64::atomicStrongCAS64):
(JSC::MacroAssemblerX86_64::branchAtomicStrongCAS64):
(JSC::MacroAssemblerX86_64::atomicWeakCAS64):
(JSC::MacroAssemblerX86_64::branchAtomicWeakCAS64):
(JSC::MacroAssemblerX86_64::atomicRelaxedWeakCAS64):
(JSC::MacroAssemblerX86_64::branchAtomicRelaxedWeakCAS64):
(JSC::MacroAssemblerX86_64::atomicAdd64):
(JSC::MacroAssemblerX86_64::atomicSub64):
(JSC::MacroAssemblerX86_64::atomicAnd64):
(JSC::MacroAssemblerX86_64::atomicOr64):
(JSC::MacroAssemblerX86_64::atomicXor64):
(JSC::MacroAssemblerX86_64::atomicNeg64):
(JSC::MacroAssemblerX86_64::atomicNot64):
(JSC::MacroAssemblerX86_64::atomicXchgAdd64):
(JSC::MacroAssemblerX86_64::atomicXchg64):
(JSC::MacroAssemblerX86_64::loadAcq64):
(JSC::MacroAssemblerX86_64::storeRel64):
* assembler/X86Assembler.h:
(JSC::X86Assembler::addl_mr):
(JSC::X86Assembler::addq_mr):
(JSC::X86Assembler::addq_rm):
(JSC::X86Assembler::addq_im):
(JSC::X86Assembler::andl_mr):
(JSC::X86Assembler::andl_rm):
(JSC::X86Assembler::andw_rm):
(JSC::X86Assembler::andb_rm):
(JSC::X86Assembler::andl_im):
(JSC::X86Assembler::andw_im):
(JSC::X86Assembler::andb_im):
(JSC::X86Assembler::andq_mr):
(JSC::X86Assembler::andq_rm):
(JSC::X86Assembler::andq_im):
(JSC::X86Assembler::incq_m):
(JSC::X86Assembler::negq_m):
(JSC::X86Assembler::negl_m):
(JSC::X86Assembler::negw_m):
(JSC::X86Assembler::negb_m):
(JSC::X86Assembler::notl_m):
(JSC::X86Assembler::notw_m):
(JSC::X86Assembler::notb_m):
(JSC::X86Assembler::notq_m):
(JSC::X86Assembler::orl_mr):
(JSC::X86Assembler::orl_rm):
(JSC::X86Assembler::orw_rm):
(JSC::X86Assembler::orb_rm):
(JSC::X86Assembler::orl_im):
(JSC::X86Assembler::orw_im):
(JSC::X86Assembler::orb_im):
(JSC::X86Assembler::orq_mr):
(JSC::X86Assembler::orq_rm):
(JSC::X86Assembler::orq_im):
(JSC::X86Assembler::subl_mr):
(JSC::X86Assembler::subl_rm):
(JSC::X86Assembler::subw_rm):
(JSC::X86Assembler::subb_rm):
(JSC::X86Assembler::subl_im):
(JSC::X86Assembler::subw_im):
(JSC::X86Assembler::subb_im):
(JSC::X86Assembler::subq_mr):
(JSC::X86Assembler::subq_rm):
(JSC::X86Assembler::subq_im):
(JSC::X86Assembler::xorl_mr):
(JSC::X86Assembler::xorl_rm):
(JSC::X86Assembler::xorl_im):
(JSC::X86Assembler::xorw_rm):
(JSC::X86Assembler::xorw_im):
(JSC::X86Assembler::xorb_rm):
(JSC::X86Assembler::xorb_im):
(JSC::X86Assembler::xorq_im):
(JSC::X86Assembler::xorq_rm):
(JSC::X86Assembler::xorq_mr):
(JSC::X86Assembler::xchgb_rm):
(JSC::X86Assembler::xchgw_rm):
(JSC::X86Assembler::xchgl_rm):
(JSC::X86Assembler::xchgq_rm):
(JSC::X86Assembler::movw_im):
(JSC::X86Assembler::movq_i32m):
(JSC::X86Assembler::cmpxchgb_rm):
(JSC::X86Assembler::cmpxchgw_rm):
(JSC::X86Assembler::cmpxchgl_rm):
(JSC::X86Assembler::cmpxchgq_rm):
(JSC::X86Assembler::xaddb_rm):
(JSC::X86Assembler::xaddw_rm):
(JSC::X86Assembler::xaddl_rm):
(JSC::X86Assembler::xaddq_rm):
(JSC::X86Assembler::X86InstructionFormatter::SingleInstructionBufferWriter::memoryModRM):
* b3/B3AtomicValue.cpp: Added.
(JSC::B3::AtomicValue::~AtomicValue):
(JSC::B3::AtomicValue::dumpMeta):
(JSC::B3::AtomicValue::cloneImpl):
(JSC::B3::AtomicValue::AtomicValue):
* b3/B3AtomicValue.h: Added.
* b3/B3BasicBlock.h:
* b3/B3BlockInsertionSet.cpp:
(JSC::B3::BlockInsertionSet::BlockInsertionSet):
(JSC::B3::BlockInsertionSet::insert): Deleted.
(JSC::B3::BlockInsertionSet::insertBefore): Deleted.
(JSC::B3::BlockInsertionSet::insertAfter): Deleted.
(JSC::B3::BlockInsertionSet::execute): Deleted.
* b3/B3BlockInsertionSet.h:
* b3/B3Effects.cpp:
(JSC::B3::Effects::interferes):
(JSC::B3::Effects::operator==):
(JSC::B3::Effects::dump):
* b3/B3Effects.h:
(JSC::B3::Effects::forCall):
(JSC::B3::Effects::mustExecute):
* b3/B3EliminateCommonSubexpressions.cpp:
* b3/B3Generate.cpp:
(JSC::B3::generateToAir):
* b3/B3GenericBlockInsertionSet.h: Added.
(JSC::B3::GenericBlockInsertionSet::GenericBlockInsertionSet):
(JSC::B3::GenericBlockInsertionSet::insert):
(JSC::B3::GenericBlockInsertionSet::insertBefore):
(JSC::B3::GenericBlockInsertionSet::insertAfter):
(JSC::B3::GenericBlockInsertionSet::execute):
* b3/B3HeapRange.h:
(JSC::B3::HeapRange::operator|):
* b3/B3InsertionSet.cpp:
(JSC::B3::InsertionSet::insertClone):
* b3/B3InsertionSet.h:
* b3/B3LegalizeMemoryOffsets.cpp:
* b3/B3LowerMacros.cpp:
(JSC::B3::lowerMacros):
* b3/B3LowerMacrosAfterOptimizations.cpp:
* b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::LowerToAir):
(JSC::B3::Air::LowerToAir::run):
(JSC::B3::Air::LowerToAir::effectiveAddr):
(JSC::B3::Air::LowerToAir::addr):
(JSC::B3::Air::LowerToAir::loadPromiseAnyOpcode):
(JSC::B3::Air::LowerToAir::appendShift):
(JSC::B3::Air::LowerToAir::tryAppendStoreBinOp):
(JSC::B3::Air::LowerToAir::storeOpcode):
(JSC::B3::Air::LowerToAir::createStore):
(JSC::B3::Air::LowerToAir::finishAppendingInstructions):
(JSC::B3::Air::LowerToAir::newBlock):
(JSC::B3::Air::LowerToAir::splitBlock):
(JSC::B3::Air::LowerToAir::fillStackmap):
(JSC::B3::Air::LowerToAir::appendX86Div):
(JSC::B3::Air::LowerToAir::appendX86UDiv):
(JSC::B3::Air::LowerToAir::loadLinkOpcode):
(JSC::B3::Air::LowerToAir::storeCondOpcode):
(JSC::B3::Air::LowerToAir::appendCAS):
(JSC::B3::Air::LowerToAir::appendVoidAtomic):
(JSC::B3::Air::LowerToAir::appendGeneralAtomic):
(JSC::B3::Air::LowerToAir::lower):
(JSC::B3::Air::LowerToAir::lowerX86Div): Deleted.
(JSC::B3::Air::LowerToAir::lowerX86UDiv): Deleted.
* b3/B3LowerToAir.h:
* b3/B3MemoryValue.cpp:
(JSC::B3::MemoryValue::isLegalOffset):
(JSC::B3::MemoryValue::accessType):
(JSC::B3::MemoryValue::accessBank):
(JSC::B3::MemoryValue::accessByteSize):
(JSC::B3::MemoryValue::dumpMeta):
(JSC::B3::MemoryValue::MemoryValue):
(JSC::B3::MemoryValue::accessWidth): Deleted.
* b3/B3MemoryValue.h:
* b3/B3MemoryValueInlines.h: Added.
(JSC::B3::MemoryValue::isLegalOffset):
(JSC::B3::MemoryValue::requiresSimpleAddr):
(JSC::B3::MemoryValue::accessWidth):
* b3/B3MoveConstants.cpp:
* b3/B3NativeTraits.h: Added.
* b3/B3Opcode.cpp:
(JSC::B3::storeOpcode):
(WTF::printInternal):
* b3/B3Opcode.h:
(JSC::B3::isLoad):
(JSC::B3::isStore):
(JSC::B3::isLoadStore):
(JSC::B3::isAtomic):
(JSC::B3::isAtomicCAS):
(JSC::B3::isAtomicXchg):
(JSC::B3::isMemoryAccess):
(JSC::B3::signExtendOpcode):
* b3/B3Procedure.cpp:
(JSC::B3::Procedure::dump):
* b3/B3Procedure.h:
(JSC::B3::Procedure::hasQuirks):
(JSC::B3::Procedure::setHasQuirks):
* b3/B3PureCSE.cpp:
(JSC::B3::pureCSE):
* b3/B3PureCSE.h:
* b3/B3ReduceStrength.cpp:
* b3/B3Validate.cpp:
* b3/B3Value.cpp:
(JSC::B3::Value::returnsBool):
(JSC::B3::Value::effects):
(JSC::B3::Value::key):
(JSC::B3::Value::performSubstitution):
(JSC::B3::Value::typeFor):
* b3/B3Value.h:
* b3/B3Width.cpp:
(JSC::B3::bestType):
* b3/B3Width.h:
(JSC::B3::canonicalWidth):
(JSC::B3::isCanonicalWidth):
(JSC::B3::mask):
* b3/air/AirArg.cpp:
(JSC::B3::Air::Arg::jsHash):
(JSC::B3::Air::Arg::dump):
(WTF::printInternal):
* b3/air/AirArg.h:
(JSC::B3::Air::Arg::isAnyUse):
(JSC::B3::Air::Arg::isColdUse):
(JSC::B3::Air::Arg::cooled):
(JSC::B3::Air::Arg::isEarlyUse):
(JSC::B3::Air::Arg::isLateUse):
(JSC::B3::Air::Arg::isAnyDef):
(JSC::B3::Air::Arg::isEarlyDef):
(JSC::B3::Air::Arg::isLateDef):
(JSC::B3::Air::Arg::isZDef):
(JSC::B3::Air::Arg::simpleAddr):
(JSC::B3::Air::Arg::statusCond):
(JSC::B3::Air::Arg::isSimpleAddr):
(JSC::B3::Air::Arg::isMemory):
(JSC::B3::Air::Arg::isStatusCond):
(JSC::B3::Air::Arg::isCondition):
(JSC::B3::Air::Arg::ptr):
(JSC::B3::Air::Arg::base):
(JSC::B3::Air::Arg::isGP):
(JSC::B3::Air::Arg::isFP):
(JSC::B3::Air::Arg::isValidForm):
(JSC::B3::Air::Arg::forEachTmpFast):
(JSC::B3::Air::Arg::forEachTmp):
(JSC::B3::Air::Arg::asAddress):
(JSC::B3::Air::Arg::asStatusCondition):
(JSC::B3::Air::Arg::isInvertible):
(JSC::B3::Air::Arg::inverted):
* b3/air/AirBasicBlock.cpp:
(JSC::B3::Air::BasicBlock::setSuccessors):
* b3/air/AirBasicBlock.h:
* b3/air/AirBlockInsertionSet.cpp: Added.
(JSC::B3::Air::BlockInsertionSet::BlockInsertionSet):
(JSC::B3::Air::BlockInsertionSet::~BlockInsertionSet):
* b3/air/AirBlockInsertionSet.h: Added.
* b3/air/AirDumpAsJS.cpp: Removed.
* b3/air/AirDumpAsJS.h: Removed.
* b3/air/AirEliminateDeadCode.cpp:
(JSC::B3::Air::eliminateDeadCode):
* b3/air/AirGenerate.cpp:
(JSC::B3::Air::prepareForGeneration):
* b3/air/AirInstInlines.h:
(JSC::B3::Air::isAtomicStrongCASValid):
(JSC::B3::Air::isBranchAtomicStrongCASValid):
(JSC::B3::Air::isAtomicStrongCAS8Valid):
(JSC::B3::Air::isAtomicStrongCAS16Valid):
(JSC::B3::Air::isAtomicStrongCAS32Valid):
(JSC::B3::Air::isAtomicStrongCAS64Valid):
(JSC::B3::Air::isBranchAtomicStrongCAS8Valid):
(JSC::B3::Air::isBranchAtomicStrongCAS16Valid):
(JSC::B3::Air::isBranchAtomicStrongCAS32Valid):
(JSC::B3::Air::isBranchAtomicStrongCAS64Valid):
* b3/air/AirOpcode.opcodes:
* b3/air/AirOptimizeBlockOrder.cpp:
(JSC::B3::Air::optimizeBlockOrder):
* b3/air/AirPadInterference.cpp:
(JSC::B3::Air::padInterference):
* b3/air/AirSpillEverything.cpp:
(JSC::B3::Air::spillEverything):
* b3/air/opcode_generator.rb:
* b3/testb3.cpp:
(JSC::B3::testLoadAcq42):
(JSC::B3::testStoreRelAddLoadAcq32):
(JSC::B3::testStoreRelAddLoadAcq8):
(JSC::B3::testStoreRelAddFenceLoadAcq8):
(JSC::B3::testStoreRelAddLoadAcq16):
(JSC::B3::testStoreRelAddLoadAcq64):
(JSC::B3::testTrappingStoreElimination):
(JSC::B3::testX86LeaAddAdd):
(JSC::B3::testX86LeaAddShlLeftScale1):
(JSC::B3::testAtomicWeakCAS):
(JSC::B3::testAtomicStrongCAS):
(JSC::B3::testAtomicXchg):
(JSC::B3::testDepend32):
(JSC::B3::testDepend64):
(JSC::B3::run):
* runtime/Options.h:

Websites/webkit.org:

Document the new opcodes!

* docs/b3/intermediate-representation.html:

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

5 years ago[GTK] Unreviewed test gardening
jfernandez@igalia.com [Fri, 10 Mar 2017 17:32:07 +0000 (17:32 +0000)]
[GTK] Unreviewed test gardening
https://bugs.webkit.org/show_bug.cgi?id=169470

Unreviewed GTK+ gardening. Updated test expectations after regressions r213671 and r213560.

* platform/gtk/TestExpectations:
   - imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.worker.html [ Failure ]
   - imported/w3c/web-platform-tests/WebCryptoAPI/derive_bits_keys/test_pbkdf2.html [ Failure ]
   - imported/w3c/web-platform-tests/WebCryptoAPI/import_export/ec_importKey.worker.html [ Failure ]
   - imported/w3c/web-platform-tests/WebCryptoAPI/import_export/test_ec_importKey.html [ Failure ]

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

5 years agoSource/WebCore:
antti@apple.com [Fri, 10 Mar 2017 16:01:50 +0000 (16:01 +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: https://svn.webkit.org/repository/webkit/trunk@213712 268f45cc-cd09-0410-ab3c-d52691b4dbfc

5 years agoimported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes...
antti@apple.com [Fri, 10 Mar 2017 15:38:40 +0000 (15:38 +0000)]
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html is unreliable
https://bugs.webkit.org/show_bug.cgi?id=169465

Reviewed by Zalan Bujtas.

LayoutTests/imported/w3c:

* web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-expected.txt:

Source/WebCore:

It shows all subtests passing but that is a bug. We don't even support all the unit types.
The test occasionally fails when reloading, that failing results are actually the correct ones.

* css/parser/SizesAttributeParser.cpp:
(WebCore::SizesAttributeParser::SizesAttributeParser):

    Ensure we have correct size for the iframe before parsing 'sizes' attribute values. The interpretation of
    these may depend on the iframe dimensions.

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

5 years agoUnreviewed typo fixes after r213652.
ossy@webkit.org [Fri, 10 Mar 2017 13:47:19 +0000 (13:47 +0000)]
Unreviewed typo fixes after r213652.
https://bugs.webkit.org/show_bug.cgi?id=168920

* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::replaceWithBreakpoint):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::replaceWithBreakpoint):

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

5 years agoUnreviewed ARM buildfix after r213652.
ossy@webkit.org [Fri, 10 Mar 2017 13:32:18 +0000 (13:32 +0000)]
Unreviewed ARM buildfix after r213652.
https://bugs.webkit.org/show_bug.cgi?id=168920

r213652 used replaceWithBrk and replaceWithBkpt names for the same
function, which was inconsistent and caused build error in ARMAssembler.

* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::replaceWithBkpt): Renamed replaceWithBrk to replaceWithBkpt.
(JSC::ARM64Assembler::replaceWithBrk): Deleted.
* assembler/ARMAssembler.h:
(JSC::ARMAssembler::replaceWithBkpt): Renamed replaceWithBrk to replaceWithBkpt.
(JSC::ARMAssembler::replaceWithBrk): Deleted.
* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::replaceWithBreakpoint):

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

5 years ago[WK2] Guard GLib-specific typedefs in InjectedBundle.h with USE(GLIB)
zandobersek@gmail.com [Fri, 10 Mar 2017 13:02:16 +0000 (13:02 +0000)]
[WK2] Guard GLib-specific typedefs in InjectedBundle.h with USE(GLIB)
https://bugs.webkit.org/show_bug.cgi?id=169464

Reviewed by Carlos Garcia Campos.

* WebProcess/InjectedBundle/InjectedBundle.h: Use the more appropriate
USE(GLIB) guard for the two typedefs revolving around GModule, instead
of the PLATFORM(GTK) guard.

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

5 years agoUnreviewed Win64 build fix. FTL is not ready to be turned on yet.
pvollan@apple.com [Fri, 10 Mar 2017 11:56:19 +0000 (11:56 +0000)]
Unreviewed Win64 build fix. FTL is not ready to be turned on yet.

* Source/cmake/OptionsWin.cmake:

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

5 years ago[mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html...
commit-queue@webkit.org [Fri, 10 Mar 2017 11:31:56 +0000 (11:31 +0000)]
[mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=168409

Unreviewed.

Add some debugging in the hope of understanding why airplay-button.html fails once a day on bots.

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

Source/WebCore:

* Modules/modern-media-controls/controls/scheduler.js:
(const.scheduler.new.prototype.scheduleLayout):
(const.scheduler.new.prototype.unscheduleLayout):
(const.scheduler.new.prototype._requestFrameIfNeeded):
(const.scheduler.new.prototype._frameDidFire):
(const.scheduler.new.prototype._layout):

LayoutTests:

* media/modern-media-controls/airplay-button/airplay-button-expected.txt:
* media/modern-media-controls/airplay-button/airplay-button.html:

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

5 years agoUnreviewed AArch64 Linux buildfix after r213645.
ossy@webkit.org [Fri, 10 Mar 2017 10:30:30 +0000 (10:30 +0000)]
Unreviewed AArch64 Linux buildfix after r213645.
https://bugs.webkit.org/show_bug.cgi?id=169300

* wtf/Atomics.h: intptr_t and int64_t are typedefs for long int on Linux.
They are different types only on Darwin platforms.

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

5 years agoWin64 build fix.
achristensen@apple.com [Fri, 10 Mar 2017 08:36:11 +0000 (08:36 +0000)]
Win64 build fix.

.:

* Source/cmake/OptionsWin.cmake:
WASM got turned on on Win64.  Judging by the state of WasmMemory.cpp, I'm going to
assume this was a mistake and turn it off until someone writes a version that uses
VirtualAlloc/VirtualFree instead of mmap.
The FTL seems a bit unstable, though.  This fixes the build, but more fixes are necessary.

Source/JavaScriptCore:

* b3/B3FenceValue.h:
* b3/B3Value.h:
Putting JS_EXPORT_PRIVATE on member functions in classes that are declared with JS_EXPORT_PRIVATE
doesn't accomplish anything except making Visual Studio mad.
* b3/air/opcode_generator.rb:
winnt.h has naming collisions with enum values from AirOpcode.h.
For example, MemoryFence is #defined to be _mm_mfence, which is declared to be a function in emmintrin.h.
RotateLeft32 is #defined to be _rotl, which is declared to be a function in <stdlib.h>
A clean solution is just to put Opcode:: before the references to the opcode names to tell Visual Studio
that it is referring to the enum value in AirOpcode.h and not the function declaration elsewhere.

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

5 years agoUnreviewed, fix documentation typos
tpopela@redhat.com [Fri, 10 Mar 2017 07:19:04 +0000 (07:19 +0000)]
Unreviewed, fix documentation typos

* UIProcess/API/gtk/WebKitAuthenticationRequest.cpp:
* UIProcess/API/gtk/WebKitContextMenuActions.h:
* UIProcess/API/gtk/WebKitContextMenuItem.cpp:
* UIProcess/API/gtk/WebKitDownload.cpp:
(webkitDownloadNotifyProgress):
* UIProcess/API/gtk/WebKitEditorState.cpp:
* UIProcess/API/gtk/WebKitEditorState.h:
* UIProcess/API/gtk/WebKitError.h:
* UIProcess/API/gtk/WebKitFileChooserRequest.cpp:
* UIProcess/API/gtk/WebKitFindController.cpp:
* UIProcess/API/gtk/WebKitGeolocationPermissionRequest.cpp:
* UIProcess/API/gtk/WebKitHitTestResult.cpp:
* UIProcess/API/gtk/WebKitPolicyDecision.cpp:
* UIProcess/API/gtk/WebKitPrintOperation.h:
* UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp:
* UIProcess/API/gtk/WebKitSecurityManager.cpp:
* UIProcess/API/gtk/WebKitSettings.cpp:
(webkit_settings_class_init):
* UIProcess/API/gtk/WebKitUserMediaPermissionRequest.cpp:
(webkitUserMediaPermissionRequestAllow):
* UIProcess/API/gtk/WebKitWebContext.cpp:
* UIProcess/API/gtk/WebKitWebInspector.cpp:
(webkit_web_inspector_class_init):
* UIProcess/API/gtk/WebKitWebView.cpp:
(webkit_web_view_class_init):
* UIProcess/API/gtk/WebKitWebView.h:
* UIProcess/API/gtk/WebKitWebsiteDataManager.cpp:
* WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp:
* WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
(webkit_web_page_class_init):

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

5 years agoUnreviewed, rolling out r213695.
ryanhaddad@apple.com [Fri, 10 Mar 2017 05:18:28 +0000 (05:18 +0000)]
Unreviewed, rolling out r213695.

This change broke the Windows build.

Reverted changeset:

"Implement a StackTrace utility object that can capture stack
traces for debugging."
https://bugs.webkit.org/show_bug.cgi?id=169454
http://trac.webkit.org/changeset/213695

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

5 years agoUnreviewed, rolling out r213633.
ryanhaddad@apple.com [Fri, 10 Mar 2017 05:08:40 +0000 (05:08 +0000)]
Unreviewed, rolling out r213633.

This change caused LayoutTest imported/w3c/web-platform-
tests/html/semantics/embedded-content/the-img-
element/sizes/parse-a-sizes-attribute.html to become a flaky
failure.

Reverted changeset:

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

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

5 years agoRebaseline js/dom/global-constructors-attributes.html.
ryanhaddad@apple.com [Fri, 10 Mar 2017 04:55:19 +0000 (04:55 +0000)]
Rebaseline js/dom/global-constructors-attributes.html.

Unreviewed test gardening.

* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:

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

5 years agoFix CMake build
achristensen@apple.com [Fri, 10 Mar 2017 03:43:10 +0000 (03:43 +0000)]
Fix CMake build

* PlatformMac.cmake:

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

5 years agoFix GTK build after r213696
achristensen@apple.com [Fri, 10 Mar 2017 02:37:58 +0000 (02:37 +0000)]
Fix GTK build after r213696

Source/WebCore:

* PlatformMac.cmake:

Source/WebKit2:

* CMakeLists.txt:
* PlatformMac.cmake:

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

5 years ago[ESnext] Implement Object Rest - Implementing Object Rest Destructuring
commit-queue@webkit.org [Fri, 10 Mar 2017 02:00:33 +0000 (02:00 +0000)]
[ESnext] Implement Object Rest - Implementing Object Rest Destructuring
https://bugs.webkit.org/show_bug.cgi?id=167962

Patch by Caio Lima <ticaiolima@gmail.com> on 2017-03-09
Reviewed by Keith Miller.

JSTests:

* stress/object-rest-deconstruct.js: Added.
(let.assert):
(let.assertPropDescriptor):
(catch):
(get 3):
(foo):
(let.src.get y):
(let.src.set y):
(let.gen):

Source/JavaScriptCore:

Object Rest/Spread Destructing proposal is in stage 3[1] and this
Patch is a prototype implementation of it. A simple change over the
parser was necessary to support the new '...' token on Object Pattern
destruction rule. In the bytecode generator side, We changed the
bytecode generated on ObjectPatternNode::bindValue to store in an
array identifiers of already destructed properties, following spec draft
section[2], and then pass it as excludedNames to CopyDataProperties.
The rest destruction the calls copyDataProperties to perform the
copy of rest properties in rhs.

We also implemented CopyDataProperties as private JS global operation
on builtins/GlobalOperations.js following it's specification on [3].
It is implemented using Set object to verify if a property is on
excludedNames to keep this algorithm with O(n + m) complexity, where n
= number of source's own properties and m = excludedNames.length.

As a requirement to use JSSets as constants, a change in
CodeBlock::create API was necessary, because JSSet creation can throws OOM
exception. Now, CodeBlock::finishCreation returns ```false``` if an
execption is throwed by
CodeBlock::setConstantIdentifierSetRegisters and then we return
nullptr to ScriptExecutable::newCodeBlockFor. It is responsible to
check if CodeBlock was constructed properly and then, throw OOM
exception to the correct scope.

[1] - https://github.com/sebmarkbage/ecmascript-rest-spread
[2] - http://sebmarkbage.github.io/ecmascript-rest-spread/#Rest-RuntimeSemantics-PropertyDestructuringAssignmentEvaluation
[3] - http://sebmarkbage.github.io/ecmascript-rest-spread/#AbstractOperations-CopyDataProperties

* builtins/BuiltinNames.h:
* builtins/GlobalOperations.js:
(globalPrivate.copyDataProperties):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::setConstantIdentifierSetRegisters):
* bytecode/CodeBlock.h:
* bytecode/EvalCodeBlock.h:
(JSC::EvalCodeBlock::create):
* bytecode/FunctionCodeBlock.h:
(JSC::FunctionCodeBlock::create):
* bytecode/ModuleProgramCodeBlock.h:
(JSC::ModuleProgramCodeBlock::create):
* bytecode/ProgramCodeBlock.h:
(JSC::ProgramCodeBlock::create):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::addSetConstant):
(JSC::UnlinkedCodeBlock::constantIdentifierSets):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitLoad):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ObjectPatternNode::bindValue):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::appendObjectPatternEntry):
(JSC::ASTBuilder::appendObjectPatternRestEntry):
(JSC::ASTBuilder::setContainsObjectRestElement):
* parser/Nodes.h:
(JSC::ObjectPatternNode::appendEntry):
(JSC::ObjectPatternNode::setContainsRestElement):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseDestructuringPattern):
(JSC::Parser<LexerType>::parseProperty):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::operatorStackPop):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::privateToObject):
* runtime/JSGlobalObjectFunctions.h:
* runtime/ScriptExecutable.cpp:
(JSC::ScriptExecutable::newCodeBlockFor):

Source/WTF:

* wtf/HashSet.h:
(WTF::=):

LayoutTests:

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:

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

5 years agoExpose public APIs for content filters
achristensen@apple.com [Fri, 10 Mar 2017 01:48:30 +0000 (01:48 +0000)]
Expose public APIs for content filters
https://bugs.webkit.org/show_bug.cgi?id=150479

Reviewed by Brady Eidson and Geoff Garen.

Source/WebCore:

* English.lproj/Localizable.strings:

Source/WebKit2:

This takes _WKUserContentExtensionStore and _WKUserContentFilter and turns them into the consistently-named public API
WKContentExtensionStore and WKContentExtension respectively with the same design and functionaly of the original SPI.
We also added public functions to WKUserContentController corresponding to existing private functions.

The old SPI ObjC classes are now just wrappers around the new ObjC classes, which are wrappers around C++ objects in the API namespace.

The peak-memory-reducing optimization of having NS_RELEASES_ARGUMENT in _compileContentExtensionForIdentifier is kept for Safari,
but the public API doesn't need such an optimization.  The public compileContentExtensionForIdentifier will not deallocate the input
NSString during compiling.

We moved the error codes into the WKErrorDomain, which requires changing the values of the error codes and domain, but source
compiled that uses the SPI before and after should still work.  Using new applications with old frameworks or vice versa will
have unexpected error codes, though.

* Shared/API/APIObject.h:
* Shared/API/c/WKDeprecatedFunctions.cpp:
(WKPageGroupAddUserContentFilter):
(WKPageGroupRemoveUserContentFilter):
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):
* UIProcess/API/APIContentExtension.cpp: Copied from UIProcess/API/APIUserContentExtension.cpp.
(API::ContentExtension::ContentExtension):
(API::ContentExtension::~ContentExtension):
(API::UserContentExtension::UserContentExtension): Deleted.
(API::UserContentExtension::~UserContentExtension): Deleted.
* UIProcess/API/APIContentExtension.h: Copied from UIProcess/API/APIUserContentExtension.h.
* UIProcess/API/APIContentExtensionStore.cpp: Copied from UIProcess/API/APIUserContentExtensionStore.cpp.
(API::ContentExtensionStore::defaultStore):
(API::ContentExtensionStore::storeWithPath):
(API::ContentExtensionStore::ContentExtensionStore):
(API::ContentExtensionStore::~ContentExtensionStore):
(API::compiledToFile):
(API::createExtension):
(API::ContentExtensionStore::lookupContentExtension):
(API::ContentExtensionStore::compileContentExtension):
(API::ContentExtensionStore::removeContentExtension):
(API::ContentExtensionStore::synchronousRemoveAllContentExtensions):
(API::ContentExtensionStore::invalidateContentExtensionVersion):
(API::contentExtensionStoreErrorCategory):
(API::UserContentExtensionStore::defaultStore): Deleted.
(API::UserContentExtensionStore::storeWithPath): Deleted.
(API::UserContentExtensionStore::UserContentExtensionStore): Deleted.
(API::UserContentExtensionStore::~UserContentExtensionStore): Deleted.
(API::UserContentExtensionStore::lookupContentExtension): Deleted.
(API::UserContentExtensionStore::compileContentExtension): Deleted.
(API::UserContentExtensionStore::removeContentExtension): Deleted.
(API::UserContentExtensionStore::synchronousRemoveAllContentExtensions): Deleted.
(API::UserContentExtensionStore::invalidateContentExtensionVersion): Deleted.
(API::userContentExtensionStoreErrorCategory): Deleted.
* UIProcess/API/APIContentExtensionStore.h: Copied from UIProcess/API/APIUserContentExtensionStore.h.
(API::make_error_code):
* UIProcess/API/APIUserContentExtension.cpp: Removed.
* UIProcess/API/APIUserContentExtension.h: Removed.
* UIProcess/API/APIUserContentExtensionStore.cpp: Removed.
* UIProcess/API/APIUserContentExtensionStore.h: Removed.
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKPageGroup.cpp:
* UIProcess/API/C/WKUserContentControllerRef.cpp:
(WKUserContentControllerAddUserContentFilter):
(WKUserContentControllerRemoveAllUserContentFilters):
* UIProcess/API/C/WKUserContentExtensionStoreRef.cpp:
(WKUserContentExtensionStoreGetTypeID):
* UIProcess/API/Cocoa/APIUserContentExtensionStoreCocoa.mm:
(API::ContentExtensionStore::defaultStorePath):
(API::UserContentExtensionStore::defaultStorePath): Deleted.
* UIProcess/API/Cocoa/WKContentExtension.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.h.
* UIProcess/API/Cocoa/WKContentExtension.mm: Copied from UIProcess/API/Cocoa/_WKUserContentFilter.mm.
(-[WKContentExtension dealloc]):
(-[WKContentExtension _apiObject]):
(-[_WKUserContentFilter dealloc]): Deleted.
(-[_WKUserContentFilter _apiObject]): Deleted.
* UIProcess/API/Cocoa/WKContentExtensionInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentFilterInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKContentExtensionStore.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.h.
* UIProcess/API/Cocoa/WKContentExtensionStore.mm: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm.
(-[WKContentExtensionStore dealloc]):
(+[WKContentExtensionStore defaultStore]):
(+[WKContentExtensionStore storeWithURL:]):
(-[WKContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:releasesArgument:]):
(-[WKContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[WKContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(-[WKContentExtensionStore _apiObject]):
(-[WKContentExtensionStore _removeAllContentExtensions]):
(-[WKContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
(-[WKContentExtensionStore _compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore dealloc]): Deleted.
(+[_WKUserContentExtensionStore defaultStore]): Deleted.
(+[_WKUserContentExtensionStore storeWithURL:]): Deleted.
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]): Deleted.
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]): Deleted.
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]): Deleted.
(-[_WKUserContentExtensionStore _apiObject]): Deleted.
(-[_WKUserContentExtensionStore _removeAllContentExtensions]): Deleted.
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]): Deleted.
* UIProcess/API/Cocoa/WKContentExtensionStoreInternal.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h.
(WebKit::wrapper):
* UIProcess/API/Cocoa/WKContentExtensionStorePrivate.h: Copied from UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h.
* UIProcess/API/Cocoa/WKError.h:
* UIProcess/API/Cocoa/WKError.mm:
(localizedDescriptionForErrorCode):
* UIProcess/API/Cocoa/WKUserContentController.h:
* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController addContentExtension:]):
(-[WKUserContentController removeContentExtension:]):
(-[WKUserContentController removeAllContentExtensions]):
(-[WKUserContentController _addUserContentFilter:]):
(-[WKUserContentController _removeUserContentFilter:]):
(-[WKUserContentController _removeAllUserContentFilters]):
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.h:
* UIProcess/API/Cocoa/_WKUserContentExtensionStore.mm:
(+[_WKUserContentExtensionStore defaultStore]):
(+[_WKUserContentExtensionStore storeWithURL:]):
(-[_WKUserContentExtensionStore compileContentExtensionForIdentifier:encodedContentExtension:completionHandler:]):
(-[_WKUserContentExtensionStore lookupContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore removeContentExtensionForIdentifier:completionHandler:]):
(-[_WKUserContentExtensionStore _apiObject]):
(-[_WKUserContentExtensionStore _removeAllContentExtensions]):
(-[_WKUserContentExtensionStore _invalidateContentExtensionVersionForIdentifier:]):
(-[_WKUserContentExtensionStore _initWithWKContentExtensionStore:]):
(-[_WKUserContentExtensionStore dealloc]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStoreInternal.h:
(WebKit::wrapper): Deleted.
* UIProcess/API/Cocoa/_WKUserContentExtensionStorePrivate.h:
* UIProcess/API/Cocoa/_WKUserContentFilter.mm:
(-[_WKUserContentFilter _apiObject]):
(-[_WKUserContentFilter _initWithWKContentExtension:]):
(-[_WKUserContentFilter dealloc]): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterInternal.h:
(WebKit::wrapper): Deleted.
* UIProcess/API/Cocoa/_WKUserContentFilterPrivate.h: Added.
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addContentExtension):
(WebKit::WebUserContentControllerProxy::removeContentExtension):
(WebKit::WebUserContentControllerProxy::removeAllContentExtensions):
(WebKit::WebUserContentControllerProxy::addUserContentExtension): Deleted.
(WebKit::WebUserContentControllerProxy::removeUserContentExtension): Deleted.
(WebKit::WebUserContentControllerProxy::removeAllUserContentExtensions): Deleted.
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* UIProcess/WebPageGroup.cpp:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::addContentExtensions):
(WebKit::WebUserContentController::removeContentExtension):
(WebKit::WebUserContentController::removeAllContentExtensions):
(WebKit::WebUserContentController::addUserContentExtensions): Deleted.
(WebKit::WebUserContentController::removeUserContentExtension): Deleted.
(WebKit::WebUserContentController::removeAllUserContentExtensions): Deleted.
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:
* WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
(WebKit::blockedByContentFilterError):

Tools:

Keep the existing tests to verify that I made the wrapper classes for the old SPI work correctly.
Add new identical tests for the new API are added with the new names.
We should keep both until we migrate from and remove the old SPI.
Enum error code values and strings have changed, but the API is source compatible.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKUserContentExtensionStore.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm.
(WKUserContentExtensionStoreTest::SetUp):
(TEST_F):
(checkDomain):
(_WKUserContentExtensionStoreTest::SetUp): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/_WKUserContentExtensionStore.mm:
(checkDomain):

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

5 years agoImplement a StackTrace utility object that can capture stack traces for debugging.
mark.lam@apple.com [Fri, 10 Mar 2017 01:27:32 +0000 (01:27 +0000)]
Implement a StackTrace utility object that can capture stack traces for debugging.
https://bugs.webkit.org/show_bug.cgi?id=169454

Reviewed by Michael Saboff.

The underlying implementation is hoisted right out of Assertions.cpp from the
implementations of WTFPrintBacktrace().

The reason we need this StackTrace object is because during heap debugging, we
sometimes want to capture the stack trace that allocated the objects of interest.
Dumping the stack trace directly to stdout (using WTFReportBacktrace()) may
perturb the execution profile sufficiently that an issue may not reproduce,
while alternatively, just capturing the stack trace and deferring printing it
till we actually need it later perturbs the execution profile less.

In addition, just capturing the stack traces (instead of printing them
immediately at each capture site) allows us to avoid polluting stdout with tons
of stack traces that may be irrelevant.

For now, we only capture the native stack trace.  We'll leave capturing and
integrating the JS stack trace as an exercise for the future if we need it then.

Here's an example of how to use this StackTrace utility:

    // Capture a stack trace of the top 10 frames.
    std::unique_ptr<StackTrace> trace(StackTrace::captureStackTrace(10));
    // Print the trace.
    dataLog(*trace);

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* tools/StackTrace.cpp: Added.
(JSC::StackTrace::instanceSize):
(JSC::StackTrace::captureStackTrace):
(JSC::StackTrace::dump):
* tools/StackTrace.h: Added.
(JSC::StackTrace::StackTrace):
(JSC::StackTrace::size):

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

5 years agoAttempt to fix the WebKit2 test bots following <https://trac.webkit.org/changeset...
dbates@webkit.org [Fri, 10 Mar 2017 01:08:25 +0000 (01:08 +0000)]
Attempt to fix the WebKit2 test bots following <https://trac.webkit.org/changeset/213676>
(https://bugs.webkit.org/show_bug.cgi?id=169364)

Create new WebView with Credential Management enabled when the enableCredentialManagement
WebKitTestRunner option is specified.

* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::viewSupportsOptions):

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

5 years agoFix some debug builds after r213686
beidson@apple.com [Fri, 10 Mar 2017 00:59:51 +0000 (00:59 +0000)]
Fix some debug builds after r213686

Unreviewed.

* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm:
(WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa): Remove the 32-bit NOT_REACHED protection for now.

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

5 years agoWebAssembly: Enable fast memory for WK2
keith_miller@apple.com [Fri, 10 Mar 2017 00:57:06 +0000 (00:57 +0000)]
WebAssembly: Enable fast memory for WK2
https://bugs.webkit.org/show_bug.cgi?id=169437

Reviewed by Tim Horton.

Source/JavaScriptCore:

* JavaScriptCore.xcodeproj/project.pbxproj:

Source/WebKit2:

I forgot to do this when I enabled implemented fast memory
for wasm.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

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

5 years agoWeb Inspector: Add XHR breakpoints UI
mattbaker@apple.com [Fri, 10 Mar 2017 00:53:48 +0000 (00:53 +0000)]
Web Inspector: Add XHR breakpoints UI
https://bugs.webkit.org/show_bug.cgi?id=168763
<rdar://problem/30952439>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/DOMDebugger.json:
Added clarifying comments to command descriptions.

Source/WebCore:

Test: inspector/dom-debugger/xhr-breakpoints.html

* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::discardBindings):
(WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
Don't break for XHRs when breakpoints are disabled.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New UI strings.

* UserInterface/Controllers/DOMDebuggerManager.js:
Plumbing for XHR breakpoints. Like DOM breakpoints, they are tracked
per-page. Unlike DOM breakpoints, they have no separate "resolved"
state, and are simply added/removed as the main frame changes.

(WebInspector.DOMDebuggerManager):
(WebInspector.DOMDebuggerManager.prototype.get allRequestsBreakpoint):
(WebInspector.DOMDebuggerManager.prototype.get xhrBreakpoints):
(WebInspector.DOMDebuggerManager.prototype.isBreakpointRemovable):
(WebInspector.DOMDebuggerManager.prototype.removeDOMBreakpoint):
(WebInspector.DOMDebuggerManager.prototype.addXHRBreakpoint):
(WebInspector.DOMDebuggerManager.prototype.removeXHRBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._speculativelyResolveBreakpoints):
(WebInspector.DOMDebuggerManager.prototype._detachXHRBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._updateXHRBreakpoint.breakpointUpdated):
(WebInspector.DOMDebuggerManager.prototype._updateXHRBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._resolveXHRBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._saveXHRBreakpoints):
(WebInspector.DOMDebuggerManager.prototype._domBreakpointDisabledStateDidChange):
(WebInspector.DOMDebuggerManager.prototype._xhrBreakpointDisabledStateDidChange):
(WebInspector.DOMDebuggerManager.prototype._mainResourceDidChange):
(WebInspector.DOMDebuggerManager.prototype._saveBreakpoints): Deleted.
Renamed `saveDOMBreakpoints`.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype._pauseReasonFromPayload):
Plumbing for XHR breakpoint pause reason.

* UserInterface/Controllers/XHRBreakpointTreeController.js: Added.
Creates the "All Requests" breakpoint, handles DOMDebuggerManager messages,
and updates an associated tree outline as XHR breakpoints are added and removed.

(WebInspector.XHRBreakpointTreeController):
(WebInspector.XHRBreakpointTreeController.prototype.revealAndSelect):
(WebInspector.XHRBreakpointTreeController.prototype.disconnect):
(WebInspector.XHRBreakpointTreeController.prototype._xhrBreakpointAdded):
(WebInspector.XHRBreakpointTreeController.prototype._xhrBreakpointRemoved):
(WebInspector.XHRBreakpointTreeController.prototype._mainResourceDidChange):
(WebInspector.XHRBreakpointTreeController.prototype._reset):

* UserInterface/Main.html:
New files.

* UserInterface/Models/XHRBreakpoint.js: Added.
New model class. XHR breakpoints have an associated URL, which is matched
against the request URL when deciding whether to break. An empty URL matches
all XMLHttpRequests.

(WebInspector.XHRBreakpoint):
(WebInspector.XHRBreakpoint.prototype.get documentURL):
(WebInspector.XHRBreakpoint.prototype.get url):
(WebInspector.XHRBreakpoint.prototype.get disabled):
(WebInspector.XHRBreakpoint.prototype.set disabled):
(WebInspector.XHRBreakpoint.prototype.get serializableInfo):
(WebInspector.XHRBreakpoint.prototype.saveIdentityToCookie):

* UserInterface/Test.html:
New files.

* UserInterface/Views/ContentView.js:
(WebInspector.ContentView.createFromRepresentedObject):
Plumbing for new represented object type, to prevent runtime assertion.

* UserInterface/Views/DOMBreakpointTreeElement.js:
(WebInspector.DOMBreakpointTreeElement):
Reuse BreakpointTreeElement styles.

* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel):
(WebInspector.DebuggerSidebarPanel.prototype.saveStateToCookie):
(WebInspector.DebuggerSidebarPanel.prototype.restoreStateFromCookie):
(WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonSection):
(WebInspector.DebuggerSidebarPanel.prototype._addXHRBreakpointButtonClicked):
(WebInspector.DebuggerSidebarPanel.prototype.willDismissPopover):

* UserInterface/Views/InputPopover.css: Added.
(.popover .input-popover-content):
(.popover .input-popover-content > .editor):
(.popover .input-popover-content > .editor > .CodeMirror):
(.popover .input-popover-content > .editor > .CodeMirror-scroll):

* UserInterface/Views/InputPopover.js: Added.
New general purpose popover class. Style and structure lifted from
the Popover implementation used by the Probe Expressions UI. A follow-up
has been filed to switch that UI over to this new class:
https://bugs.webkit.org/show_bug.cgi?id=169428.

(WebInspector.InputPopover):
(WebInspector.InputPopover.prototype.get value):
(WebInspector.InputPopover.prototype.get result):
(WebInspector.InputPopover.prototype.show):
(WebInspector.InputPopover.prototype._presentOverTargetElement):

* UserInterface/Views/XHRBreakpointTreeElement.js: Added.
Tree element class for XHR breakpoints. Behaves identically to
script and DOM breakpoint tree elements.

(WebInspector.XHRBreakpointTreeElement):
Reuse BreakpointTreeElement styles.
(WebInspector.XHRBreakpointTreeElement.prototype.onattach):
(WebInspector.XHRBreakpointTreeElement.prototype.ondetach):
(WebInspector.XHRBreakpointTreeElement.prototype.ondelete):
(WebInspector.XHRBreakpointTreeElement.prototype.onenter):
(WebInspector.XHRBreakpointTreeElement.prototype.onspace):
(WebInspector.XHRBreakpointTreeElement.prototype.populateContextMenu):
(WebInspector.XHRBreakpointTreeElement.prototype._statusImageElementClicked):
(WebInspector.XHRBreakpointTreeElement.prototype._statusImageElementFocused):
(WebInspector.XHRBreakpointTreeElement.prototype._statusImageElementMouseDown):
(WebInspector.XHRBreakpointTreeElement.prototype._toggleBreakpoint):
(WebInspector.XHRBreakpointTreeElement.prototype._updateStatus):

LayoutTests:

Tests for pausing on XMLHttpRequests using XHR breakpoints.

* inspector/dom-debugger/xhr-breakpoints-expected.txt: Added.
* inspector/dom-debugger/xhr-breakpoints.html: Added.

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

5 years agoSource/JavaScriptCore:
msaboff@apple.com [Fri, 10 Mar 2017 00:53:09 +0000 (00:53 +0000)]
Source/JavaScriptCore:
Add plumbing to WebProcess to enable JavaScriptCore configuration and logging
https://bugs.webkit.org/show_bug.cgi?id=169387

Reviewed by Filip Pizlo.

Added a helper function, processConfigFile(), to process configuration file.
Changed jsc.cpp to use that function in lieu of processing the config file
manually.

* JavaScriptCore.xcodeproj/project.pbxproj: Made ConfigFile.h a private header file.
* jsc.cpp:
(jscmain):
* runtime/ConfigFile.cpp:
(JSC::processConfigFile):
* runtime/ConfigFile.h:

Source/WebCore:
Add plumbing to WebProcess to enable JavaScriptCore configuration and logging
https://bugs.webkit.org/show_bug.cgi?id=169387

Reviewed by Filip Pizlo.

Added a forwarding header file for JavScriptCore/runtime/ConfigFile.h.

* ForwardingHeaders/runtime/ConfigFile.h: Added.

Source/WebKit2:
<<<<<<< .mine

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

5 years agoREGRESSION (r196271): Web Inspector: DOM element loses focus/active selection after...
mattbaker@apple.com [Fri, 10 Mar 2017 00:52:07 +0000 (00:52 +0000)]
REGRESSION (r196271): Web Inspector: DOM element loses focus/active selection after committing an inline attribute editor in DOMTreeOutline
https://bugs.webkit.org/show_bug.cgi?id=168119
<rdar://problem/30466013>

Reviewed by Brian Burg.

Fix a regression caused by http://trac.webkit.org/changeset/196271, which
updated WebInspector.isEventTargetAnEditableField to detect the editing
scenarios used by DOMTreeElement and DataGrid. This subtly changed the
behavior of WebInspector._focusChanged, which expected all editable fields
to be backed by a CodeMirror instance.

* UserInterface/Base/Main.js:

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

5 years agoResource Load Statistics: Remove statistics data as part of full website data removal
wilander@apple.com [Fri, 10 Mar 2017 00:46:25 +0000 (00:46 +0000)]
Resource Load Statistics: Remove statistics data as part of full website data removal
https://bugs.webkit.org/show_bug.cgi?id=169448

Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
    The version of this function that takes a modifiedSince parameter
    checks if it is equal to or less than the start of the Unix epoch.
    If so, it clears the store. This is to support clear all website
    data.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::clearInMemoryAndPersistent):
(WebCore::ResourceLoadStatisticsStore::setWritePersistentStoreCallback):
* loader/ResourceLoadStatisticsStore.h:
    Added m_writePersistentStoreHandler, a setter for it, and
    ResourceLoadStatisticsStore::clearInMemoryAndPersistent().

Source/WebKit2:

* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerClearInMemoryAndPersistentStore):
    Infrastructure for test.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::clearInMemoryAndPersistentStore):
    Infrastructure for test.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::processStatisticsAndDataRecords):
    Change due to the break-out of
    WebResourceLoadStatisticsStore::writeStoreToDisk().
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    Now sets m_writePersistentStoreHandler in
    WebCore::ResourceLoadStatisticsStore.
(WebKit::WebResourceLoadStatisticsStore::writeStoreToDisk):
    Separated out this function to make it available for the function set as
    m_writePersistentStoreHandler in WebCore::ResourceLoadStatisticsStore.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::removeData):
    Both WebsiteDataStore::removeData() functions now cover resource load
    statistics.

Tools:

This patch adds infrastructure for the new TestRunner function
statisticsClearInMemoryAndPersistentStore().

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::statisticsClearInMemoryAndPersistentStore):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsClearInMemoryAndPersistentStore):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store.html: Added.
* platform/wk2/TestExpectations:
    Marked as [ Pass ] for WebKit2.

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

5 years agoOnly consider autoplay interference in the first 10 seconds of playback.
mrajca@apple.com [Fri, 10 Mar 2017 00:44:42 +0000 (00:44 +0000)]
Only consider autoplay interference in the first 10 seconds of playback.
https://bugs.webkit.org/show_bug.cgi?id=169455

Reviewed by Alex Christensen.

If the media duration is relatively long, say, 10 minutes, and you pause 5 minutes in, that's
probably not a strong indication users may not want auto-play. This patch limits interference
events to the first 10 seconds of automatic playback.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setReadyState):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::setMuted):
(WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
(WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
(WebCore::HTMLMediaElement::userDidInterfereWithAutoplay):
(WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture):
(WebCore::HTMLMediaElement::pageMutedStateDidChange):
* html/HTMLMediaElement.h:

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

5 years agoAdd WKURLSchemeHandler API for handling custom protocols.
beidson@apple.com [Fri, 10 Mar 2017 00:38:20 +0000 (00:38 +0000)]
Add WKURLSchemeHandler API for handling custom protocols.
https://bugs.webkit.org/show_bug.cgi?id=169422

Reviewed by Tim Horton.

Source/WebCore:

* platform/URLParser.cpp:
(WebCore::URLParser::maybeCanonicalizeScheme):
(WebCore::URLParser::isSpecialScheme):
* platform/URLParser.h:

Source/WebKit2:

This introduces two new protocols to the WK2 API surface:
- WKURLSchemeHandler
- WKURLSchemeHandlerTask

By registering an object that conforms to the WKURLSchemeHandler protocol with a WKWebViewConfiguration an application will
be handed an object conforming to WKURLSchemeHandlerTask for each resource load in that WKWebView with a custom URL scheme.

Using that id <WKURLSchemeHandlerTask>, the application can communicate the data for the resource back to WebKit.

* Shared/API/APIObject.h:
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:

* UIProcess/API/APIURLSchemeHandlerTask.cpp:
(API::URLSchemeHandlerTask::create):
(API::URLSchemeHandlerTask::URLSchemeHandlerTask):
* UIProcess/API/APIURLSchemeHandlerTask.h:

Add the WKURLSchemeHandler @protocol:
* UIProcess/API/Cocoa/WKURLSchemeHandler.h: Added.

Add the WKURLSchemeHandlerTask @protocol, as well as WebKit's concrete implementation of it:
* UIProcess/API/Cocoa/WKURLSchemeHandlerTask.h: Added.
* UIProcess/API/Cocoa/WKURLSchemeHandlerTask.mm: Added.
(raiseExceptionIfNecessary):
(-[WKURLSchemeHandlerTaskImpl request]):
(-[WKURLSchemeHandlerTaskImpl didReceiveResponse:]):
(-[WKURLSchemeHandlerTaskImpl didReceiveData:]):
(-[WKURLSchemeHandlerTaskImpl didFinish]):
(-[WKURLSchemeHandlerTaskImpl didFailWithError:]):
(-[WKURLSchemeHandlerTaskImpl _apiObject]):
* UIProcess/API/Cocoa/WKURLSchemeHandlerTaskInternal.h:
(WebKit::wrapper):

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView urlSchemeHandlerForURLScheme:]):
(+[WKWebView handlesURLScheme:]):

* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration setURLSchemeHandler:forURLScheme:]):
(-[WKWebViewConfiguration urlSchemeHandlerForURLScheme:]):
(-[WKWebViewConfiguration _urlSchemeHandlers]):
* UIProcess/API/Cocoa/WKWebViewConfigurationInternal.h:

* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.h:
(WebKit::WebURLSchemeHandlerCocoa::apiHandler):
* UIProcess/Cocoa/WebURLSchemeHandlerCocoa.mm: Added.
(WebKit::WebURLSchemeHandlerCocoa::create):
(WebKit::WebURLSchemeHandlerCocoa::WebURLSchemeHandlerCocoa):
(WebKit::WebURLSchemeHandlerCocoa::platformStartTask):
(WebKit::WebURLSchemeHandlerCocoa::platformStopTask):

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
(WebKit::WebPageProxy::setURLSchemeHandlerForScheme):
(WebKit::WebPageProxy::urlSchemeHandlerForScheme):
(WebKit::WebPageProxy::startURLSchemeHandlerTask):
(WebKit::WebPageProxy::stopURLSchemeHandlerTask):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* UIProcess/WebURLSchemeHandler.cpp:
(WebKit::generateWebURLSchemeHandlerIdentifier):
(WebKit::WebURLSchemeHandler::WebURLSchemeHandler):
(WebKit::WebURLSchemeHandler::~WebURLSchemeHandler):
(WebKit::WebURLSchemeHandler::startTask):
(WebKit::WebURLSchemeHandler::stopTask):
* UIProcess/WebURLSchemeHandler.h:
(WebKit::WebURLSchemeHandler::identifier):

* UIProcess/WebURLSchemeHandlerTask.cpp: Added.
(WebKit::WebURLSchemeHandlerTask::create):
(WebKit::WebURLSchemeHandlerTask::WebURLSchemeHandlerTask):
(WebKit::WebURLSchemeHandlerTask::didReceiveResponse):
(WebKit::WebURLSchemeHandlerTask::didReceiveData):
(WebKit::WebURLSchemeHandlerTask::didComplete):
(WebKit::WebURLSchemeHandlerTask::pageDestroyed):
(WebKit::WebURLSchemeHandlerTask::stop):
* UIProcess/WebURLSchemeHandlerTask.h: Added.
(WebKit::WebURLSchemeHandlerTask::identifier):
(WebKit::WebURLSchemeHandlerTask::request):

* WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::scheduleLoad):
(WebKit::WebLoaderStrategy::remove):
* WebProcess/Network/WebLoaderStrategy.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::urlSchemeHandlerForScheme):
(WebKit::WebPage::registerURLSchemeHandler):
(WebKit::WebPage::urlSchemeHandlerTaskDidReceiveResponse):
(WebKit::WebPage::urlSchemeHandlerTaskDidReceiveData):
(WebKit::WebPage::urlSchemeHandlerTaskDidComplete):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

* WebProcess/WebPage/WebURLSchemeHandlerProxy.cpp: Added.
(WebKit::WebURLSchemeHandlerProxy::WebURLSchemeHandlerProxy):
(WebKit::WebURLSchemeHandlerProxy::~WebURLSchemeHandlerProxy):
(WebKit::WebURLSchemeHandlerProxy::startNewTask):
(WebKit::WebURLSchemeHandlerProxy::taskDidReceiveResponse):
(WebKit::WebURLSchemeHandlerProxy::taskDidReceiveData):
(WebKit::WebURLSchemeHandlerProxy::taskDidComplete):
* WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
(WebKit::WebURLSchemeHandlerProxy::identifier):
(WebKit::WebURLSchemeHandlerProxy::page):

* WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.cpp: Added.
(WebKit::WebURLSchemeHandlerTaskProxy::WebURLSchemeHandlerTaskProxy):
(WebKit::WebURLSchemeHandlerTaskProxy::startLoading):
(WebKit::WebURLSchemeHandlerTaskProxy::stopLoading):
(WebKit::WebURLSchemeHandlerTaskProxy::didReceiveResponse):
(WebKit::WebURLSchemeHandlerTaskProxy::didReceiveData):
(WebKit::WebURLSchemeHandlerTaskProxy::didComplete):
* WebProcess/WebPage/WebURLSchemeHandlerTaskProxy.h:
(WebKit::WebURLSchemeHandlerTaskProxy::request):

* WebKit2.xcodeproj/project.pbxproj:
* CMakeLists.txt:

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

5 years agoUnreviewed follow-up to r213682.
joepeck@webkit.org [Fri, 10 Mar 2017 00:16:02 +0000 (00:16 +0000)]
Unreviewed follow-up to r213682.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
Forward declare SPIs to address possible build errors.

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

5 years agoWebGPU: Backend - Buffers
dino@apple.com [Fri, 10 Mar 2017 00:00:41 +0000 (00:00 +0000)]
WebGPU: Backend - Buffers
https://bugs.webkit.org/show_bug.cgi?id=169451
<rdar://problem/30959168>

Reviewed by Tim Horton.

Source/WebCore:

Implement the backend for GPUBuffer, which
represents a chunk of memory that can be used
by the GPU. You create one using an ArrayBufferView.

WebKit API Test: GPUBuffer.mm

* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/cocoa/GPUBufferMetal.mm:
(WebCore::GPUBuffer::GPUBuffer):
(WebCore::GPUBuffer::length):
(WebCore::GPUBuffer::contents):
(WebCore::GPUBuffer::platformBuffer):
* platform/graphics/gpu/GPUBuffer.cpp:
(WebCore::GPUBuffer::create):
(WebCore::GPUBuffer::~GPUBuffer):
(WebCore::GPUBuffer::length):
(WebCore::GPUBuffer::contents):
* platform/graphics/gpu/GPUBuffer.h:
* platform/graphics/gpu/GPUDevice.cpp:
(WebCore::GPUDevice::createBufferFromData):
* platform/graphics/gpu/GPUDevice.h:

Tools:

Test for GPUBuffer object.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/mac/GPUBuffer.mm: Added.
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/mac/GPUFunction.mm:
* TestWebKitAPI/Tests/WebCore/mac/GPULibrary.mm:

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

5 years agoWKWebView should provide a way for clients to know the specific media state.
commit-queue@webkit.org [Thu, 9 Mar 2017 23:58:02 +0000 (23:58 +0000)]
WKWebView should provide a way for clients to know the specific media state.
https://bugs.webkit.org/show_bug.cgi?id=169140
<rdar://problem/30838285>

Patch by Andrew Gold <agold@apple.com> on 2017-03-09
Reviewed by Alex Christensen.

Instead of notifying the UIDelegate only when a capture begins and ends,
we now notify the UIDelegate of any change in capture state.

* UIProcess/API/APIUIClient.h:

(API::UIClient::mediaCaptureStateDidChange):
(API::UIClient::didBeginCaptureSession): Deleted.
(API::UIClient::didEndCaptureSession): Deleted.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:

* UIProcess/API/Cocoa/WKWebViewPrivate.h:

* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::mediaCaptureStateDidChange):
(WebKit::UIDelegate::UIClient::didBeginCaptureSession): Deleted.
(WebKit::UIDelegate::UIClient::didEndCaptureSession): Deleted.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isPlayingMediaDidChange):

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

5 years agoWeb Inspector: Show HTTP protocol version and other Network Load Metrics (IP Address...
joepeck@webkit.org [Thu, 9 Mar 2017 23:44:12 +0000 (23:44 +0000)]
Web Inspector: Show HTTP protocol version and other Network Load Metrics (IP Address, Priority, Connection ID)
https://bugs.webkit.org/show_bug.cgi?id=29687
<rdar://problem/19281586>

Reviewed by Matt Baker and Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Add metrics object with optional properties to loadingFinished event.

Source/WebCore:

Test: http/tests/inspector/network/resource-metrics.html

* inspector/InspectorNetworkAgent.cpp:
(WebCore::toProtocol):
(WebCore::InspectorNetworkAgent::buildObjectForMetrics):
(WebCore::InspectorNetworkAgent::didFinishLoading):
Send metrics at didFinishLoading time, we do not have all of
these at didReceiveResponse time.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didFinishLoadingImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didFinishLoading):
* inspector/InspectorNetworkAgent.h:
* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::finishedLoading):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::didFinishLoad):
(WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
(WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
* loader/ResourceLoadNotifier.h:
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didFinishLoading):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::didFinishLoading):
Include or pass on NetworkLoadMetrics to Web Inspector.

* platform/network/NetworkLoadMetrics.h:
(WebCore::NetworkLoadMetrics::isolatedCopy):
(WebCore::NetworkLoadMetrics::reset):
(WebCore::NetworkLoadMetrics::operator==):
(WebCore::NetworkLoadMetrics::encode):
(WebCore::NetworkLoadMetrics::decode):
Add new optional metrics properties.

(WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::encode):
(WTF::Persistence::Coder<std::optional<WebCore::NetworkLoadPriority>>::decode):
We never encode this but this is needed for the compiler.

* platform/spi/cocoa/NSURLConnectionSPI.h:
New SPI for NSURLSessionTaskTransactionMetrics details.

Source/WebInspectorUI:

These columns are available in the Network DataGrids, but are
initially hidden. They can be shown by right clicking on the
table header and showing these columns. We are going to rework
the default list of visible columns later.

* Localizations/en.lproj/localizedStrings.js:
New localized strings for data grid headers and Low/Medium/High.

* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading):
* UserInterface/Protocol/NetworkObserver.js:
(WebInspector.NetworkObserver.prototype.loadingFinished):
Pass metrics on to the Resource.

* UserInterface/Models/Resource.js:
(WebInspector.Resource):
(WebInspector.Resource.displayNameForType):
(WebInspector.Resource.responseSourceFromPayload):
(WebInspector.Resource.networkPriorityFromPayload):
(WebInspector.Resource.connectionIdentifierFromPayload):
(WebInspector.Resource.prototype.get protocol):
(WebInspector.Resource.prototype.get priority):
(WebInspector.Resource.prototype.get remoteAddress):
(WebInspector.Resource.prototype.get connectionIdentifier):
(WebInspector.Resource.prototype.updateWithMetrics):
Include metrics accessors and default values.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView):
Add metrics columns if the backend may be sending them.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.get data):
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ResourceTimelineDataGridNode.prototype._displayNameForPriority):
(WebInspector.ResourceTimelineDataGridNode.prototype._cachedCellContent):
Display strings for new columns.

* UserInterface/Views/TimelineDataGridNode.js:
* UserInterface/Views/TimelineRecordBar.js:
(WebInspector.TimelineRecordBar.prototype.refresh):
Avoid assertions if Graph column is unavailable.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid):
(WebInspector.DataGrid.prototype.createSettings):
(WebInspector.DataGrid.prototype.setColumnVisible):
Better support for restoring user preference of initially
hidden columns which the user may have shown.

* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel):
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshRequestAndResponse):
Show the Protocol and Priority in the Resources sidebar.

Source/WebKit2:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(toNetworkLoadPriority):
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
* Shared/WebCoreArgumentCoders.h:
Additional optional metrics on NetworkLoadMetrics.

LayoutTests:

* http/tests/inspector/network/resource-metrics-expected.txt: Added.
* http/tests/inspector/network/resource-metrics.html: Added.

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

5 years agoAdd iOS baseline for compositing/contents-format/subpixel-antialiased-text-traversal.
ryanhaddad@apple.com [Thu, 9 Mar 2017 23:21:19 +0000 (23:21 +0000)]
Add iOS baseline for compositing/contents-format/subpixel-antialiased-text-traversal.

Unreviewed test gardening.

* platform/ios-simulator/compositing/contents-format/subpixel-antialiased-text-traversal-expected.txt: Added.

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

5 years agoMinimal build is broken
commit-queue@webkit.org [Thu, 9 Mar 2017 23:14:20 +0000 (23:14 +0000)]
Minimal build is broken
https://bugs.webkit.org/show_bug.cgi?id=169416

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

Since we now have some JS built-ins that are not tied to a compilation flag, we can remove compilation guards around m_vm.
We could probably remove m_vm by ensuring m_jsDOMBindingInternals appear first but this might break very easily.

* Scripts/builtins/builtins_generate_internals_wrapper_header.py:
(generate_members):
* Scripts/builtins/builtins_generate_internals_wrapper_implementation.py:
(BuiltinsInternalsWrapperImplementationGenerator.generate_constructor):
* Scripts/tests/builtins/expected/WebCoreJSBuiltins.h-result:

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

5 years agoUse the right conditional.
andersca@apple.com [Thu, 9 Mar 2017 22:49:45 +0000 (22:49 +0000)]
Use the right conditional.

* Modules/applepay/ApplePayError.idl:

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

5 years agoActivate VideoToolbox when WebRTC is enabled on iOS
commit-queue@webkit.org [Thu, 9 Mar 2017 22:47:29 +0000 (22:47 +0000)]
Activate VideoToolbox when WebRTC is enabled on iOS
https://bugs.webkit.org/show_bug.cgi?id=169423

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

* wtf/Platform.h: Activate VIDEOTOOLBOX if WEBRTC is enabled.

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

5 years agoGuard Credential Management implementation behind a runtime enabled feature flag
dbates@webkit.org [Thu, 9 Mar 2017 22:47:01 +0000 (22:47 +0000)]
Guard Credential Management implementation behind a runtime enabled feature flag
https://bugs.webkit.org/show_bug.cgi?id=169364
<rdar://problem/30957425>

Reviewed by Brent Fulgham.

Add common identifiers for Credential, PasswordCredential, and SiteBoundCredential that are
needed to guard these interfaces behind a runtime enabled feature flag.

* runtime/CommonIdentifiers.h:

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

5 years agoGuard Credential Management implementation behind a runtime enabled feature flag
dbates@webkit.org [Thu, 9 Mar 2017 22:40:25 +0000 (22:40 +0000)]
Guard Credential Management implementation behind a runtime enabled feature flag
https://bugs.webkit.org/show_bug.cgi?id=169364
<rdar://problem/30957425>

Reviewed by Brent Fulgham.

Source/JavaScriptCore:

Add common identifiers for Credential, PasswordCredential, and SiteBoundCredential that are
needed to guard these interfaces behind a runtime enabled feature flag.

* runtime/CommonIdentifiers.h:

Source/WebCore:

Add a runtime enabled feature flag for Credential Management (disabled by default).
Once we are happy with this feature we can enable the feature by default or remove the
the runtime enabled feature flag so as to enable it by default.

* Modules/credentials/BasicCredential.idl: Enable only if the runtime enabled feature flag is
 enabled.
* Modules/credentials/PasswordCredential.idl: Ditto.
* Modules/credentials/SiteBoundCredential.idl: Ditto.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Added.
(WebCore::RuntimeEnabledFeatures::credentialManagementEnabled): Added.

Source/WebKit/mac:

Add WebKit preference for Credential Management (disabled by default).

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences credentialManagementEnabled]): Added.
(-[WebPreferences setCredentialManagementEnabled:]): Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add WebKit2 preference for Credential Management (disabled by default).

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetCredentialManagementEnabled): Added.
(WKPreferencesGetCredentialManagementEnabled): Added.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Add a new test option header, enableCredentialManagement, to DumpRenderTree/WebKitTestRunner
to enable Credential Management.

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
(setWebPreferencesForTestOptions):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:

LayoutTests:

* credentials/idlharness.html: Use comment header to enable Credential Management API.
* platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt: Update expected results now
that we no longer expose the Credential Management API by default.
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt: Ditto.
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt: Ditto.
* platform/mac/js/dom/global-constructors-attributes-expected.txt: Ditto.
* platform/win/TestExpectations: For now, skip the Credential Management API tests.

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

5 years agoRefactoring some HeapVerifier code.
mark.lam@apple.com [Thu, 9 Mar 2017 22:39:09 +0000 (22:39 +0000)]
Refactoring some HeapVerifier code.
https://bugs.webkit.org/show_bug.cgi?id=169443

Reviewed by Filip Pizlo.

Renamed LiveObjectData to CellProfile.
Renamed LiveObjectList to CellList.
Moved CellProfile.*, CellList.*, and HeapVerifier.* from the heap folder to the tools folder.
Updated the HeapVerifier to handle JSCells instead of just JSObjects.

This is in preparation for subsequent patches to fix up the HeapVerifier for service again.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/Heap.cpp:
(JSC::Heap::runBeginPhase):
(JSC::Heap::runEndPhase):
* heap/HeapVerifier.cpp: Removed.
* heap/HeapVerifier.h: Removed.
* heap/LiveObjectData.h: Removed.
* heap/LiveObjectList.cpp: Removed.
* heap/LiveObjectList.h: Removed.
* tools/CellList.cpp: Copied from Source/JavaScriptCore/heap/LiveObjectList.cpp.
(JSC::CellList::findCell):
(JSC::LiveObjectList::findObject): Deleted.
* tools/CellList.h: Copied from Source/JavaScriptCore/heap/LiveObjectList.h.
(JSC::CellList::CellList):
(JSC::CellList::reset):
(JSC::LiveObjectList::LiveObjectList): Deleted.
(JSC::LiveObjectList::reset): Deleted.
* tools/CellProfile.h: Copied from Source/JavaScriptCore/heap/LiveObjectData.h.
(JSC::CellProfile::CellProfile):
(JSC::LiveObjectData::LiveObjectData): Deleted.
* tools/HeapVerifier.cpp: Copied from Source/JavaScriptCore/heap/HeapVerifier.cpp.
(JSC::GatherCellFunctor::GatherCellFunctor):
(JSC::GatherCellFunctor::visit):
(JSC::GatherCellFunctor::operator()):
(JSC::HeapVerifier::gatherLiveCells):
(JSC::HeapVerifier::cellListForGathering):
(JSC::trimDeadCellsFromList):
(JSC::HeapVerifier::trimDeadCells):
(JSC::HeapVerifier::verifyButterflyIsInStorageSpace):
(JSC::HeapVerifier::reportCell):
(JSC::HeapVerifier::checkIfRecorded):
(JSC::GatherLiveObjFunctor::GatherLiveObjFunctor): Deleted.
(JSC::GatherLiveObjFunctor::visit): Deleted.
(JSC::GatherLiveObjFunctor::operator()): Deleted.
(JSC::HeapVerifier::gatherLiveObjects): Deleted.
(JSC::HeapVerifier::liveObjectListForGathering): Deleted.
(JSC::trimDeadObjectsFromList): Deleted.
(JSC::HeapVerifier::trimDeadObjects): Deleted.
(JSC::HeapVerifier::reportObject): Deleted.
* tools/HeapVerifier.h: Copied from Source/JavaScriptCore/heap/HeapVerifier.h.

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

5 years ago[iOS] Add SPI to print to a single tall PDF page
aestes@apple.com [Thu, 9 Mar 2017 22:37:13 +0000 (22:37 +0000)]
[iOS] Add SPI to print to a single tall PDF page
https://bugs.webkit.org/show_bug.cgi?id=169439
<rdar://problem/30120532>

Reviewed by Tim Horton.

* Shared/PrintInfo.cpp:
(WebKit::PrintInfo::encode): Encoded snapshotFirstPage.
(WebKit::PrintInfo::decode): Decoded snapshotFirstPage.
(WebKit::PrintInfo::PrintInfo): Deleted.
* Shared/PrintInfo.h: Initialized member variables in place instead of in a default ctor.
* UIProcess/_WKWebViewPrintFormatter.h: Declared BOOL property snapshotFirstPage.
* UIProcess/_WKWebViewPrintFormatter.mm:
(-[_WKWebViewPrintFormatter _setSnapshotPaperRect:]): Added to set a custom paper size.
(-[_WKWebViewPrintFormatter rectForPageAtIndex:]): Returned the custom paper rect if
snapshotFirstPage is true.
* UIProcess/_WKWebViewPrintFormatterInternal.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _wk_pageCountForPrintFormatter:]): Computed the custom paper size to be the
smaller of the document height and the maximum PDF page height.
* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView _wk_pageCountForPrintFormatter:]): Changed to return a maximum page size of 1
if snapshotFirstPage is true.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::computePagesForPrintingAndDrawToPDF): Ditto.

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

5 years agoAdd delegate support to WebCore
andersca@apple.com [Thu, 9 Mar 2017 22:34:52 +0000 (22:34 +0000)]
Add delegate support to WebCore
https://bugs.webkit.org/show_bug.cgi?id=169427
Part of rdar://problem/28880714.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:
Add feature define.

Source/WebCore:

* Configurations/FeatureDefines.xcconfig:
Add feature define.

* DerivedSources.make:
Add idl files.

* Modules/applepay/ApplePayError.cpp:
(WebCore::ApplePayError::create):
(WebCore::ApplePayError::ApplePayError):
(WebCore::ApplePayError::~ApplePayError):
* Modules/applepay/ApplePayError.h:
* Modules/applepay/ApplePayError.idl:
* Modules/applepay/ApplePayPaymentAuthorizationResult.h:
* Modules/applepay/ApplePayPaymentAuthorizationResult.idl:
* Modules/applepay/ApplePayPaymentMethodUpdate.h:
* Modules/applepay/ApplePayPaymentMethodUpdate.idl:
* Modules/applepay/ApplePayShippingContactUpdate.h:
* Modules/applepay/ApplePayShippingContactUpdate.idl:
* Modules/applepay/ApplePayShippingMethodUpdate.h:
* Modules/applepay/ApplePayShippingMethodUpdate.idl:
Add new files.

* Modules/applepay/ApplePaySession.cpp:
(WebCore::toPaymentAuthorizationStatus):
Move this function to the top.

(WebCore::convertAndValidate):
Add new convertAndValidate functions.

(WebCore::ApplePaySession::completeShippingMethodSelection):
(WebCore::ApplePaySession::completeShippingContactSelection):
(WebCore::ApplePaySession::completePaymentMethodSelection):
(WebCore::ApplePaySession::completePayment):
* Modules/applepay/ApplePaySession.h:
* Modules/applepay/ApplePaySession.idl:
Implement the old functions in terms of the new functions.

* Modules/applepay/PaymentCoordinator.cpp:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:
Add feature define.

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:
Add feature define.

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:
Add feature define.

Tools:

* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

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

5 years ago[link preload] Double downloads of preloaded CSS
yoav@yoav.ws [Thu, 9 Mar 2017 22:29:39 +0000 (22:29 +0000)]
[link preload] Double downloads of preloaded CSS
https://bugs.webkit.org/show_bug.cgi?id=169274

Reviewed by Antti Koivisto.

Source/WebCore:

Avoid reloading link preloads in case of a charset mismatch.

Charset mismatch can happen for header based preloads, as they are requested before
the HTML's `<meta charset>` tag is processed. This change makes sure that in those
cases, we modify the resource's encoding setting instead of reloading it.

Test: http/tests/preload/single_download_preload_headers.php

* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::CachedResource): Initialize m_unknownCharset to be the same as the preload flag.
* loader/cache/CachedResource.h:
(WebCore::CachedResource::hasUnknownEncoding):
(WebCore::CachedResource::setHasUnknownEncoding):
* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::determineRevalidationPolicy): In case of a charset
mismatch, set the encoding of the Resource instead of reloading it if the charset is unknown.

LayoutTests:

Added tests making sure that header based preloads also trigger a single download,
and that we properly handle multiple charsets for the same preloaded resource.

* http/tests/preload/single_download_preload_headers-expected.txt: Added.
* http/tests/preload/single_download_preload_headers.php: Added.
* http/tests/preload/preload-encoding-expected.txt: Added.
* http/tests/preload/preload-encoding.php: Added.

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

5 years agoImplement PBKDF2 in WebCrypto
jiewen_tan@apple.com [Thu, 9 Mar 2017 22:24:26 +0000 (22:24 +0000)]
Implement PBKDF2 in WebCrypto
https://bugs.webkit.org/show_bug.cgi?id=143458
<rdar://problem/27311703>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

* web-platform-tests/WebCryptoAPI/derive_bits_keys/pbkdf2.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/derive_bits_keys/test_pbkdf2-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/symmetric_importKey.worker-expected.txt:
* web-platform-tests/WebCryptoAPI/import_export/test_symmetric_importKey-expected.txt:

Source/WebCore:

This patch implements PBKDF2 according to the spec:
https://www.w3.org/TR/WebCryptoAPI/#pbkdf2. Supported
operations include deriveKey, deriveBits, importKey and
getKeyLength.

Tests: crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html
       crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html
       crypto/subtle/pbkdf2-import-key-derive-bits.html
       crypto/subtle/pbkdf2-import-key-derive-hmac-key.html
       crypto/subtle/pbkdf2-import-key-malformed-parameters.html
       crypto/subtle/pbkdf2-import-key.html
       crypto/workers/subtle/pbkdf2-import-key-derive-bits.html
       crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html
       crypto/workers/subtle/pbkdf2-import-key.html

* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCryptoKeyCustom.cpp:
(WebCore::JSCryptoKey::algorithm):
Added RawKeyAlgorithm.
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
A bit of reordering.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::write):
Faked implementation.
* crypto/CryptoAlgorithmParameters.h:
* crypto/CryptoKey.h:
* crypto/algorithms/CryptoAlgorithmPBKDF2.cpp: Added.
(WebCore::CryptoAlgorithmPBKDF2::create):
(WebCore::CryptoAlgorithmPBKDF2::identifier):
(WebCore::CryptoAlgorithmPBKDF2::deriveBits):
(WebCore::CryptoAlgorithmPBKDF2::importKey):
(WebCore::CryptoAlgorithmPBKDF2::getKeyLength):
* crypto/algorithms/CryptoAlgorithmPBKDF2.h: Added.
* crypto/gnutls/CryptoAlgorithmPBKDF2GnuTLS.cpp: Added.
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/keys/CryptoKeyRaw.cpp: Added.
(WebCore::CryptoKeyRaw::CryptoKeyRaw):
(WebCore::CryptoKeyRaw::buildAlgorithm):
(WebCore::CryptoKeyRaw::exportData):
* crypto/keys/CryptoKeyRaw.h: Added.
(WebCore::RawKeyAlgorithm::RawKeyAlgorithm):
The CryptoKey class for PBKDF2 and later on HKDF.
* crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: Added.
(WebCore::commonCryptoHMACAlgorithm):
(WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
* crypto/parameters/CryptoAlgorithmPbkdf2Params.h: Added.
* crypto/parameters/Pbkdf2Params.idl: Added.

LayoutTests:

* TestExpectations:
Mark slow tests as slow.
* crypto/subtle/derive-key-malformed-parameters.html:
* crypto/subtle/ecdh-import-key-derive-pbkdf2-key-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-pbkdf2-key.html: Added.
* crypto/subtle/pbkdf2-derive-bits-malformed-parametrs-expected.txt: Added.
* crypto/subtle/pbkdf2-derive-bits-malformed-parametrs.html: Added.
* crypto/subtle/pbkdf2-import-key-derive-bits-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-derive-bits.html: Added.
* crypto/subtle/pbkdf2-import-key-derive-hmac-key-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-derive-hmac-key.html: Added.
* crypto/subtle/pbkdf2-import-key-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/pbkdf2-import-key-malformed-parameters.html: Added.
* crypto/subtle/pbkdf2-import-key.html: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-bits-expected.txt: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-bits.html: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key-expected.txt: Added.
* crypto/workers/subtle/pbkdf2-import-key-derive-hmac-key.html: Added.
* crypto/workers/subtle/pbkdf2-import-key-expected.txt: Added.
* crypto/workers/subtle/pbkdf2-import-key.html: Added.
* crypto/workers/subtle/resources/pbkdf2-import-key-derive-bits.js: Added.
* crypto/workers/subtle/resources/pbkdf2-import-key-derive-hmac-key.js: Added.
* crypto/workers/subtle/resources/pbkdf2-import-key.js: Added.

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

5 years ago[Modern Media Controls] iOS: long press on play button shows the Copy menu
commit-queue@webkit.org [Thu, 9 Mar 2017 22:17:57 +0000 (22:17 +0000)]
[Modern Media Controls] iOS: long press on play button shows the Copy menu
https://bugs.webkit.org/show_bug.cgi?id=169355
<rdar://problem/30928998>

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

Source/WebCore:

Disable built-in UI behavior that shows a magnifier or a copy callout when pressing
on an element for a long time. These do not make sense for media controls.

Test: media/modern-media-controls/audio/audio-controls-styles.html

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

LayoutTests:

Add a test to check that the expected properties are set as they should to disable
built-in UI behavior that shows a magnifier or a copy callout when pressing on an
element for a long time.

* media/modern-media-controls/audio/audio-controls-styles-expected.txt: Added.
* media/modern-media-controls/audio/audio-controls-styles.html: Added.
* platform/mac/TestExpectations:

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

5 years ago[Content Extensions] Introduce if-top-url and unless-top-url
achristensen@apple.com [Thu, 9 Mar 2017 22:17:13 +0000 (22:17 +0000)]
[Content Extensions] Introduce if-top-url and unless-top-url
https://bugs.webkit.org/show_bug.cgi?id=169433

Reviewed by Brady Eidson.

Source/WebCore:

In r184116 I added if-domain and unless-domain to control whether a rule applies
based on the domain of the main document URL.  I'm expanding this by adding if-top-url
and unless-top-url that run regular expressions on the entire main document URL so that
example.com/user1content can be distinguished from example.com/user2content.
To not add to the number of passes we make on the URLs for each load and to maintain JSON
backwards compatibility, I've made it so that if-top-url and unless-top-url can be used
instead of if-domain and unless-domain (which continue to work) but the two condition types
cannot be used together since running regular expressions on the entire main document URL
is strictly more powerful than checking the domain and subdomains.
As a minor detail, content extension regexes are by default ASCII-case-insensitive, so I've
done the same with top URL regexes, adding top-url-filter-is-case-sensitive to mirror the existing
url-filter-is-case-sensitive if the JSON author decides to make regexes case sensitive.

Covered by new API tests.

* contentextensions/CompiledContentExtension.h:
* contentextensions/ContentExtension.cpp:
(WebCore::ContentExtensions::ContentExtension::populateConditionCacheIfNeeded):
(WebCore::ContentExtensions::ContentExtension::topURLActions):
(WebCore::ContentExtensions::ContentExtension::cachedConditionedActions): Deleted.
* contentextensions/ContentExtension.h:
* contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::addUniversalActionsToDFA):
(WebCore::ContentExtensions::compileToBytecode):
We had three copies of compiling to bytecode that were almost the same and would've been made into three copies of the same code.
I moved them to one helper function that is called three times.
(WebCore::ContentExtensions::compileRuleList):
* contentextensions/ContentExtensionCompiler.h:
* contentextensions/ContentExtensionError.cpp:
(WebCore::ContentExtensions::contentExtensionErrorCategory):
Add the new error type for JSON that tries to use if-top-url and unless-top-url with if-domain and unless-domain.
* contentextensions/ContentExtensionError.h:
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::loadTrigger):
Parse the new values if-top-url, unless-top-url, and top-url-filter-is-case-sensitive.
* contentextensions/ContentExtensionRule.h:
(WebCore::ContentExtensions::Trigger::~Trigger):
* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
* contentextensions/DFABytecodeInterpreter.cpp:
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretAppendAction):
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretTestFlagsAndAppendAction):
(WebCore::ContentExtensions::DFABytecodeInterpreter::interpretWithConditions):
* contentextensions/DFABytecodeInterpreter.h:

Source/WebKit2:

Rename conditionedFilters to topURLFilters to reflect the fact that they are the filters
that are run on the top URL, and possibly just the domain of the top url.
I was a bit too aggressive when renaming domain* to condition* in r213533.

* Shared/WebCompiledContentExtension.cpp:
(WebKit::WebCompiledContentExtension::conditionsApplyOnlyToDomain):
(WebKit::WebCompiledContentExtension::topURLFiltersBytecode):
(WebKit::WebCompiledContentExtension::topURLFiltersBytecodeLength):
(WebKit::WebCompiledContentExtension::conditionedFiltersBytecode): Deleted.
(WebKit::WebCompiledContentExtension::conditionedFiltersBytecodeLength): Deleted.
* Shared/WebCompiledContentExtension.h:
* Shared/WebCompiledContentExtensionData.cpp:
(WebKit::WebCompiledContentExtensionData::encode):
(WebKit::WebCompiledContentExtensionData::decode):
* Shared/WebCompiledContentExtensionData.h:
(WebKit::WebCompiledContentExtensionData::WebCompiledContentExtensionData):
* UIProcess/API/APIUserContentExtensionStore.cpp:
(API::encodeContentExtensionMetaData):
(API::decodeContentExtensionMetaData):
(API::compiledToFile):
(API::createExtension):
(API::UserContentExtensionStore::invalidateContentExtensionVersion):
(API::userContentExtensionStoreErrorCategory):
* UIProcess/API/APIUserContentExtensionStore.h:
Increment CurrentContentExtensionFileVersion because we have changed the format of the binary on disk.
We only added 4 bytes, but that's binary incompatible and requires re-compiling any existing content extensions.

Tools:

* TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::TEST_F):
Add tests for new functionality and new failure types.

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

5 years agoPrevent HTML in rich link previews
jond@apple.com [Thu, 9 Mar 2017 22:07:46 +0000 (22:07 +0000)]
Prevent HTML in rich link previews
https://bugs.webkit.org/show_bug.cgi?id=169435

Reviewed by Tim Horton.

* wp-content/plugins/social-meta.php:

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

5 years agoWeb Inspector: Show individual messages in the content pane for a WebSocket
nvasilyev@apple.com [Thu, 9 Mar 2017 21:56:33 +0000 (21:56 +0000)]
Web Inspector: Show individual messages in the content pane for a WebSocket
https://bugs.webkit.org/show_bug.cgi?id=169011

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

Add walltime parameter and correct the description of Timestamp type.

* inspector/protocol/Network.json:

Source/WebCore:

Add walltime parameter.

No new tests. Tests will be added in a follow up patch.

* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):

Source/WebInspectorUI:

When selecting a Web Socket in Network panel or Resources, display a table
of all messages that have been sent and received.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.webSocketWillSendHandshakeRequest):
Add a walltime parameter.

(WebInspector.FrameResourceManager.prototype._webSocketFrameReceivedOrSent):
Fix a bug: masked messages are outgoing, not incoming.

* UserInterface/Images/ArrowUp.svg: Added.
* UserInterface/Images/gtk/ArrowUp.svg: Added.
Add an icon for outgoing messages.

* UserInterface/Main.html:
* UserInterface/Models/WebSocketResource.js:
(WebInspector.WebSocketResource):
(WebInspector.WebSocketResource.prototype.get walltime):
(WebInspector.WebSocketResource.prototype.addFrame):
(WebInspector.WebSocketResource.prototype._walltimeForWebSocketTimestamp):
* UserInterface/Protocol/NetworkObserver.js:
(WebInspector.NetworkObserver.prototype.webSocketWillSendHandshakeRequest):
(WebInspector.NetworkObserver.prototype.webSocketFrameSent):
(WebInspector.NetworkObserver.prototype.webSocketFrameError):
(WebInspector.NetworkObserver):
* UserInterface/Views/NetworkSidebarPanel.js:
(WebInspector.NetworkSidebarPanel.prototype.treeElementAddedOrChanged):
* UserInterface/Views/ResourceClusterContentView.js:
(WebInspector.ResourceClusterContentView.prototype.get responseContentView):
* UserInterface/Views/WebSocketContentView.css: Added.
(.web-socket.content-view > .data-grid):
(.web-socket.content-view > .data-grid table.data):
(.web-socket.content-view > .data-grid td.data-column,):
(body[dir=ltr] .web-socket.content-view > .data-grid .data-column > div):
(body[dir=rtl] .web-socket.content-view > .data-grid .data-column > div):
(.web-socket.content-view .icon):
(body[dir=ltr] .web-socket.content-view .icon):
(body[dir=rtl] .web-socket.content-view .icon):
(.web-socket.content-view .outgoing .icon):
(.web-socket.content-view .data-grid.variable-height-rows table.data tr:nth-child(odd)):
(.web-socket.content-view .data-grid table.data tr.revealed):
(.web-socket.content-view .data-grid.variable-height-rows table.data tr.outgoing):
(.web-socket.content-view .data-grid.variable-height-rows table.data tr.non-text-frame):

* UserInterface/Views/WebSocketContentView.js: Added.
(WebInspector.WebSocketContentView):
Only show Time column when walltime is available.

(WebInspector.WebSocketContentView.textForOpcode):
(WebInspector.WebSocketContentView.prototype.shown):
(WebInspector.WebSocketContentView.prototype.hidden):
(WebInspector.WebSocketContentView.prototype.addFrame):
(WebInspector.WebSocketContentView.prototype._updateFrames):
Only render frames that haven't been rendered yet.

(WebInspector.WebSocketContentView.prototype._addRow):
(WebInspector.WebSocketContentView.prototype._timeStringFromTimestamp):

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

5 years ago[WK2][iOS] Extend WebProcess sandbox to support audio and video compression/decompression
bfulgham@apple.com [Thu, 9 Mar 2017 21:42:04 +0000 (21:42 +0000)]
[WK2][iOS] Extend WebProcess sandbox to support audio and video compression/decompression
https://bugs.webkit.org/show_bug.cgi?id=169431
<rdar://problem/30844650>

Reviewed by Youenn Fablet.

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

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

5 years agoUnreviewed, fix weak external symbol error.
fpizlo@apple.com [Thu, 9 Mar 2017 21:39:50 +0000 (21:39 +0000)]
Unreviewed, fix weak external symbol error.

* heap/SlotVisitor.h:

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

5 years agoUnreviewed build fix after r213628.
bfulgham@apple.com [Thu, 9 Mar 2017 21:28:00 +0000 (21:28 +0000)]
Unreviewed build fix after r213628.

Use 'size_t' for the function definition to match the header file. If you do not,
the 32-bit build fails..

* crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):

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

5 years ago[WK2] Add a UI delegate hook for custom handling of data interaction operations
wenson_hsieh@apple.com [Thu, 9 Mar 2017 21:24:36 +0000 (21:24 +0000)]
[WK2] Add a UI delegate hook for custom handling of data interaction operations
https://bugs.webkit.org/show_bug.cgi?id=169430
<rdar://problem/30954654>

Reviewed by Tim Horton.

Source/WebCore:

Ensure that m_documentUnderMouse is properly cleaned up even in the case where no drag operation was performed
due to the drop bailing at the client layer.

* page/DragController.cpp:
(WebCore::DragController::dragEnded):

Source/WebKit2:

Introduce a new SPI method on the UI delegate for clients who need to override data interaction operation behaviors.
Note that implementing this delegate method and returning YES will not propagate a `drop` event to the page.

* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:

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

5 years agoRebaseline js/dom/global-constructors-attributes.html.
ryanhaddad@apple.com [Thu, 9 Mar 2017 21:23:34 +0000 (21:23 +0000)]
Rebaseline js/dom/global-constructors-attributes.html.

Unreviewed test gardening.

* platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:

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

5 years agoFix DataInteraction guards
megan_gardner@apple.com [Thu, 9 Mar 2017 21:19:34 +0000 (21:19 +0000)]
Fix DataInteraction guards
https://bugs.webkit.org/show_bug.cgi?id=169404

Reviewed by Wenson Hsieh.

* WebCoreSupport/WebDragClient.mm:

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

5 years agoSource/JavaScriptCore:
fpizlo@apple.com [Thu, 9 Mar 2017 21:18:25 +0000 (21:18 +0000)]
Source/JavaScriptCore:
std::isnan/isinf should work with WTF time classes
https://bugs.webkit.org/show_bug.cgi?id=164991

Reviewed by Darin Adler.

Changes AtomicsObject to use std::isnan() instead of operator== to detect NaN.

* runtime/AtomicsObject.cpp:
(JSC::atomicsFuncWait):

Source/WTF:
std::isnan/isinf/isfinite should work with WTF time classes
https://bugs.webkit.org/show_bug.cgi?id=164991

Reviewed by Darin Adler.

The consensus view (see comments in https://bugs.webkit.org/show_bug.cgi?id=152045) of how
to check if something is NaN is to use std::isnan(). To be able to do that for time
classes, they need to provide their own isnan() overhload. This also provides isinf()
overloads.

* wtf/MonotonicTime.h:
(std::isnan):
(std::isinf):
* wtf/Seconds.h:
(std::isnan):
(std::isinf):
* wtf/TimeWithDynamicClockType.h:
(std::isnan):
(std::isinf):
* wtf/WallTime.h:
(std::isnan):
(std::isinf):

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

5 years agoJSC EWS repeat the log message thrice about patch not being relevant
commit-queue@webkit.org [Thu, 9 Mar 2017 21:13:41 +0000 (21:13 +0000)]
JSC EWS repeat the log message thrice about patch not being relevant
https://bugs.webkit.org/show_bug.cgi?id=169330

Patch by Srinivasan Vijayaraghavan <svijayaraghavan@apple.com> on 2017-03-09
Reviewed by Chris Dumez.

* Scripts/webkitpy/tool/steps/checkpatchrelevance.py:
(CheckPatchRelevance.run): Change log level to 'debug' to reduce stdout traffic.

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

5 years agoUse const AbstractLocker& (instead of const LockHolder&) in more places.
mark.lam@apple.com [Thu, 9 Mar 2017 21:05:41 +0000 (21:05 +0000)]
Use const AbstractLocker& (instead of const LockHolder&) in more places.
https://bugs.webkit.org/show_bug.cgi?id=169424

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

* heap/CodeBlockSet.cpp:
(JSC::CodeBlockSet::promoteYoungCodeBlocks):
* heap/CodeBlockSet.h:
* heap/CodeBlockSetInlines.h:
(JSC::CodeBlockSet::mark):
* heap/ConservativeRoots.cpp:
(JSC::CompositeMarkHook::CompositeMarkHook):
* heap/MachineStackMarker.cpp:
(JSC::MachineThreads::tryCopyOtherThreadStacks):
* heap/MachineStackMarker.h:
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::ensureBytecodesFor):
* profiler/ProfilerDatabase.h:
* runtime/SamplingProfiler.cpp:
(JSC::FrameWalker::FrameWalker):
(JSC::CFrameWalker::CFrameWalker):
(JSC::SamplingProfiler::createThreadIfNecessary):
(JSC::SamplingProfiler::takeSample):
(JSC::SamplingProfiler::start):
(JSC::SamplingProfiler::pause):
(JSC::SamplingProfiler::noticeCurrentThreadAsJSCExecutionThread):
(JSC::SamplingProfiler::clearData):
(JSC::SamplingProfiler::releaseStackTraces):
* runtime/SamplingProfiler.h:
(JSC::SamplingProfiler::setStopWatch):
* wasm/WasmMemory.cpp:
(JSC::Wasm::availableFastMemories):
(JSC::Wasm::activeFastMemories):
(JSC::Wasm::viewActiveFastMemories):
* wasm/WasmMemory.h:

Source/WTF:

* wtf/RunLoop.h:
* wtf/generic/RunLoopGeneric.cpp:
(WTF::RunLoop::wakeUp):
(WTF::RunLoop::schedule):

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

5 years agoLet clients control autoplay quirks with website policies.
mrajca@apple.com [Thu, 9 Mar 2017 20:47:10 +0000 (20:47 +0000)]
Let clients control autoplay quirks with website policies.
https://bugs.webkit.org/show_bug.cgi?id=169390

Reviewed by Wenson Hsieh.

Many sites incorrectly assume media will start off playing and display a pause button from the
start. We can trick many of these sites into updating their controls by sending a "pause"
event when we prevent a media element from playing.

We don't want this to become standard web behavior, however, since ultimately sites should adapt
to the new behavior. This patch lets clients decide which limited set of sites gets to use auto-play
quirks.

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::needsAutoplayPlayPauseEventsQuirk):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::allowsAutoplayQuirks):
(WebCore::DocumentLoader::setAllowsAutoplayQuirks):

Source/WebKit2:

* Shared/WebsitePolicies.h:
(WebKit::WebsitePolicies::encode):
(WebKit::WebsitePolicies::decode):
* UIProcess/API/APIWebsitePolicies.h:
* UIProcess/API/C/WKWebsitePolicies.cpp:
(WKWebsitePoliciesSetAllowsAutoplayQuirks):
(WKWebsitePoliciesGetAllowsAutoplayQuirks):
* UIProcess/API/C/WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies setAllowsAutoplayQuirks:]):
(-[_WKWebsitePolicies allowsAutoplayQuirks]):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateWebsitePolicies):

Tools:

* TestWebKitAPI/Tests/WebKit2/autoplay-check.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
(-[AutoplayPoliciesDelegate _webView:decidePolicyForNavigationAction:decisionHandler:]):
(TEST):

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

5 years agoUnreviewed, change my status to be a WebKit reviewer
dcrousso+webkit@gmail.com [Thu, 9 Mar 2017 20:35:10 +0000 (20:35 +0000)]
Unreviewed, change my status to be a WebKit reviewer

* Scripts/webkitpy/common/config/contributors.json:

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

5 years agoStandardize device/simulator naming conventions
jbedard@apple.com [Thu, 9 Mar 2017 19:46:19 +0000 (19:46 +0000)]
Standardize device/simulator naming conventions
https://bugs.webkit.org/show_bug.cgi?id=169083
<rdar://problem/30810466>

Reviewed by Alexey Proskuryakov.

* Scripts/build-webkit: Document --ios-device and --simulator options.
* Scripts/package-root:
(usage): Ditto.
* Scripts/run-api-tests: Document --simulator option.
* Scripts/webkitdirs.pm:
(argumentsForConfiguration): Use --ios-device by default rather than --device.
(determineXcodeSDK): Parse --ios-device and --simulator options.
* Scripts/webkitpy/common/config/ews.json: Change port name from ios to ios-device.
* Scripts/webkitpy/common/config/ports.py: Ditto.
(DeprecatedPort.port):
(IOSPort): Change port name from ios to ios-device.
* Scripts/webkitpy/port/factory.py:
(platform_options): Add --simulator option.
(PortFactory): Update comment.
* Scripts/webkitpy/port/ios_device.py:
(IOSDevicePort): Change port name from ios to ios-device.
(IOSDevicePort.operating_system): Ditto.

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

5 years agoWebAssembly: Make the Unity AngryBots demo run
sbarati@apple.com [Thu, 9 Mar 2017 19:18:34 +0000 (19:18 +0000)]
WebAssembly: Make the Unity AngryBots demo run
https://bugs.webkit.org/show_bug.cgi?id=169268

Reviewed by Keith Miller.

JSTests:

* wasm/function-tests/many-arguments-to-function.js: Added.
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.I32Const.0.I32Const.1.I32Const.2.I32Const.3.I32Const.4.I32Const.5.I32Const.6.I32Const.7.I32Const.8.I32Const.9.I32Const.10.I32Const.11.I32Const.12.I32Const.13.I32Const.14.I32Const.15.I32Const.16.I32Const.17.Call.0.Return.End.End.foo):
(i.instance.exports.f0.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.F32Const.Call.Return.End.End.foo):
(i.instance.exports.f0):
(instance.exports.f0.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.GetLocal.Call.Return.End.End.foo):
(instance.exports.f0):

Source/JavaScriptCore:

This patch fixes three bugs:
1. The WasmBinding code for making a JS call was off
by 1 in its stack layout code.
2. The WasmBinding code had a "<" comparison instead
of a ">=" comparison. This would cause us to calculate
the wrong frame pointer offset.
3. The code to reload wasm state inside B3IRGenerator didn't
properly represent its effects.

* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::restoreWebAssemblyGlobalState):
(JSC::Wasm::parseAndCompile):
* wasm/WasmBinding.cpp:
(JSC::Wasm::wasmToJs):
* wasm/js/WebAssemblyInstanceConstructor.cpp:
(JSC::WebAssemblyInstanceConstructor::createInstance):

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

5 years agoMake the VM Traps mechanism non-polling for the DFG and FTL.
mark.lam@apple.com [Thu, 9 Mar 2017 19:08:46 +0000 (19:08 +0000)]
Make the VM Traps mechanism non-polling for the DFG and FTL.
https://bugs.webkit.org/show_bug.cgi?id=168920
<rdar://problem/30738588>

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

1. Added a ENABLE(SIGNAL_BASED_VM_TRAPS) configuration in Platform.h.
   This is currently only enabled for OS(DARWIN) and ENABLE(JIT).
2. Added assembler functions for overwriting an instruction with a breakpoint.
3. Added a new JettisonDueToVMTraps jettison reason.
4. Added CodeBlock and DFG::CommonData utility functions for over-writing
   invalidation points with breakpoint instructions.
5. The BytecodeGenerator now emits the op_check_traps bytecode unconditionally.
6. Remove the JSC_alwaysCheckTraps option because of (4) above.
   For ports that don't ENABLE(SIGNAL_BASED_VM_TRAPS), we'll force
   Options::usePollingTraps() to always be true.  This makes the VMTraps
   implementation fall back to using polling based traps only.

7. Make VMTraps support signal based traps.

Some design and implementation details of signal based VM traps:

- The implementation makes use of 2 signal handlers for SIGUSR1 and SIGTRAP.

- VMTraps::fireTrap() will set the flag for the requested trap and instantiate
  a SignalSender.  The SignalSender will send SIGUSR1 to the mutator thread that
  we want to trap, and check for the occurence of one of the following events:

  a. VMTraps::handleTraps() has been called for the requested trap, or

  b. the VM is inactive and is no longer executing any JS code.  We determine
     this to be the case if the thread no longer owns the JSLock and the VM's
     entryScope is null.

     Note: the thread can relinquish the JSLock while the VM's entryScope is not
     null.  This happens when the thread calls JSLock::dropAllLocks() before
     calling a host function that may block on IO (or whatever).  For our purpose,
     this counts as the VM still running JS code, and VM::fireTrap() will still
     be waiting.

  If the SignalSender does not see either of these events, it will sleep for a
  while and then re-send SIGUSR1 and check for the events again.  When it sees
  one of these events, it will consider the mutator to have received the trap
  request.

- The SIGUSR1 handler will try to insert breakpoints at the invalidation points
  in the DFG/FTL codeBlock at the top of the stack.  This allows the mutator
  thread to break (with a SIGTRAP) exactly at an invalidation point, where it's
  safe to jettison the codeBlock.

  Note: we cannot have the requester thread (that called VMTraps::fireTrap())
  insert the breakpoint instructions itself.  This is because we need the
  register state of the the mutator thread (that we want to trap in) in order to
  find the codeBlocks that we wish to insert the breakpoints in.  Currently,
  we don't have a generic way for the requester thread to get the register state
  of another thread.

- The SIGTRAP handler will check to see if it is trapping on a breakpoint at an
  invalidation point.  If so, it will jettison the codeBlock and adjust the PC
  to re-execute the invalidation OSR exit off-ramp.  After the OSR exit, the
  baseline JIT code will eventually reach an op_check_traps and call
  VMTraps::handleTraps().

  If the handler is not trapping at an invalidation point, then it must be
  observing an assertion failure (which also uses the breakpoint instruction).
  In this case, the handler will defer to the default SIGTRAP handler and crash.

- The reason we need the SignalSender is because SignalSender::send() is called
  from another thread in a loop, so that VMTraps::fireTrap() can return sooner.
  send() needs to make use of the VM pointer, and it is not guaranteed that the
  VM will outlive the thread.  SignalSender provides the mechanism by which we
  can nullify the VM pointer when the VM dies so that the thread does not
  continue to use it.

* assembler/ARM64Assembler.h:
(JSC::ARM64Assembler::replaceWithBrk):
* assembler/ARMAssembler.h:
(JSC::ARMAssembler::replaceWithBrk):
* assembler/ARMv7Assembler.h:
(JSC::ARMv7Assembler::replaceWithBkpt):
* assembler/MIPSAssembler.h:
(JSC::MIPSAssembler::replaceWithBkpt):
* assembler/MacroAssemblerARM.h:
(JSC::MacroAssemblerARM::replaceWithJump):
* assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::replaceWithBreakpoint):
* assembler/MacroAssemblerARMv7.h:
(JSC::MacroAssemblerARMv7::replaceWithBreakpoint):
* assembler/MacroAssemblerMIPS.h:
(JSC::MacroAssemblerMIPS::replaceWithJump):
* assembler/MacroAssemblerX86Common.h:
(JSC::MacroAssemblerX86Common::replaceWithBreakpoint):
* assembler/X86Assembler.h:
(JSC::X86Assembler::replaceWithInt3):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::jettison):
(JSC::CodeBlock::hasInstalledVMTrapBreakpoints):
(JSC::CodeBlock::installVMTrapBreakpoints):
* bytecode/CodeBlock.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCheckTraps):
* dfg/DFGCommonData.cpp:
(JSC::DFG::CommonData::installVMTrapBreakpoints):
(JSC::DFG::CommonData::isVMTrapBreakpoint):
* dfg/DFGCommonData.h:
(JSC::DFG::CommonData::hasInstalledVMTrapsBreakpoints):
* dfg/DFGJumpReplacement.cpp:
(JSC::DFG::JumpReplacement::installVMTrapBreakpoint):
* dfg/DFGJumpReplacement.h:
(JSC::DFG::JumpReplacement::dataLocation):
* dfg/DFGNodeType.h:
* heap/CodeBlockSet.cpp:
(JSC::CodeBlockSet::contains):
* heap/CodeBlockSet.h:
* heap/CodeBlockSetInlines.h:
(JSC::CodeBlockSet::iterate):
* heap/Heap.cpp:
(JSC::Heap::forEachCodeBlockIgnoringJITPlansImpl):
* heap/Heap.h:
* heap/HeapInlines.h:
(JSC::Heap::forEachCodeBlockIgnoringJITPlans):
* heap/MachineStackMarker.h:
(JSC::MachineThreads::threadsListHead):
* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::isValidExecutableMemory):
* jit/ExecutableAllocator.h:
* profiler/ProfilerJettisonReason.cpp:
(WTF::printInternal):
* profiler/ProfilerJettisonReason.h:
* runtime/JSLock.cpp:
(JSC::JSLock::didAcquireLock):
* runtime/Options.cpp:
(JSC::overrideDefaults):
* runtime/Options.h:
* runtime/PlatformThread.h:
(JSC::platformThreadSignal):
* runtime/VM.cpp:
(JSC::VM::~VM):
(JSC::VM::ensureWatchdog):
(JSC::VM::handleTraps): Deleted.
(JSC::VM::setNeedAsynchronousTerminationSupport): Deleted.
* runtime/VM.h:
(JSC::VM::ownerThread):
(JSC::VM::traps):
(JSC::VM::handleTraps):
(JSC::VM::needTrapHandling):
(JSC::VM::needAsynchronousTerminationSupport): Deleted.
* runtime/VMTraps.cpp:
(JSC::VMTraps::vm):
(JSC::SignalContext::SignalContext):
(JSC::SignalContext::adjustPCToPointToTrappingInstruction):
(JSC::vmIsInactive):
(JSC::findActiveVMAndStackBounds):
(JSC::handleSigusr1):
(JSC::handleSigtrap):
(JSC::installSignalHandlers):
(JSC::sanitizedTopCallFrame):
(JSC::isSaneFrame):
(JSC::VMTraps::tryInstallTrapBreakpoints):
(JSC::VMTraps::invalidateCodeBlocksOnStack):
(JSC::VMTraps::VMTraps):
(JSC::VMTraps::willDestroyVM):
(JSC::VMTraps::addSignalSender):
(JSC::VMTraps::removeSignalSender):
(JSC::VMTraps::SignalSender::willDestroyVM):
(JSC::VMTraps::SignalSender::send):
(JSC::VMTraps::fireTrap):
(JSC::VMTraps::handleTraps):
* runtime/VMTraps.h:
(JSC::VMTraps::~VMTraps):
(JSC::VMTraps::needTrapHandling):
(JSC::VMTraps::notifyGrabAllLocks):
(JSC::VMTraps::SignalSender::SignalSender):
(JSC::VMTraps::invalidateCodeBlocksOnStack):
* tools/VMInspector.cpp:
* tools/VMInspector.h:
(JSC::VMInspector::getLock):
(JSC::VMInspector::iterate):

Source/WebCore:

No new tests needed.  This is covered by existing tests.

* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::WorkerScriptController):
(WebCore::WorkerScriptController::scheduleExecutionTermination):

Source/WTF:

Make StackBounds more useful for checking if a pointer is within stack bounds.

* wtf/MetaAllocator.cpp:
(WTF::MetaAllocator::isInAllocatedMemory):
* wtf/MetaAllocator.h:
* wtf/Platform.h:
* wtf/StackBounds.h:
(WTF::StackBounds::emptyBounds):
(WTF::StackBounds::StackBounds):
(WTF::StackBounds::isEmpty):
(WTF::StackBounds::contains):

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

5 years agowebkitpy: Add unit test to prevent breakage of EWS
jbedard@apple.com [Thu, 9 Mar 2017 19:08:37 +0000 (19:08 +0000)]
webkitpy: Add unit test to prevent breakage of EWS
https://bugs.webkit.org/show_bug.cgi?id=169385

Reviewed by Alexey Proskuryakov.

Prevent <http://trac.webkit.org/changeset/213545> from happening in the future.

* Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
(test_ews_name): Added.

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

5 years agoWebGPU: Backend - Library and Functions
dino@apple.com [Thu, 9 Mar 2017 19:02:11 +0000 (19:02 +0000)]
WebGPU: Backend - Library and Functions
https://bugs.webkit.org/show_bug.cgi?id=169371
<rdar://problem/30928792>

Reviewed by Tim Horton.

Source/WebCore:

Implement the backends for GPULibrary and GPUFunction.
A GPULibrary is created from a GPUDevice, given some
shader source code. You can then extract the GPUFunctions
from the library.

WebKitAPITests: GPULibrary and GPUFunction.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/cocoa/GPUFunctionMetal.mm:
(WebCore::GPUFunction::GPUFunction):
(WebCore::GPUFunction::name):
(WebCore::GPUFunction::platformFunction):
* platform/graphics/cocoa/GPULibraryMetal.mm:
(WebCore::GPULibrary::GPULibrary):
(WebCore::GPULibrary::label):
(WebCore::GPULibrary::setLabel):
(WebCore::GPULibrary::functionNames):
(WebCore::GPULibrary::platformLibrary):
* platform/graphics/gpu/GPUDevice.cpp:
(WebCore::GPUDevice::createLibrary):
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/GPUFunction.cpp:
(WebCore::GPUFunction::create):
(WebCore::GPUFunction::~GPUFunction):
(WebCore::GPUFunction::GPUFunction):
(WebCore::GPUFunction::name):
* platform/graphics/gpu/GPUFunction.h:
* platform/graphics/gpu/GPULibrary.cpp:
(WebCore::GPULibrary::create):
(WebCore::GPULibrary::~GPULibrary):
(WebCore::GPULibrary::label):
(WebCore::GPULibrary::setLabel):
(WebCore::GPULibrary::functionNames):
(WebCore::GPULibrary::functionWithName):
* platform/graphics/gpu/GPULibrary.h:

Tools:

Add tests for GPULibrary and GPUFunction.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm:
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::TEST): Deleted.
* TestWebKitAPI/Tests/WebCore/mac/GPUFunction.mm: Copied from Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm.
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/mac/GPULibrary.mm: Copied from Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm.
(TestWebKitAPI::TEST_F):
* TestWebKitAPI/Tests/WebCore/mac/GPUTest.h: Copied from Tools/TestWebKitAPI/Tests/WebCore/mac/GPUDevice.mm.
(TestWebKitAPI::GPU::librarySourceCode):

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

5 years ago[WK2] Prevent app nap for the active tab
cdumez@apple.com [Thu, 9 Mar 2017 18:54:01 +0000 (18:54 +0000)]
[WK2] Prevent app nap for the active tab
https://bugs.webkit.org/show_bug.cgi?id=169417
<rdar://problem/30876965>

Reviewed by Gavin Barraclough.

Prevent app nap for the active tab to minimize the risks of breakage.

From the AppNap documentation [1], the app is only a candidate for app nap if it not the
foreground app. However, in the Safari case, the foreground app is Safari (UIProcess) and
the same policy does not apply to our foreground WebContent process unless we explicitly
make it so. This patch addresses the issue by taking a UserActivity when the tab is
active to prevent app nap.

[1] https://developer.apple.com/library/content/documentation/Performance/Conceptual/power_efficiency_guidelines_osx/AppNap.html

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateThrottleState):

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

5 years agoWebKit: JSC: JSObject::ensureLength doesn't check if ensureLengthSlow failed
fpizlo@apple.com [Thu, 9 Mar 2017 18:53:05 +0000 (18:53 +0000)]
WebKit: JSC: JSObject::ensureLength doesn't check if ensureLengthSlow failed
https://bugs.webkit.org/show_bug.cgi?id=169215

Reviewed by Mark Lam.

This doesn't have a test because it would be a very complicated test.

* runtime/JSObject.h:
(JSC::JSObject::ensureLength): If ensureLengthSlow returns false, we need to return false.

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

5 years agoAdd new delegate methods
andersca@apple.com [Thu, 9 Mar 2017 18:33:17 +0000 (18:33 +0000)]
Add new delegate methods
https://bugs.webkit.org/show_bug.cgi?id=169394
Part of rdar://problem/28880714.

Reviewed by Tim Horton.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.h:
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(-[WKPaymentAuthorizationViewControllerDelegate invalidate]):
(toShippingMethod):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:handler:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectPaymentMethod:handler:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:handler:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:handler:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didAuthorizePayment:completion:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingMethod:completion:]):
(-[WKPaymentAuthorizationViewControllerDelegate paymentAuthorizationViewController:didSelectShippingContact:completion:]):
(WebKit::toPKPaymentAuthorizationStatus):
(WebKit::toPKPaymentErrorCode):
(WebKit::toNSError):
(WebKit::toNSErrors):
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession):
(WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingMethodSelection):
(WebKit::WebPaymentCoordinatorProxy::platformCompleteShippingContactSelection):
(WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentMethodSelection):

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

5 years agoAlign Document.elementFromPoint() with the CSSOM specification
cdumez@apple.com [Thu, 9 Mar 2017 17:59:46 +0000 (17:59 +0000)]
Align Document.elementFromPoint() with the CSSOM specification
https://bugs.webkit.org/show_bug.cgi?id=169403

Reviewed by Sam Weinig.

Source/WebCore:

Align Document.elementFromPoint() with the CSSOM specification:
- https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface

In particular, the parameters should be mandatory and of type double.

The parameters are mandatory in both Firefox and Chrome already. Parameters
are finite floating point in Firefox and integers in Chrome.

Test: fast/dom/elementFromPoint-parameters.html

* dom/DocumentOrShadowRoot.idl:
* dom/TreeScope.cpp:
(WebCore::TreeScope::elementFromPoint):
* dom/TreeScope.h:

LayoutTests:

Add layout test coverage.

* fast/dom/elementFromPoint-parameters-expected.txt: Added.
* fast/dom/elementFromPoint-parameters.html: Added.
* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/script-tests/non-numeric-values-numeric-parameters.js:

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

5 years agoWTF should make it super easy to do ARM concurrency tricks
fpizlo@apple.com [Thu, 9 Mar 2017 17:40:10 +0000 (17:40 +0000)]
WTF should make it super easy to do ARM concurrency tricks
https://bugs.webkit.org/show_bug.cgi?id=169300

Reviewed by Mark Lam.

Source/JavaScriptCore:

This changes a bunch of GC hot paths to use new concurrency APIs that lead to optimal
code on both x86 (fully leverage TSO, transactions become CAS loops) and ARM (use
dependency chains for fencing, transactions become LL/SC loops). While inspecting the
machine code, I found other opportunities for improvement, like inlining the "am I
marked" part of the marking functions.

* heap/Heap.cpp:
(JSC::Heap::setGCDidJIT):
* heap/HeapInlines.h:
(JSC::Heap::testAndSetMarked):
* heap/LargeAllocation.h:
(JSC::LargeAllocation::isMarked):
(JSC::LargeAllocation::isMarkedConcurrently):
(JSC::LargeAllocation::aboutToMark):
(JSC::LargeAllocation::testAndSetMarked):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::areMarksStaleWithDependency):
(JSC::MarkedBlock::aboutToMark):
(JSC::MarkedBlock::isMarkedConcurrently):
(JSC::MarkedBlock::isMarked):
(JSC::MarkedBlock::testAndSetMarked):
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::appendSlow):
(JSC::SlotVisitor::appendHiddenSlow):
(JSC::SlotVisitor::appendHiddenSlowImpl):
(JSC::SlotVisitor::setMarkedAndAppendToMarkStack):
(JSC::SlotVisitor::appendUnbarriered): Deleted.
(JSC::SlotVisitor::appendHidden): Deleted.
* heap/SlotVisitor.h:
* heap/SlotVisitorInlines.h:
(JSC::SlotVisitor::appendUnbarriered):
(JSC::SlotVisitor::appendHidden):
(JSC::SlotVisitor::append):
(JSC::SlotVisitor::appendValues):
(JSC::SlotVisitor::appendValuesHidden):
* runtime/CustomGetterSetter.cpp:
* runtime/JSObject.cpp:
(JSC::JSObject::visitButterflyImpl):
* runtime/JSObject.h:

Source/WTF:

This adds Atomic<>::loadLink and Atomic<>::storeCond, available only when HAVE(LL_SC).

It abstracts loadLink/storeCond behind prepare/attempt. You can write prepare/attempt
loops whenever your loop fits into the least common denominator of LL/SC and CAS.

This modifies Atomic<>::transaction to use prepare/attempt. So, if you write your loop
using Atomic<>::transaction, then you get LL/SC for free.

Depending on the kind of transaction you are doing, you may not want to perform an LL
until you have a chance to just load the current value. Atomic<>::transaction() assumes
that you do not care to have any ordering guarantees in that case. If you think that
the transaction has a good chance of aborting this way, you want
Atomic<>::transaction() to first do a plain load. But if you don't think that such an
abort is likely, then you want to go straight to the LL. The API supports this concept
via TransactionAbortLikelihood.

Additionally, this redoes the depend/consume API to be dead simple. Dependency is
unsigned. You get a dependency on a loaded value by just saying
dependency(loadedValue). You consume the dependency by using it as a bonus index to
some pointer dereference. This is made easy with the consume<T*>(ptr, dependency)
helper. In those cases where you want to pass around both a computed value and a
dependency, there's DependencyWith<T>. But you won't need it in most cases. The loaded
value or any value computed from the loaded value is a fine input to dependency()!

This change updates a bunch of hot paths to use the new APIs. Using transaction() gives
us optimal LL/SC loops for object marking and lock acquisition.

This change also updates a bunch of hot paths to use dependency()/consume().

This is a significant Octane/splay speed-up on ARM.

* wtf/Atomics.h:
(WTF::hasFence):
(WTF::Atomic::prepare):
(WTF::Atomic::attempt):
(WTF::Atomic::transaction):
(WTF::Atomic::transactionRelaxed):
(WTF::nullDependency):
(WTF::dependency):
(WTF::DependencyWith::DependencyWith):
(WTF::dependencyWith):
(WTF::consume):
(WTF::Atomic::tryTransactionRelaxed): Deleted.
(WTF::Atomic::tryTransaction): Deleted.
(WTF::zeroWithConsumeDependency): Deleted.
(WTF::consumeLoad): Deleted.
* wtf/Bitmap.h:
(WTF::WordType>::get):
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
* wtf/LockAlgorithm.h:
(WTF::LockAlgorithm::lockFast):
(WTF::LockAlgorithm::unlockFast):
(WTF::LockAlgorithm::unlockSlow):
* wtf/Platform.h:

Tools:

This vastly simplifies the consume API. The new API is thoroughly tested by being used
in the GC's guts. I think that unit tests are a pain to maintain, so we shouldn't have
them unless we are legitimately worried about coverage. We're not in this case.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/Consume.cpp: Removed.

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

5 years agoWeb Inspector: DOMTreeManager dispatches DocumentUpdated twice when the document...
mattbaker@apple.com [Thu, 9 Mar 2017 17:40:06 +0000 (17:40 +0000)]
Web Inspector: DOMTreeManager dispatches DocumentUpdated twice when the document is cleared
https://bugs.webkit.org/show_bug.cgi?id=168984

Reviewed by Timothy Hatcher.

* UserInterface/Controllers/DOMTreeManager.js:
(WebInspector.DOMTreeManager.prototype._setDocument):
Compare old and new document values before dispatching message.

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

5 years agoWKWebView should automatically respect insets from the view controller hierarchy
timothy_horton@apple.com [Thu, 9 Mar 2017 16:26:41 +0000 (16:26 +0000)]
WKWebView should automatically respect insets from the view controller hierarchy
https://bugs.webkit.org/show_bug.cgi?id=169398
<rdar://problem/30617593>

Reviewed by Dean Jackson.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _computedContentInset]):
(activeMinimumLayoutSize):
(-[WKWebView _frameOrBoundsChanged]):
Factor insets from above us in the view controller hierarchy into our
content insets (and layout size) automatically.

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

5 years ago[mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html...
commit-queue@webkit.org [Thu, 9 Mar 2017 16:17:47 +0000 (16:17 +0000)]
[mac-wk1] LayoutTest media/modern-media-controls/airplay-button/airplay-button.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=168409

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

Adding yet more logging to try to determine the cause of this test's flakiness.

* media/modern-media-controls/airplay-button/airplay-button-expected.txt:
* media/modern-media-controls/airplay-button/airplay-button.html:

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

5 years ago[Modern Media Controls] Fullscreen controls are difficult to drag around
commit-queue@webkit.org [Thu, 9 Mar 2017 16:10:50 +0000 (16:10 +0000)]
[Modern Media Controls] Fullscreen controls are difficult to drag around
https://bugs.webkit.org/show_bug.cgi?id=169412
<rdar://problem/30931892>

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

Source/WebCore:

Up until now, we would simply check that the event target when attempting to
initiate a drag would be the controls bar and not any of its children. This
was not so great as this would encompass also a large margin around the left,
center and right button containers as well as the time labels. We now check
that the event target is anything but an interactive element (<button> or <input>).

The existing test at media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html
has been updated to initiate dragging right between the rewind and play/pause button,
which would fail prior to this patch since this would have hit-tested within the center
button container and thus prevent dragging.

* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
(.media-controls.mac.fullscreen button.volume-down):
(.media-controls.mac.fullscreen button.volume-up):
(.media-controls.mac.fullscreen button.rewind):
(.media-controls.mac.fullscreen button.play-pause):
(.media-controls.mac.fullscreen button.forward):
(.media-controls.mac.fullscreen .buttons-container.right button):
* Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
(MacOSFullscreenMediaControls.prototype._handleMousedown):
* Modules/modern-media-controls/controls/macos-inline-media-controls.css:
(.media-controls.mac.inline > .controls-bar button):
* Modules/modern-media-controls/controls/macos-media-controls.css:
(.media-controls.mac > .controls-bar button):

LayoutTests:

* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles-expected.txt:
* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html:
Rebaseline test to account for CSS changes.

* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag-is-prevented-over-button.html:
Change drag start coordinate to be right over a button so that it is prevented. Starting with this patch,
a drag at this coordinate would have been tolerated as being part of the left buttons container but not
part of a button in that container.

* media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-drag.html:
Change drag start coordinate to be right between two buttons so that it would have failed prior to this
patch.

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

5 years ago[Modern Media Controls] Controls are not visible in fullscreen without the controls...
commit-queue@webkit.org [Thu, 9 Mar 2017 15:59:58 +0000 (15:59 +0000)]
[Modern Media Controls] Controls are not visible in fullscreen without the controls attribute
https://bugs.webkit.org/show_bug.cgi?id=169411
<rdar://problem/30931724>

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

Source/WebCore:

Ensure we show controls in fullscreen in the absence of the controls attribute.

Tests: media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html
       media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html

* Modules/modern-media-controls/media/controls-visibility-support.js:
(ControlsVisibilitySupport.prototype.get mediaEvents):
(ControlsVisibilitySupport.prototype._updateControls):
(ControlsVisibilitySupport):

LayoutTests:

Add two new tests to check that controls are visible in fullscreen in the absence of the controls attribute,
except if the fullscreen element is a parent element.

* media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-parent-element.html: Added.
* media/modern-media-controls/controls-visibility-support/controls-visibility-support-fullscreen-on-video.html: Added.
* platform/ios-simulator/TestExpectations: Skip new tests on iOS since it uses platform controls.

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

5 years agoSimple line layout: Add top level pagination support.
zalan@apple.com [Thu, 9 Mar 2017 15:25:12 +0000 (15:25 +0000)]
Simple line layout: Add top level pagination support.
https://bugs.webkit.org/show_bug.cgi?id=169410
<rdar://problem/28536227>

Reviewed by Antti Koivisto.

Source/WebCore:

This patch enables top level pagination for simple line layout.

Covered by existing tests.

* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::pushLayoutStateForPagination): Pagination flag needs to be set before calling pushLayoutStateForCurrentFlowThread.
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForWithReason):
* rendering/SimpleLineLayoutCoverage.cpp:
(WebCore::SimpleLineLayout::printReason):
* rendering/SimpleLineLayoutCoverage.h:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/SimpleLineLayoutPagination.cpp:
(WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow): Matching normal line layout values.
(WebCore::SimpleLineLayout::setPageBreakForLine): Logic here matches RenderBlockFlow::adjustLinePositionForPagination

LayoutTests:

* TestExpectations:

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

5 years agoCorrectly process the return value of gdk_drag_context_get_selected_action()
tpopela@redhat.com [Thu, 9 Mar 2017 14:24:04 +0000 (14:24 +0000)]
Correctly process the return value of gdk_drag_context_get_selected_action()

Reviewed by Carlos Garcia Campos.

It returns the action itself and not the bitmask.

* UIProcess/gtk/DragAndDropHandler.cpp:
(WebKit::DragAndDropHandler::drop):

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

5 years ago[GTK] Use GtkFileChooserNative for open/save dialogs
commit-queue@webkit.org [Thu, 9 Mar 2017 13:42:39 +0000 (13:42 +0000)]
[GTK] Use GtkFileChooserNative for open/save dialogs
https://bugs.webkit.org/show_bug.cgi?id=169278

Patch by Adrian Perez de Castro <aperez@igalia.com> on 2017-03-09
Reviewed by Carlos Garcia Campos.

When building with GTK+ 3.20.0 or newer, use GtkFileChooserNative instead of GtkFileChooserDialog to allow for
better integration with the runtime environment and use native open/save dialogs. This also makes WebKitGTK+ use
portal-based load/save dialogs when running inside the Flatpak sandbox.

The existing GtkFileChooserDialog implementation will still be used when building against older versions of
GTK+, so this change does not require a new version of the toolkit.

* UIProcess/API/gtk/WebKitWebView.cpp:
(fileChooserDialogResponseCallback):
(webkitWebViewRunFileChooser):

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

5 years ago[GStreamer][MSE] Fix 'comparison between signed and unsigned integer
tpopela@redhat.com [Thu, 9 Mar 2017 13:10:20 +0000 (13:10 +0000)]
[GStreamer][MSE] Fix 'comparison between signed and unsigned integer
expressions' warning

Reviewed by Žan Doberšek.

* platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
(WebCore::PlaybackPipeline::flush):

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

5 years agoWeb Inspector: Add settings for controlling Styles sidebar intelligence
commit-queue@webkit.org [Thu, 9 Mar 2017 10:51:36 +0000 (10:51 +0000)]
Web Inspector: Add settings for controlling Styles sidebar intelligence
https://bugs.webkit.org/show_bug.cgi?id=169181

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-03-09
Reviewed by Timothy Hatcher.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Setting.js:
Add three new settings:
 - stylesShowInlineWarnings
 - stylesInsertNewline
 - stylesSelectOnFirstClick

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleMouseDown):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._handleMouseUp):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createInlineSwatches.update):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._createTextMarkerForPropertyIfNeeded):

* UserInterface/Views/SettingsTabContentView.css:
(.content-view.settings > .separator): Added.
(.content-view.settings > .setting-container):
(.content-view.settings > .setting-container.combined):

* UserInterface/Views/SettingsTabContentView.js:
(WebInspector.SettingsTabContentView.prototype.layout.createContainer):
(WebInspector.SettingsTabContentView.prototype.layout.createSeparator): Added.
(WebInspector.SettingsTabContentView.prototype.layout):

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

5 years agoImplement stroke-width CSS property.
pvollan@apple.com [Thu, 9 Mar 2017 09:51:04 +0000 (09:51 +0000)]
Implement stroke-width CSS property.
https://bugs.webkit.org/show_bug.cgi?id=169273

Reviewed by Simon Fraser.

Source/WebCore:

Support setting text stroke width using the CSS property stroke-width, see https://drafts.fxtf.org/paint/.
Text stroke width can currently be set with the -webkit-text-stroke-width property. To make sure this still
works, I added a check to determine if the stroke-width property has been explicitly set. If it has not been
set, we fall back to the value of the -webkit-text-stroke-width property.

Tests: fast/css/stroke-width-percent.html
       fast/css/stroke-width.html

* css/CSSProperties.json:
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueStrokeWidth):
(WebCore::StyleBuilderCustom::applyValueWebkitTextStrokeWidth):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::addToLine):
(WebCore::InlineFlowBox::addTextBoxVisualOverflow):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::computeOverflow):
* rendering/TextDecorationPainter.cpp:
(WebCore::decorationColor):
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
(WebCore::computeTextSelectionPaintStyle):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::RenderStyle):
(WebCore::RenderStyle::computedTextStrokeWidth):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::setHasExplicitlySetStrokeWidth):
(WebCore::RenderStyle::hasExplicitlySetStrokeWidth):
(WebCore::RenderStyle::setHasExplicitlySetWebKitTextStrokeWidth):
(WebCore::RenderStyle::hasExplicitlySetWebKitTextStrokeWidth):
(WebCore::RenderStyle::InheritedFlags::operator==):

LayoutTests:

* fast/css/stroke-width-expected.html: Added.
* fast/css/stroke-width-percent-expected.html: Added.
* fast/css/stroke-width-percent.html: Added.
* fast/css/stroke-width.html: Added.

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

5 years agoSource/WebCore:
antti@apple.com [Thu, 9 Mar 2017 09:07:08 +0000 (09:07 +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: https://svn.webkit.org/repository/webkit/trunk@213633 268f45cc-cd09-0410-ab3c-d52691b4dbfc

5 years ago[Modern Media Controls] iOS: Live Broadcast video shows scrubber with 00:00 duration...
commit-queue@webkit.org [Thu, 9 Mar 2017 07:45:11 +0000 (07:45 +0000)]
[Modern Media Controls] iOS: Live Broadcast video shows scrubber with 00:00 duration until paused
https://bugs.webkit.org/show_bug.cgi?id=169374
<rdar://problem/30063273>

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

Source/WebCore:

We need to make sure we update the controls layout when they come back from being hidden, so promote
that functionality from MacOSInlineMediaControls to MediaControls so that iOS can pick that behavior
up.

Test: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label-enabled-hidden-controls-bar.html

* Modules/modern-media-controls/controls/macos-inline-media-controls.js:
(MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange): Deleted.
* Modules/modern-media-controls/controls/media-controls.js:
(MediaControls.prototype.controlsBarVisibilityDidChange):

LayoutTests:

Add a test that checks that we correctly show the status label after enabling it with the controls bar
invisible.

* media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label-enabled-hidden-controls-bar-expected.txt: Added.
* media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-status-label-enabled-hidden-controls-bar.html: Added.

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

5 years ago[GTK] JSC test stress/arity-check-ftl-throw.js.ftl-no-cjit-validate-sampling-profiler...
utatane.tea@gmail.com [Thu, 9 Mar 2017 06:31:55 +0000 (06:31 +0000)]
[GTK] JSC test stress/arity-check-ftl-throw.js.ftl-no-cjit-validate-sampling-profiler crashing on GTK bot
https://bugs.webkit.org/show_bug.cgi?id=160124

Reviewed by Mark Lam.

JSTests:

* stress/spread-forward-call-varargs-stack-overflow.js:

Source/JavaScriptCore:

When performing CallVarargs, we will copy values to the stack.
Before actually copying values, we need to adjust the stackPointerRegister
to ensure copied values are in the allocated stack area.
If we do not that, OS can break the values that is stored beyond the stack
pointer. For example, signal stack can be constructed on these area, and
breaks values.

This patch fixes the crash in stress/spread-forward-call-varargs-stack-overflow.js
in Linux port. Since Linux ports use signal to suspend and resume threads,
signal handler is frequently called when enabling sampling profiler. Thus this
crash occurs.

* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
* jit/SetupVarargsFrame.cpp:
(JSC::emitSetupVarargsFrameFastCase):
* jit/SetupVarargsFrame.h:

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

5 years agoFix error/warning duplication in JSON bindings results
commit-queue@webkit.org [Thu, 9 Mar 2017 06:02:32 +0000 (06:02 +0000)]
Fix error/warning duplication in JSON bindings results
https://bugs.webkit.org/show_bug.cgi?id=169305

Patch by Srinivasan Vijayaraghavan <svijayaraghavan@apple.com> on 2017-03-08
Reviewed by Alexey Proskuryakov.

The distinction between failures and errors is not meaningful, since all errors will also be failures.
As a result, we only need to keep track of failures.

* Scripts/webkitpy/bindings/main.py:
(BindingsTests.__init__): Remove errors.
(BindingsTests.detect_changes): Remove errors.
(BindingsTests.main): Remove errors.

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

5 years ago[JSC] Add helpers to run Six Speed to run-jsc-benchmarks
utatane.tea@gmail.com [Thu, 9 Mar 2017 05:54:21 +0000 (05:54 +0000)]
[JSC] Add helpers to run Six Speed to run-jsc-benchmarks
https://bugs.webkit.org/show_bug.cgi?id=169351

Reviewed by Saam Barati.

PerformanceTests:

* SixSpeed/wrappers/wrapper.js: Added.
(assertEqual):
(test):
(jscRun):

Tools:

This patch adds an ability to run six-speed microbenchmarks
from run-jsc-benchmarks by specifying six-speed directory in
arewefastyet repository.

While it is a collection of microbenchmarks, it is useful
to ensure that our ES6 optimization covers major use cases.
For the macrobenchmark, we already have ARES-6.

* Scripts/run-jsc-benchmarks:

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

5 years ago[WebCrypto] Implement SubtleCrypto::DeriveKey method
jiewen_tan@apple.com [Thu, 9 Mar 2017 05:50:31 +0000 (05:50 +0000)]
[WebCrypto] Implement SubtleCrypto::DeriveKey method
https://bugs.webkit.org/show_bug.cgi?id=169386
<rdar://problem/23789585>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch does following few things:
1. It implements SubtleCrypto::DeriveKey method according to the spec:
https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey.
2. It implements getKeyLength operations for AES-CBC, AES-KW, AES-CFB,
AES-GCM, and HMAC, which is needed by the SubtleCrypto::DeriveKey method.
3. It enables ECDH DeriveKey operation.
4. It replaces unigned long with size_t in all the crypto codes.

Tests: crypto/subtle/derive-key-malformed-parameters.html
       crypto/subtle/ecdh-import-key-derive-aes-key.html
       crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html
       crypto/subtle/unwrap-key-malformed-parameters.html
       crypto/subtle/wrap-key-malformed-parameters.html
       crypto/workers/subtle/ecdh-import-key-derive-key.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionEncryptPromise):
(WebCore::jsSubtleCryptoFunctionDecryptPromise):
(WebCore::jsSubtleCryptoFunctionSignPromise):
(WebCore::jsSubtleCryptoFunctionVerifyPromise):
(WebCore::jsSubtleCryptoFunctionDigestPromise):
(WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
(WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
Remove unnecessary return statement from callbacks.
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::deriveBits):
(WebCore::CryptoAlgorithm::getKeyLength):
* crypto/CryptoAlgorithm.h:
* crypto/CryptoAlgorithmParameters.h:
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::generateKey):
(WebCore::CryptoAlgorithmAES_CBC::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_CBC.h:
* crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
(WebCore::CryptoAlgorithmAES_CFB::generateKey):
(WebCore::CryptoAlgorithmAES_CFB::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_CFB.h:
* crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
(WebCore::CryptoAlgorithmAES_GCM::generateKey):
(WebCore::CryptoAlgorithmAES_GCM::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_GCM.h:
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
(WebCore::CryptoAlgorithmAES_KW::generateKey):
(WebCore::CryptoAlgorithmAES_KW::getKeyLength):
* crypto/algorithms/CryptoAlgorithmAES_KW.h:
* crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::deriveBits):
* crypto/algorithms/CryptoAlgorithmECDH.h:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::getKeyLength):
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::getKeyLength):
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::getKeyLengthFromHash):
(WebCore::CryptoKeyHMAC::generate):
(WebCore::CryptoKeyHMAC::getKeyLength):
* crypto/keys/CryptoKeyHMAC.h:
* crypto/mac/CryptoAlgorithmECDHMac.cpp:
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/parameters/AesKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/AesKeyGenParams.idl.
* crypto/parameters/CryptoAlgorithmAesKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
Rename AesKeyGenParams to AesKeyParams to represent a unified dictionary for AesKeyGenParams and AesDerivedKeyParams.
* crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
* crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h:

LayoutTests:

* crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/derive-key-malformed-parameters-expected.txt: Added.
* crypto/subtle/derive-key-malformed-parameters.html: Added.
* crypto/subtle/deriveKey-malformed-parameters-expected.txt: Removed.
* crypto/subtle/deriveKey-malformed-parameters.html: Removed.
* crypto/subtle/ecdh-import-key-derive-aes-key-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-aes-key.html: Added.
* crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-hmac-key-custom-length.html: Added.
* crypto/subtle/unwrap-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/unwrapKey-malformed-parameters-expected.txt.
* crypto/subtle/unwrap-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/unwrapKey-malformed-parameters.html.
* crypto/subtle/wrap-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/wrapKey-malformed-parameters-expected.txt.
* crypto/subtle/wrap-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/wrapKey-malformed-parameters.html.
A bit renaming.
* crypto/workers/subtle/ecdh-import-key-derive-key-expected.txt: Added.
* crypto/workers/subtle/ecdh-import-key-derive-key.html: Added.
* crypto/workers/subtle/resources/ecdh-import-key-derive-key.js: Added.

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

5 years agoAdd plumbing for WebCore to notify WebKit2 when an edit drag has concluded
wenson_hsieh@apple.com [Thu, 9 Mar 2017 05:16:20 +0000 (05:16 +0000)]
Add plumbing for WebCore to notify WebKit2 when an edit drag has concluded
https://bugs.webkit.org/show_bug.cgi?id=169392
<rdar://problem/30882974>

Reviewed by Tim Horton.

Source/WebCore:

Add DragClient::didConcludeEditDrag and invoke it after performing an edit drag in
DragController::performDragOperation.

* page/DragClient.h:
(WebCore::DragClient::didConcludeEditDrag):
* page/DragController.cpp:
(WebCore::DragController::performDragOperation):

Source/WebKit/mac:

Add a stub implementation of WebDragClient::didConcludeEditDrag.

* WebCoreSupport/WebDragClient.h:

Source/WebKit2:

Add boilerplate plumbing for didConcludeEditDataInteraction from the web process to the UI process. Also makes
some minor tweaks to WKContentView along the way.

* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didConcludeEditDataInteraction):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:

Bail out of zooming to the focus rect when performing a data interaction operation. This needs to eventually
work, but is not high priority at the moment.

(-[WKContentView becomeFirstResponderForWebView]):
(-[WKContentView _displayFormNodeInputView]):
(-[WKContentView useSelectionAssistantWithMode:]):
(-[WKContentView _updateChangedSelection:]):
(-[WKContentView suppressAssistantSelectionView]):
(-[WKContentView setSuppressAssistantSelectionView:]):

Add a mechanism for suppressing the text interaction assistant's selection view. If the text interaction
assistant exists while beginning or ending suppression, the selection will be deactivated or activated. If there
is not text interaction assistant, then we instead remember whether or not we should be suppressing the
selection, and bail out of activating the selection if so.

* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didConcludeEditDataInteraction):
* WebProcess/WebCoreSupport/WebDragClient.h:
* WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::didConcludeEditDrag):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::didConcludeEditDataInteraction):

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

5 years agoWeb Inspector: Add DOM breakpoints UI for node/subtree modification events
mattbaker@apple.com [Thu, 9 Mar 2017 04:55:56 +0000 (04:55 +0000)]
Web Inspector: Add DOM breakpoints UI for node/subtree modification events
https://bugs.webkit.org/show_bug.cgi?id=168101

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: inspector/dom-debugger/dom-breakpoints.html

* inspector/InspectorDOMAgent.h:
Removed declarations for undefined member functions.

* inspector/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::disable):
(WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded):
(WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
(WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
Check that DebuggerAgent breakpoints are active before breaking.
(WebCore::InspectorDOMDebuggerAgent::clear): Deleted.
Replaced by call to discardBindings.
* inspector/InspectorDOMDebuggerAgent.h:

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
DOMDebugger agent needs to discard bindings when the main frame navigates.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New UI strings.

* UserInterface/Base/Main.js:
(WebInspector.loaded):
Add new manager.

* UserInterface/Controllers/DOMBreakpointTreeController.js: Added.
Handles messages from DOMDebuggerManager, and updates an associated
tree outline as DOM breakpoints are added and removed.
(WebInspector.DOMBreakpointTreeController):
(WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems):
(WebInspector.DOMBreakpointTreeController.prototype.disconnect):
(WebInspector.DOMBreakpointTreeController.prototype._addBreakpointTreeElement):
(WebInspector.DOMBreakpointTreeController.prototype._removeBreakpointTreeElement):
(WebInspector.DOMBreakpointTreeController.prototype._domBreakpointAdded):
(WebInspector.DOMBreakpointTreeController.prototype._domBreakpointRemoved):
(WebInspector.DOMBreakpointTreeController.prototype._domBreakpointResolvedStateDidChange):
(WebInspector.DOMBreakpointTreeController.prototype._mainResourceDidChange):

* UserInterface/Controllers/DOMDebuggerManager.js: Added.
New frontend manager for the DOMDebugger domain. A DOM breakpoint is
described by a location (URL and node path) and type. The manager keeps
all known DOM breakpoints in memory, and considers a breakpoint to be
"resolved" once its location is pushed to the frontend.

Breakpoints located within a child frame are still associated with the
main frame. Whenever a the main resource of a child frame changes, all
unresolved breakpoints associated with the main frame are speculatively
resolved.

(WebInspector.DOMDebuggerManager):
(WebInspector.DOMDebuggerManager.prototype.get supported):
(WebInspector.DOMDebuggerManager.prototype.get domBreakpoints):
(WebInspector.DOMDebuggerManager.prototype.domBreakpointsForNode):
(WebInspector.DOMDebuggerManager.prototype.addDOMBreakpoint):
(WebInspector.DOMDebuggerManager.prototype.removeDOMBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._detachDOMBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._detachBreakpointsForFrame):
(WebInspector.DOMDebuggerManager.prototype._speculativelyResolveBreakpoints):
(WebInspector.DOMDebuggerManager.prototype._resolveDOMBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._updateDOMBreakpoint):
(WebInspector.DOMDebuggerManager.prototype._saveBreakpoints):
(WebInspector.DOMDebuggerManager.prototype._domBreakpointDisabledStateDidChange):
(WebInspector.DOMDebuggerManager.prototype._childFrameWasRemoved):
(WebInspector.DOMDebuggerManager.prototype._mainFrameDidChange):
(WebInspector.DOMDebuggerManager.prototype._mainResourceDidChange):
(WebInspector.DOMDebuggerManager.prototype._nodeInserted):
(WebInspector.DOMDebuggerManager.prototype._nodeRemoved):

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype._pauseReasonFromPayload):
Plumbing for DOM breakpoint pause reason.

* UserInterface/Images/DOMBreakpoint.svg: Added.
New art. Visually very similar to a script breakpoint, with some
tweaks to make it suitable for display in the DOM tree gutter.

* UserInterface/Main.html:
New files.

* UserInterface/Models/DOMBreakpoint.js: Added.
New model class. DOM breakpoints are either associated with a DOM node
when created, or constructed from a cookie and resolved in the future.

(WebInspector.DOMBreakpoint):
(WebInspector.DOMBreakpoint.prototype.get type):
(WebInspector.DOMBreakpoint.prototype.get url):
(WebInspector.DOMBreakpoint.prototype.get path):
(WebInspector.DOMBreakpoint.prototype.get disabled):
(WebInspector.DOMBreakpoint.prototype.set disabled):
(WebInspector.DOMBreakpoint.prototype.get domNodeIdentifier):
(WebInspector.DOMBreakpoint.prototype.set domNodeIdentifier):
(WebInspector.DOMBreakpoint.prototype.get serializableInfo):
(WebInspector.DOMBreakpoint.prototype.saveIdentityToCookie):

* 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:
The DOMDebugger should not be enabled for legacy backends, since legacy
backend support was never tested and may have issues.

* UserInterface/Test.html:
New files.

* UserInterface/Test/Test.js:
(WebInspector.loaded):
Add new manager.

* UserInterface/Views/ContentView.js:
(WebInspector.ContentView.createFromRepresentedObject):
(WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject):
Plumbing for additional represented object types. DOMNode is included
because the Debugger sidebar panel shows DOM breakpoint tree elements
as children of a DOM node tree element.

* UserInterface/Views/DOMBreakpointTreeElement.css: Added.
(.item.dom-breakpoint .icon):
(.item.dom-breakpoint.breakpoint-paused-icon .icon):
(.item.dom-breakpoint .status img):
(.item.dom-breakpoint .status > img.disabled):
Styles for "Pause Reason" and "DOM Breakpoints" sections.

* UserInterface/Views/DOMBreakpointTreeElement.js: Added.
Tree element class for DOM breakpoints. Includes a breakpoint status
element and context menu for delete/disable actions, similar to script
breakpoint tree elements.

(WebInspector.DOMBreakpointTreeElement):
(WebInspector.DOMBreakpointTreeElement.displayNameForType):
(WebInspector.DOMBreakpointTreeElement.prototype.onattach):
(WebInspector.DOMBreakpointTreeElement.prototype.ondetach):
(WebInspector.DOMBreakpointTreeElement.prototype.ondelete):
(WebInspector.DOMBreakpointTreeElement.prototype.onenter):
(WebInspector.DOMBreakpointTreeElement.prototype.onspace):
(WebInspector.DOMBreakpointTreeElement.prototype.populateContextMenu):
(WebInspector.DOMBreakpointTreeElement.prototype._statusImageElementClicked):
(WebInspector.DOMBreakpointTreeElement.prototype._statusImageElementFocused):
(WebInspector.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown):
(WebInspector.DOMBreakpointTreeElement.prototype._toggleBreakpoint):
(WebInspector.DOMBreakpointTreeElement.prototype._updateStatus):

* UserInterface/Views/DOMNodeTreeElement.js: Added.
Tree element class for DOM nodes, which serves as a parent for DOM
breakpoint tree elements. Includes context menu for bulk delete/disable
of all child breakpoints.

(WebInspector.DOMNodeTreeElement):
(WebInspector.DOMNodeTreeElement.prototype.ondelete):
(WebInspector.DOMNodeTreeElement.prototype.populateContextMenu):

* UserInterface/Views/DOMTreeContentView.css:
Styles for DOM breakpoint gutter and breakpoint indicators, including
"left pointing" breakpoints for RTL mode.

(.content-view.dom-tree.show-gutter .tree-outline.dom):
(body[dir=ltr] .content-view.dom-tree.show-gutter .tree-outline.dom):
(body[dir=rtl] .content-view.dom-tree.show-gutter .tree-outline.dom):
(.content-view.dom-tree .tree-outline.dom li .status-image):
(body[dir=ltr] .content-view.dom-tree .tree-outline.dom li .status-image):
(body[dir=rtl] .content-view.dom-tree .tree-outline.dom li .status-image):
(.content-view.dom-tree .tree-outline.dom li .status-image.breakpoint):
(body:not(.window-inactive) .content-view.dom-tree .tree-outline.dom:focus li.selected .status-image.breakpoint):
(.content-view.dom-tree .tree-outline.dom li .status-image.breakpoint.disabled):
(.content-view.dom-tree .tree-outline.dom.breakpoints-disabled li .status-image.breakpoint):
(.content-view.dom-tree .tree-outline.dom.breakpoints-disabled li .status-image.breakpoint.disabled):

* UserInterface/Views/DOMTreeContentView.js:
Add support for DOM breakpoint gutter and breakpoint indicators.
Breakpoint indicator elements are part of the DOM tree element, and are
updated whenever there a breakpoint's disabled or resolved state changes.

(WebInspector.DOMTreeContentView):
(WebInspector.DOMTreeContentView.prototype.get breakpointGutterEnabled):
(WebInspector.DOMTreeContentView.prototype.set breakpointGutterEnabled):
(WebInspector.DOMTreeContentView.prototype.shown):
(WebInspector.DOMTreeContentView.prototype.closed):
(WebInspector.DOMTreeContentView.prototype._domTreeElementAdded):
(WebInspector.DOMTreeContentView.prototype._domBreakpointAddedOrRemoved):
(WebInspector.DOMTreeContentView.prototype._domBreakpointDisabledStateDidChange):
(WebInspector.DOMTreeContentView.prototype._domBreakpointResolvedStateDidChange):
(WebInspector.DOMTreeContentView.prototype._updateBreakpointStatus):
(WebInspector.DOMTreeContentView.prototype._restoreBreakpointsAfterUpdate):
(WebInspector.DOMTreeContentView.prototype._breakpointsEnabledDidChange):

* UserInterface/Views/DOMTreeElement.js:
Add support for breakpoint status element and content menu.
(WebInspector.DOMTreeElement):
(WebInspector.DOMTreeElement.prototype.get breakpointStatus):
(WebInspector.DOMTreeElement.prototype.set breakpointStatus):
(WebInspector.DOMTreeElement.prototype._populateNodeContextMenu):
(WebInspector.DOMTreeElement.prototype.updateTitle):
(WebInspector.DOMTreeElement.prototype._updateBreakpointStatus):
(WebInspector.DOMTreeElement.prototype._statusImageContextmenu):

* UserInterface/Views/DebuggerSidebarPanel.css:
(.sidebar > .panel.navigation.debugger .details-section.dom-breakpoints .item.dom-node .titles):
(.sidebar > .panel.navigation.debugger .details-section.dom-breakpoints .item.dom-node .icon):
Styles for DOM node tree elements.

* UserInterface/Views/DebuggerSidebarPanel.js:
Add new DOM Breakpoints section, and support for the "DOM" pause reason.

(WebInspector.DebuggerSidebarPanel):
(WebInspector.DebuggerSidebarPanel.prototype.closed):
(WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonSection):
(WebInspector.DebuggerSidebarPanel.prototype._domBreakpointAddedOrRemoved):

* UserInterface/Views/FrameDOMTreeContentView.js:
(WebInspector.FrameDOMTreeContentView.prototype._rootDOMNodeAvailable):
Restore DOM breakpoints once the root node is available.

* UserInterface/Views/Variables.css:
(:root):
Fill and stroke colors for resolved, unresolved, and disabled breakpoints.

* 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:

LayoutTests:

Tests for pausing on supported DOM breakpoint types, and DOMDebuggerManager
events triggered by added/removed DOM nodes that have breakpoints.

* inspector/dom-debugger/dom-breakpoints-expected.txt: Added.
* inspector/dom-debugger/dom-breakpoints.html: Added.

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

5 years agoimport-w3c-tests doesn't work with svn repositories.
commit-queue@webkit.org [Thu, 9 Mar 2017 04:23:48 +0000 (04:23 +0000)]
import-w3c-tests doesn't work with svn repositories.
https://bugs.webkit.org/show_bug.cgi?id=169190

Patch by Sam Weinig <sam@webkit.org> on 2017-03-08
Reviewed by Tim Horton.

The script assumed you had WebKit checked-out as a git repository, but
there was no reason for that.

* Scripts/webkitpy/common/checkout/scm/git.py:
(Git.clone):
Add a class method to clone a repository which does not require
an existing checkout.

(Git.fetch):
(Git.checkout):
Add methods needed for test_downloader.py, so it doesn't have to use
the internal _run_git

* Scripts/webkitpy/w3c/test_downloader.py:
(TestDownloader.checkout_test_repository):
Switch to using Git.clone(), which doesn't require an existing git
directory, and then also adopt non private methods to fetch/checkout.

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

5 years ago[WebCrypto] Implement ECDH DeriveBits operation
jiewen_tan@apple.com [Thu, 9 Mar 2017 04:04:29 +0000 (04:04 +0000)]
[WebCrypto] Implement ECDH DeriveBits operation
https://bugs.webkit.org/show_bug.cgi?id=169319
<rdar://problem/23789585>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch implements DeriveBits operation of ECDH according to the spec:
https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations.

Tests: crypto/subtle/derive-bits-malformed-parameters.html
       crypto/subtle/ecdh-derive-bits-malformed-parametrs.html
       crypto/subtle/ecdh-generate-key-derive-bits.html
       crypto/subtle/ecdh-import-key-derive-bits-custom-length.html
       crypto/subtle/ecdh-import-key-derive-bits-null-length.html
       crypto/workers/subtle/ecdh-import-key-derive-bits.html

* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionDeriveKeyPromise):
(WebCore::jsSubtleCryptoFunctionDeriveBitsPromise):
(WebCore::JSSubtleCrypto::generateKey):
Reorder a bit of the functions.
* crypto/CommonCryptoUtilities.h:
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::deriveBits):
* crypto/CryptoAlgorithm.h:
* crypto/CryptoAlgorithmParameters.h:
* crypto/algorithms/CryptoAlgorithmECDH.cpp:
(WebCore::CryptoAlgorithmECDH::deriveBits):
* crypto/algorithms/CryptoAlgorithmECDH.h:
* crypto/gnutls/CryptoAlgorithmECDHGnuTLS.cpp: Added.
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/keys/CryptoKeyEC.h:
* crypto/mac/CryptoAlgorithmECDHMac.cpp: Added.
(WebCore::CryptoAlgorithmECDH::platformDeriveBits):
* crypto/parameters/CryptoAlgorithmEcdhKeyDeriveParams.h: Added.
* crypto/parameters/EcdhKeyDeriveParams.idl: Added.

LayoutTests:

* TestExpectations:
Refine some comments.
* crypto/subtle/derive-bits-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/deriveBits-malformed-parameters-expected.txt.
* crypto/subtle/derive-bits-malformed-parameters.html: Added.
* crypto/subtle/deriveBits-malformed-parameters.html: Removed.
* crypto/subtle/ecdh-derive-bits-malformed-parametrs-expected.txt: Added.
* crypto/subtle/ecdh-derive-bits-malformed-parametrs.html: Added.
* crypto/subtle/ecdh-generate-key-derive-bits-expected.txt: Added.
* crypto/subtle/ecdh-generate-key-derive-bits.html: Added.
* crypto/subtle/ecdh-import-key-derive-bits-custom-length-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-bits-custom-length.html: Added.
* crypto/subtle/ecdh-import-key-derive-bits-null-length-expected.txt: Added.
* crypto/subtle/ecdh-import-key-derive-bits-null-length.html: Added.
* crypto/workers/subtle/ecdh-import-key-derive-bits-expected.txt: Added.
* crypto/workers/subtle/ecdh-import-key-derive-bits.html: Added.
* crypto/workers/subtle/resources/ecdh-import-key-derive-bits.js: Added.

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

5 years agoResource Load Statistics: Communicate to the network process which domains to partition
wilander@apple.com [Thu, 9 Mar 2017 04:02:14 +0000 (04:02 +0000)]
Resource Load Statistics: Communicate to the network process which domains to partition
https://bugs.webkit.org/show_bug.cgi?id=169322
<rdar://problem/30768921>

Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
    Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
    to tell the network process the domain has got user interaction.
(WebCore::ResourceLoadObserver::logUserInteraction):
    Now calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler()
    to tell the network process the domain has got user interaction.
(WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
    To allow TestRunner to set a domain for which
    partitioning should be applied.
(WebCore::ResourceLoadObserver::primaryDomain):
    New overloaded convenience function.
* loader/ResourceLoadObserver.h:
* loader/ResourceLoadStatisticsStore.cpp:
(WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
    Now bootstraps the network process' set of known domains to
    partition cookies for.
(WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
(WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
(WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
    Now tells the network process to start partitioning again
    when user interaction ages out.
* loader/ResourceLoadStatisticsStore.h:
* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::shouldPartitionCookiesForHost):
(WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):

Source/WebKit2:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
    Now consults WebCore::NetworkStorageSession::shouldPartitionCookiesForHost()
    to decide whether partitioning should be applied or not.
* UIProcess/API/C/WKCookieManager.cpp:
(WKCookieManagerSetCookieStoragePartitioningEnabled):
    To allow TestRunner to configure cookie partitioning.
* UIProcess/API/C/WKCookieManager.h:
* UIProcess/API/C/WKResourceLoadStatisticsManager.cpp:
(WKResourceLoadStatisticsManagerFireShouldPartitionCookiesHandler):
    To allow TestRunner to set a domain for which
    partitioning should be applied.
* UIProcess/API/C/WKResourceLoadStatisticsManager.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::setCookieStoragePartitioningEnabled):
    To allow TestRunner to configure cookie partitioning.
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebResourceLoadStatisticsManager.cpp:
(WebKit::WebResourceLoadStatisticsManager::fireShouldPartitionCookiesHandler):
    To allow TestRunner to set a domain for which
    partitioning should be applied.
* UIProcess/WebResourceLoadStatisticsManager.h:
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::classifyResource):
    Now tells the network process as soon as a domain
    has been classified as prevalent.
(WebKit::WebResourceLoadStatisticsStore::registerSharedResourceLoadObserver):
    Overloaded function to allow injection of handlers for communication with the
    network process.
* UIProcess/WebResourceLoadStatisticsStore.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::shouldPartitionCookiesForTopPrivatelyOwnedDomains):
(WebKit::WebsiteDataStore::registerSharedResourceLoadObserver):
    Now sets two callback handlers for communication with the network process.
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

These changes add support for two new TestRunner functions:
- setCookieStoragePartitioningEnabled()
- statisticsFireShouldPartitionCookiesHandler()

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setCookieStoragePartitioningEnabled):
(WTR::TestRunner::statisticsFireShouldPartitionCookiesHandler):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::statisticsFireShouldPartitionCookiesHandler):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction-expected.txt: Added.
* http/tests/loading/resourceLoadStatistics/partitioned-cookies-with-and-without-user-interaction.html: Added.
* http/tests/loading/resourceLoadStatistics/resources: Added.
* http/tests/loading/resourceLoadStatistics/resources/get-cookies.php: Added.
* http/tests/loading/resourceLoadStatistics/resources/set-cookie.php: Added.

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

5 years agoWeb Inspector: RTL: table header columns and cells don't line up, dragging seems...
commit-queue@webkit.org [Thu, 9 Mar 2017 03:44:17 +0000 (03:44 +0000)]
Web Inspector: RTL: table header columns and cells don't line up, dragging seems backwards
https://bugs.webkit.org/show_bug.cgi?id=168289

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-03-08
Reviewed by Brian Burg.

Changed the algorithm used to position columns when in RTL to use right offsets instead of
left offsets.  This also applies to the resizer elements between columns.

* UserInterface/Views/DataGrid.css:
(.data-grid):
(.data-grid th):
(body[dir=ltr] .data-grid :matches(th, td):not(:last-child)):
(body[dir=rtl] .data-grid :matches(th, td):not(:last-child)):
(.data-grid th:matches(.sort-ascending, .sort-descending)):
(body[dir=ltr] .data-grid:matches(:focus, .force-focus) tr.selected td:not(:last-child)):
(body[dir=rtl] .data-grid:matches(:focus, .force-focus) tr.selected td:not(:last-child)):
(.data-grid .right div):
(body[dir=ltr] .data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child):
(body[dir=rtl] .data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child):
(.data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child::after):
(body[dir=ltr] .data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child::after):
(body[dir=rtl] .data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child::after):
(.data-grid th.sort-ascending > div:first-child::after):
(.data-grid th.sort-descending > div:first-child::after):
(.data-grid tr.parent td.disclosure::before):
(body[dir=ltr] .data-grid tr.parent td.disclosure::before):
(body[dir=rtl] .data-grid tr.parent td.disclosure::before):
(.data-grid td .icon):
(body[dir=ltr] .data-grid td .icon):
(body[dir=rtl] .data-grid td .icon):
(.data-grid td .go-to-arrow):
(body[dir=ltr] .data-grid td .go-to-arrow):
(body[dir=rtl] .data-grid td .go-to-arrow):
(.data-grid .resizer):
(body[dir=ltr] .data-grid .resizer):
(body[dir=rtl] .data-grid .resizer):
(.data-grid table:matches(.header, .data)):
(body[dir=ltr] .data-grid table:matches(.header, .data)):
(body[dir=rtl] .data-grid table:matches(.header, .data)):
(body[dir=ltr] .data-grid :matches(th, td):first-child):
(body[dir=rtl] .data-grid :matches(th, td):first-child):
(@media (-webkit-min-device-pixel-ratio: 2)):
(.data-grid :matches(th, td):not(:last-child)): Deleted.
(.data-grid:matches(:focus, .force-focus) tr.selected td:not(:last-child)): Deleted.
(.data-grid th:matches(.sort-ascending, .sort-descending) > div:first-child): Deleted.
(.data-grid table.header, .data-grid table.data): Deleted.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype._positionResizerElements):
(WebInspector.DataGrid.prototype._positionHeaderViews):
(WebInspector.DataGrid.prototype.resizerDragging):

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

5 years agoWeb Inspector: Should be able to see where Resources came from (Memory Cache, Disk...
joepeck@webkit.org [Thu, 9 Mar 2017 03:35:13 +0000 (03:35 +0000)]
Web Inspector: Should be able to see where Resources came from (Memory Cache, Disk Cache)
https://bugs.webkit.org/show_bug.cgi?id=164892
<rdar://problem/29320562>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Replace "fromDiskCache" property with "source" property which includes
more complete information about the source of this response (network,
memory cache, disk cache, or unknown).

* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(_generate_class_for_object_declaration):
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator._generate_open_field_names):
* inspector/scripts/codegen/generator.py:
(Generator):
(Generator.open_fields):
To avoid conflicts between the Inspector::Protocol::Network::Response::Source
enum and open accessor string symbol that would have the same name, only generate
a specific list of open accessor strings. This reduces the list of exported
symbols from all properties to just the ones that are needed. This can be
cleaned up later if needed.

* inspector/scripts/tests/generic/expected/type-with-open-parameters.json-result: Added.
* inspector/scripts/tests/generic/type-with-open-parameters.json: Added.
Test for open accessors generation.

Source/WebCore:

Test: http/tests/inspector/network/resource-response-source-disk-cache.html
      http/tests/inspector/network/resource-response-source-memory-cache.html
      http/tests/inspector/network/resource-response-source-network.html

* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::setSource): Deleted.
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::setSource):
Make Source mutable to allow it to be set in const methods.

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::didReceiveResponse):
Set the Response source after a successful memory cache validation
as early as possible so that future copies have up to date info.

* inspector/InspectorNetworkAgent.cpp:
(WebCore::responseSource):
(WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
(WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
(WebCore::InspectorNetworkAgent::markResourceAsCached): Deleted.
Eliminate this "markResourceAsCached" path.
Update Response to include required source parameter instead of
optional fromDiskCache parameter.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::markResourceAsCachedImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::markResourceAsCached): Deleted.
* inspector/InspectorNetworkAgent.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadedResourceFromMemoryCache):
Eliminate this "markResourceAsCached" call because the later delegate
messages will include this information.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New localized strings for memory/disk cache information.

* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.markResourceRequestAsServedFromMemoryCache):
Make this legacy path more explicit.

(WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
Make this memory cache path more explicit.

(WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
Pass the resource's response source onward.

* UserInterface/Models/Resource.js:
(WebInspector.Resource):
(WebInspector.Resource.responseSourceFromPayload):
(WebInspector.Resource.prototype.get responseSource):
(WebInspector.Resource.prototype.hasResponse):
(WebInspector.Resource.prototype.updateForResponse):
(WebInspector.Resource.prototype.markAsCached):
(WebInspector.Resource.prototype.legacyMarkServedFromMemoryCache):
(WebInspector.Resource.prototype.legacyMarkServedFromDiskCache):
Include a WebInspector.ResponseSource enum.
Update a Resource's responseSource state where appropriate.

* UserInterface/Protocol/NetworkObserver.js:
(WebInspector.NetworkObserver.prototype.requestServedFromCache):
Mark legacy path.

* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView):
Tweak default column sizes to make Cached and graph columns a little larger.

* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype.createCellContent):
(WebInspector.ResourceTimelineDataGridNode.prototype._cachedCellContent):
Update "Cached" column data with more information if available.

* UserInterface/Views/NetworkGridContentView.css:
(.content-view.network-grid > .data-grid .cache-type):
(.content-view.network-grid > .data-grid:matches(:focus, .force-focus) tr.selected .cache-type):
Style the cache type a secondary color.

LayoutTests:

* http/tests/inspector/network/resource-response-source-disk-cache-expected.txt: Added.
* http/tests/inspector/network/resource-response-source-disk-cache.html: Added.
* http/tests/inspector/network/resource-response-source-memory-cache-expected.txt: Added.
* http/tests/inspector/network/resource-response-source-memory-cache.html: Added.
* http/tests/inspector/network/resource-response-source-network-expected.txt: Added.
* http/tests/inspector/network/resource-response-source-network.html: Added.
* http/tests/inspector/network/resources/cached-script.js: Added.
Test for Network, MemoryCache, and DiskCache loads.

* http/tests/inspector/network/resource-timing-expected.txt:
* http/tests/inspector/network/resource-timing.html:
Fix a typo.

* http/tests/cache/disk-cache/resources/cache-test.js:
(loadResourcesWithOptions):
(loadResources):
Fix typos and style.

* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:
Skip disk cache tests where the disk cache is not enabled.

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

5 years agoFix -Wattributes warning spam
mcatanzaro@igalia.com [Thu, 9 Mar 2017 02:40:54 +0000 (02:40 +0000)]
Fix -Wattributes warning spam
https://bugs.webkit.org/show_bug.cgi?id=169243

Reviewed by Alexey Proskuryakov.

* Shared/API/c/WKDeclarationSpecifiers.h: Add WK_UNAVAILABLE macro.
* UIProcess/API/C/WKPageGroup.h: Use it.

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

5 years agoDrop support for non-standard document.all.tags()
cdumez@apple.com [Thu, 9 Mar 2017 02:37:42 +0000 (02:37 +0000)]
Drop support for non-standard document.all.tags()
https://bugs.webkit.org/show_bug.cgi?id=169337

Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Rebaseline web platform test now that one more check is passing.

* web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection-expected.txt:

Source/WebCore:

Drop support for non-standard document.all.tags(). It is not part of the specification:
- https://html.spec.whatwg.org/multipage/infrastructure.html#the-htmlallcollection-interface

It is not supported by Firefox and its support was dropped from Chrome back in early 2014:
- https://src.chromium.org/viewvc/blink?view=revision&revision=166870

No new tests, updated existing test.

* html/HTMLAllCollection.cpp:
* html/HTMLAllCollection.h:
* html/HTMLAllCollection.idl:

LayoutTests:

Update existing test to check that document.all.tags does not exist.

* fast/dom/document-all-tags-expected.txt:
* fast/dom/document-all-tags.html:

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

5 years agoEnable async image decoding for large images
commit-queue@webkit.org [Thu, 9 Mar 2017 02:16:51 +0000 (02:16 +0000)]
Enable async image decoding for large images
https://bugs.webkit.org/show_bug.cgi?id=165039

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

Source/WebCore:

Once FrameView finishes flushing compositing, it will request all its
images, which intersect with the tileCoverageRect (aka the futureRect)
of the  TileController, to start asynchronously decoding their image frames.
This should improve the image first time paint and the scrolling scenarios.
It also makes the scrolling more responsive by removing the decoding step
from the main thread.

For now we are going to disable the asynchronous image decoding for the
webkit test runner because drawing the image does not block the page rendering
anymore. An image can be repainted later when its frame is ready for painting.
This can cause a test to fail because the webkit test runner may capture
an image for the page before painting all the images. The asynchronous image
decoding can to be explicitly enabled from the test page. Once the specs
of the image 'async' attribute and 'ready' event is approved, this should
be revisited. It is important to test what we ship and eventually async
image decoding should be enabled in the webkit test runner.

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::didAttachRenderers):
(WebCore::HTMLImageElement::willDetachRenderers):
Register/unregister the renderer of the HTMLImageElement for async image decoding
from the RenderView. I followed what HTMLMediaElement to registerForVisibleInViewportCallback().
* html/HTMLImageElement.h:

* page/FrameView.cpp:
(WebCore::FrameView::flushCompositingStateForThisFrame): For all the images inside
the  tileCoverageRect of the TileController, request async image decoding.
(WebCore::FrameView::applyRecursivelyWithAbsoluteRect): Request the async image decoding for the
the images inside this FrameView and then recursively do the same thing for all sub FrameViews.
(WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRect): Calls the RenderView to
make the request.
(WebCore::FrameView::requestAsyncDecodingForImagesInAbsoluteRectIncludingSubframes): Calls
applyRecursivelyWithAbsoluteRect giving an apply lambda which calls requestAsyncDecodingForImagesInAbsoluteRect.
* page/FrameView.h:

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyDecodedData): ImageSource::hasDecodingQueue() is renamed to ImageSource::hasAsyncDecodingQueue().
(WebCore::BitmapImage::dataChanged): Use String::utf8().data() instead of String::characters8().
(WebCore::BitmapImage::draw): If drawing the current frame is called while it is being
decoded, draw the the image if the current frame was decoded but for a different size
and and will not invoke decoding while painting. If the frame is being decoded and there
isn't a decoded frame, return without drawing but set a flag that that this image needs
a repaint.
(WebCore::BitmapImage::internalStartAnimation): Use String::utf8().data() instead of String::characters8().
(WebCore::BitmapImage::advanceAnimation): Ditto.
(WebCore::BitmapImage::internalAdvanceAnimation): Ditto.
(WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): Now this callback can be
called form the ImageFrameCache when finishing a frame of an animated image or the
frame of a large image. For large images, we need to call CachedImage::changedInRect()
if this image needs a repaint. If the decoding queue is idle, we should close it.
(WebCore::BitmapImage::requestAsyncDecoding): This is called form
RenderView::requestAsyncDecodingForImagesInRect().
* platform/graphics/BitmapImage.h:

* platform/graphics/Image.h:
(WebCore::Image::requestAsyncDecoding): Add the default implementation of a virtual function.

* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::~ImageFrameCache): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
(WebCore::ImageFrameCache::decodingQueue): Change the QNS of the decoding thread to be WorkQueue::QOS::Default.
WorkQueue::QOS::UserInteractive causes the scrolling thread to preempted  which can make the scrolling choppy.
(WebCore::ImageFrameCache::startAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
(WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Ditto.
(WebCore::ImageFrameCache::isAsyncDecodingQueueIdle): A helper function to tell whether the decoding thread is idle.
(WebCore::ImageFrameCache::stopAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
* platform/graphics/ImageFrameCache.h:
(WebCore::ImageFrameCache::hasAsyncDecodingQueue): Rename this function to be consistent with the rest of the functions.
(WebCore::ImageFrameCache::hasDecodingQueue): Deleted.

* platform/graphics/ImageSource.h:
(WebCore::ImageSource::hasAsyncDecodingQueue): hasDecodingQueue() was renamed to hasAsyncDecodingQueue().
(WebCore::ImageSource::isAsyncDecodingQueueIdle): A wrapper for ImageFrameCache::isAsyncDecodingQueueIdle().
(WebCore::ImageSource::hasDecodingQueue): Deleted.

* platform/graphics/TiledBacking.h: Fix a comment. tileGridExtent() is the only one that is used for testing.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::~RenderElement):
(WebCore::RenderElement::intersectsAbsoluteRect): Make this function does what shouldRepaintForImageAnimation()
was doing expect the check for document.activeDOMObjectsAreSuspended().
(WebCore::RenderElement::newImageAnimationFrameAvailable): Replace the call to
shouldRepaintForImageAnimation() by checking document().activeDOMObjectsAreSuspended() then a call to
RenderElement::intersectsAbsoluteRect().
(WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Ditto.
(WebCore::RenderElement::registerForAsyncImageDecodingCallback): Call the RenderView to register the renderer..
(WebCore::RenderElement::unregisterForAsyncImageDecodingCallback): Call the RenderView to unregister the renderer..
(WebCore::shouldRepaintForImageAnimation): Deleted.
* rendering/RenderElement.h:

* rendering/RenderObject.cpp:
(WebCore::RenderObject::setIsRegisteredForAsyncImageDecodingCallback):
* rendering/RenderObject.h:
(WebCore::RenderObject::isRegisteredForAsyncImageDecodingCallback):
(WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData):
Mark/unmark the renderer for being RegisteredForAsyncImageDecodingCallback.

* rendering/RenderReplaced.h: Make intrinsicSize() be a public function.

* rendering/RenderView.cpp:
(WebCore::RenderView::registerForAsyncImageDecodingCallback): Register a renderer for async image decoding.
(WebCore::RenderView::unregisterForAsyncImageDecodingCallback): Remove a renderer from the list of async image decoding.
(WebCore::RenderView::requestAsyncDecodingForImagesInAbsoluteRect):This loops through all the registered RenderImages
inside this RenderView and if any of them intersects with the rectangle, requestAsyncDecoding for it.
* rendering/RenderView.h:

Source/WebKit2:

Add WK2 preferences for setting/getting LargeImageAsyncDecoding and
AnimatedImageAsyncDecoding.

* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetLargeImageAsyncDecodingEnabled):
(WKPreferencesGetLargeImageAsyncDecodingEnabled):
(WKPreferencesSetAnimatedImageAsyncDecodingEnabled):
(WKPreferencesGetAnimatedImageAsyncDecodingEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Tools:

Disable LargeImageAsyncDecoding for DRT/WTR.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

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

5 years agoWeb Inspector: add a "create breakpoint" context menu item for linkified source locations
commit-queue@webkit.org [Thu, 9 Mar 2017 02:13:31 +0000 (02:13 +0000)]
Web Inspector: add a "create breakpoint" context menu item for linkified source locations
https://bugs.webkit.org/show_bug.cgi?id=47442

Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-03-08
Reviewed by Brian Burg.

* UserInterface/Base/Main.js:
(WebInspector.isShowingResourcesTab): Added.
(WebInspector.linkifyElement):
Now calls WebInspector.appendContextMenuItemsForSourceCode on "contextmenu" events for the
created element.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.breakpointForSourceCodeLocation):
Returns the first breakpoint (since there should only be one) that matches the given location.

* UserInterface/Views/ContextMenuUtilities.js:
(WebInspector.appendContextMenuItemsForSourceCode):
Rework parameters to also accept a WebInspector.SourceCodeLocation, thereby allowing the
setting of breakpoints so long as the associated WebInspector.SourceCode is a script.

* UserInterface/Views/Main.css:
(.resource-link, .go-to-link):
Prevent link from being selected.

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

5 years agoFix missing return value after r213499
mcatanzaro@igalia.com [Thu, 9 Mar 2017 02:06:24 +0000 (02:06 +0000)]
Fix missing return value after r213499
https://bugs.webkit.org/show_bug.cgi?id=168198

Reviewed by Myles C. Maxfield.

* platform/text/CharacterProperties.h:
(WebCore::isEmojiGroupCandidate):

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