WebKit-https.git
3 years agobmalloc: Renamed LargeChunk => Chunk
ggaren@apple.com [Fri, 25 Mar 2016 18:32:11 +0000 (18:32 +0000)]
bmalloc: Renamed LargeChunk => Chunk
https://bugs.webkit.org/show_bug.cgi?id=155894

Reviewed by Michael Saboff.

A Chunk can contain both small and large objects now.

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::allocate):
* bmalloc/BoundaryTag.h:
(bmalloc::BoundaryTag::isFree):
* bmalloc/Chunk.h: Copied from Source/bmalloc/bmalloc/LargeChunk.h.
(bmalloc::Chunk::pages):
(bmalloc::Chunk::begin):
(bmalloc::Chunk::end):
(bmalloc::Chunk::Chunk):
(bmalloc::Chunk::get):
(bmalloc::Chunk::beginTag):
(bmalloc::Chunk::endTag):
(bmalloc::Chunk::offset):
(bmalloc::Chunk::object):
(bmalloc::Chunk::page):
(bmalloc::Chunk::line):
(bmalloc::SmallLine::begin):
(bmalloc::SmallPage::begin):
(bmalloc::SmallPage::end):
(bmalloc::Object::Object):
(bmalloc::Object::begin):
(bmalloc::LargeChunk::pages): Deleted.
(bmalloc::LargeChunk::begin): Deleted.
(bmalloc::LargeChunk::end): Deleted.
(bmalloc::LargeChunk::LargeChunk): Deleted.
(bmalloc::LargeChunk::get): Deleted.
(bmalloc::LargeChunk::beginTag): Deleted.
(bmalloc::LargeChunk::endTag): Deleted.
(bmalloc::LargeChunk::offset): Deleted.
(bmalloc::LargeChunk::object): Deleted.
(bmalloc::LargeChunk::page): Deleted.
(bmalloc::LargeChunk::line): Deleted.
* bmalloc/Deallocator.cpp:
* bmalloc/FreeList.cpp:
* bmalloc/Heap.cpp:
(bmalloc::Heap::allocateLarge):
* bmalloc/LargeChunk.h: Removed.
* bmalloc/LargeObject.h:
(bmalloc::LargeObject::LargeObject):
(bmalloc::LargeObject::merge):
(bmalloc::LargeObject::split):
* bmalloc/Object.h:
(bmalloc::Object::chunk):
* bmalloc/ObjectType.cpp:
* bmalloc/Sizes.h:
* bmalloc/SmallAllocator.h: Removed.
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::VMHeap):
(bmalloc::VMHeap::allocateChunk):
(bmalloc::VMHeap::allocateLargeChunk): Deleted.
* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateLargeObject):
(bmalloc::VMHeap::deallocateLargeObject):
* bmalloc/Zone.cpp:
(bmalloc::enumerator):
* bmalloc/Zone.h:
(bmalloc::Zone::chunks):
(bmalloc::Zone::addChunk):
(bmalloc::Zone::largeChunks): Deleted.
(bmalloc::Zone::addLargeChunk): Deleted.

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

3 years agoWeb Inspector: protocol generator should prefix C++ filenames with the protocol group
bburg@apple.com [Fri, 25 Mar 2016 18:18:50 +0000 (18:18 +0000)]
Web Inspector: protocol generator should prefix C++ filenames with the protocol group
https://bugs.webkit.org/show_bug.cgi?id=155859
<rdar://problem/25349859>

Reviewed by Alex Christensen and Joseph Pecoraro.

Source/JavaScriptCore:

Like for generated Objective-C files, we should use the 'protocol group' name
as the prefix for generated C++ files so that headers from different protocol
groups have unambiguous names.

* inspector/scripts/codegen/cpp_generator.py:
(CppGenerator):
(CppGenerator.__init__):
(CppGenerator.protocol_name):
Make all C++ code generators extend the CppGenerator python class and use the
protocol_name() instance method. This matches a recent change to the ObjC generator.

* inspector/scripts/codegen/cpp_generator_templates.py:
(CppGeneratorTemplates):
Drive-by cleanup to use #pragma once instead of header guards.

* inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py:
(CppAlternateBackendDispatcherHeaderGenerator):
(CppAlternateBackendDispatcherHeaderGenerator.__init__):
(CppAlternateBackendDispatcherHeaderGenerator.output_filename):
(CppAlternateBackendDispatcherHeaderGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py:
(CppBackendDispatcherHeaderGenerator):
(CppBackendDispatcherHeaderGenerator.__init__):
(CppBackendDispatcherHeaderGenerator.output_filename):
(CppBackendDispatcherHeaderGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
(CppBackendDispatcherImplementationGenerator):
(CppBackendDispatcherImplementationGenerator.__init__):
(CppBackendDispatcherImplementationGenerator.output_filename):
(CppBackendDispatcherImplementationGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py:
(CppFrontendDispatcherHeaderGenerator):
(CppFrontendDispatcherHeaderGenerator.__init__):
(CppFrontendDispatcherHeaderGenerator.output_filename):
(CppFrontendDispatcherHeaderGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
(CppFrontendDispatcherImplementationGenerator):
(CppFrontendDispatcherImplementationGenerator.__init__):
(CppFrontendDispatcherImplementationGenerator.output_filename):
(CppFrontendDispatcherImplementationGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
(CppProtocolTypesHeaderGenerator):
(CppProtocolTypesHeaderGenerator.__init__):
(CppProtocolTypesHeaderGenerator.output_filename):
(CppProtocolTypesHeaderGenerator.generate_output):
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
(CppProtocolTypesImplementationGenerator):
(CppProtocolTypesImplementationGenerator.__init__):
(CppProtocolTypesImplementationGenerator.output_filename):
(CppProtocolTypesImplementationGenerator.generate_output):
Use the protocol_name() instance method to compute generated protocol file names.

* inspector/scripts/codegen/models.py:
Explicitly set the 'protocol_group' for the Inspector protocol.

Rebaseline generator test results.

* inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/expected/enum-values.json-result:
* inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
* inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
* inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
* inspector/scripts/tests/expected/type-declaration-array-type.json-result:
* inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
* inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:

Source/WebKit2:

Adjust header include and build system paths.

* CMakeLists.txt:
Revert the workaround introduced in r198659 since this change fixes the
underlying issue.

* DerivedSources.make:
* UIProcess/Automation/WebAutomationSession.cpp:
* UIProcess/Automation/WebAutomationSession.h:
* WebKit2.xcodeproj/project.pbxproj:

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

3 years agoRevert most of r198673.
achristensen@apple.com [Fri, 25 Mar 2016 18:14:14 +0000 (18:14 +0000)]
Revert most of r198673.

* platform/graphics/MediaPlayer.cpp:
(WebCore::buildMediaEnginesVector):
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
* platform/graphics/mac/MediaTimeQTKit.h:
* platform/graphics/mac/MediaTimeQTKit.mm:
* platform/mac/WebVideoFullscreenController.mm:

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

3 years agoputByIndexBeyondVectorLengthWithoutAttributes should not crash if it can't ensureLength
keith_miller@apple.com [Fri, 25 Mar 2016 18:07:35 +0000 (18:07 +0000)]
putByIndexBeyondVectorLengthWithoutAttributes should not crash if it can't ensureLength
https://bugs.webkit.org/show_bug.cgi?id=155730

Reviewed by Saam Barati.

This patch makes ensureLength return a boolean indicating if it was able to set the length.
ensureLength also no longer sets the butterfly to null if the allocation of the butterfly
fails. All of ensureLengths callers including putByIndexBeyondVectorLengthWithoutAttributes
have been adapted to throw an out of memory error if ensureLength fails.

* runtime/JSArray.cpp:
(JSC::JSArray::setLength):
(JSC::JSArray::unshiftCountWithAnyIndexingType):
* runtime/JSObject.cpp:
(JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes):
(JSC::JSObject::ensureLengthSlow):
* runtime/JSObject.h:
(JSC::JSObject::ensureLength):

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

3 years agobmalloc: small and large objects should share memory
ggaren@apple.com [Fri, 25 Mar 2016 18:07:31 +0000 (18:07 +0000)]
bmalloc: small and large objects should share memory
https://bugs.webkit.org/show_bug.cgi?id=155866

Reviewed by Andreas Kling.

This patch cuts our VM footprint in half. (VM footprint usually doesn't
matter, but on iOS there's an artificial VM limit around 700MB, and if
you hit it you jetsam / crash.)

It's also a step toward honoring the hardware page size at runtime,
which will reduce memory usage on iOS.

This patch is a small improvement in peak memory usage because it allows
small and large objects to recycle each other's memory. The tradeoff is
that we require more metadata, which causes more memory usage after
shrinking down from peak memory usage. In the end, we have some memory
wins and some losses, and a small win in the mean on our standard memory
benchmarks.

* bmalloc.xcodeproj/project.pbxproj: Removed SuperChunk.

* bmalloc/Allocator.cpp:
(bmalloc::Allocator::reallocate): Adopt a new Heap API for shrinking
large objects because it's a little more complicated than it used to be.

Don't check for equality in the XLarge case because we don't do it in
other cases, and it's unlikely that we'll be called for no reason.

* bmalloc/BumpAllocator.h:
(bmalloc::BumpAllocator::allocate): Don't ASSERT isSmall because that's
an old concept from when small and large objects were in distinct memory
regions.

* bmalloc/Deallocator.cpp:
(bmalloc::Deallocator::deallocateSlowCase): Large objects are not
segregated anymore.

(bmalloc::Deallocator::deallocateLarge): Deleted.

* bmalloc/Deallocator.h:
(bmalloc::Deallocator::deallocateFastCase): Don't ASSERT isSmall(). See
above.

* bmalloc/Heap.cpp:
(bmalloc::Heap::scavenge):
(bmalloc::Heap::scavengeSmallPage):
(bmalloc::Heap::scavengeSmallPages): New helpers for returning cached
small pages to the large object heap.

(bmalloc::Heap::allocateSmallPage): Allocate small pages from the large
object heap. This is how we accomplish sharing.

(bmalloc::Heap::deallocateSmallLine): Handle large objects since we can
encounter them on this code path now.

(bmalloc::Heap::splitAndAllocate): Fixed a bug where we would sometimes
not split even though we could.

Allocating a large object also requires ref'ing its small line so that
we can alias memory between small and large objects.

(bmalloc::Heap::allocateLarge): Return cached small pages before
allocating a large object that would fit in a cached small page. This
allows some large allocations to reuse small object memory.

(bmalloc::Heap::shrinkLarge): New helper.

(bmalloc::Heap::deallocateLarge): Deleted.

* bmalloc/Heap.h:

* bmalloc/LargeChunk.h:
(bmalloc::LargeChunk::pageBegin):
(bmalloc::LargeChunk::pageEnd):
(bmalloc::LargeChunk::lines):
(bmalloc::LargeChunk::pages):
(bmalloc::LargeChunk::begin):
(bmalloc::LargeChunk::end):
(bmalloc::LargeChunk::LargeChunk):
(bmalloc::LargeChunk::get):
(bmalloc::LargeChunk::endTag):
(bmalloc::LargeChunk::offset):
(bmalloc::LargeChunk::object):
(bmalloc::LargeChunk::page):
(bmalloc::LargeChunk::line):
(bmalloc::SmallLine::begin):
(bmalloc::SmallLine::end):
(bmalloc::SmallPage::begin):
(bmalloc::SmallPage::end):
(bmalloc::Object::Object):
(bmalloc::Object::begin):
(bmalloc::Object::pageBegin):
(bmalloc::Object::line):
(bmalloc::Object::page): I merged all the SmallChunk metadata and code
into LargeChunk. Now we use a single class to track both small and large
metadata, so we can share memory between small and large objects.

I'm going to rename this class to Chunk in a follow-up patch.

* bmalloc/Object.h:
(bmalloc::Object::chunk): Updated for LargeChunk transition.

* bmalloc/ObjectType.cpp:
(bmalloc::objectType):
* bmalloc/ObjectType.h:
(bmalloc::isXLarge):
(bmalloc::isSmall): Deleted. The difference between small and large
objects is now stored in metadata and is not a property of their
virtual address range.

* bmalloc/SegregatedFreeList.h: One more entry because we cover all of
what used to be the super chunk in a large chunk now.

* bmalloc/Sizes.h: Removed bit masking helpers because we don't use
address masks to distinguish small vs large object type anymore.

* bmalloc/SmallChunk.h: Removed.

* bmalloc/SmallPage.h:
(bmalloc::SmallPage::SmallPage): Store object type per page because any
given page can be used for large objects or small objects.

* bmalloc/SuperChunk.h: Removed.

* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::VMHeap):
(bmalloc::VMHeap::allocateLargeChunk):
(bmalloc::VMHeap::allocateSmallChunk): Deleted.
(bmalloc::VMHeap::allocateSuperChunk): Deleted.
* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateLargeObject):
(bmalloc::VMHeap::deallocateLargeObject):
(bmalloc::VMHeap::allocateSmallPage): Deleted.
(bmalloc::VMHeap::deallocateSmallPage): Deleted. Removed super chunk and
small chunk support.

* bmalloc/Zone.cpp:
(bmalloc::enumerator):
* bmalloc/Zone.h:
(bmalloc::Zone::largeChunks):
(bmalloc::Zone::addLargeChunk):
(bmalloc::Zone::superChunks): Deleted.
(bmalloc::Zone::addSuperChunk): Deleted. Removed super chunk and
small chunk support.

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

3 years ago[JSC] implement String.prototype.padStart() and String.prototype.padEnd() proposal
commit-queue@webkit.org [Fri, 25 Mar 2016 17:37:48 +0000 (17:37 +0000)]
[JSC] implement String.prototype.padStart() and String.prototype.padEnd() proposal
https://bugs.webkit.org/show_bug.cgi?id=155795

Patch by Caitlin Potter <caitp@igalia.com> on 2016-03-25
Reviewed by Darin Adler.

Source/JavaScriptCore:

Implements ECMAScript proposal http://tc39.github.io/proposal-string-pad-start-end/
Currently at Stage 3.

* runtime/JSString.h:
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::repeatCharacter):
(JSC::repeatStringPattern):
(JSC::padString):
(JSC::stringProtoFuncPadEnd):
(JSC::stringProtoFuncPadStart):
* tests/es6.yaml:
* tests/es6/String.prototype_methods_String.prototype.padEnd.js: Added.
* tests/es6/String.prototype_methods_String.prototype.padStart.js: Added.

LayoutTests:

* js/Object-getOwnPropertyNames-expected.txt:
* js/script-tests/Object-getOwnPropertyNames.js:

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

3 years agoAdd a compile time flag for using QTKit
achristensen@apple.com [Fri, 25 Mar 2016 17:24:33 +0000 (17:24 +0000)]
Add a compile time flag for using QTKit
https://bugs.webkit.org/show_bug.cgi?id=155868

Reviewed by Dan Bates.

Source/WebCore:

* platform/graphics/MediaPlayer.cpp:
(WebCore::buildMediaEnginesVector):
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
* platform/graphics/mac/MediaTimeQTKit.h:
* platform/graphics/mac/MediaTimeQTKit.mm:
* platform/mac/WebVideoFullscreenController.mm:

Source/WTF:

* wtf/Platform.h:

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

3 years agoRemove unused lambda capture after r196984.
achristensen@apple.com [Fri, 25 Mar 2016 17:12:08 +0000 (17:12 +0000)]
Remove unused lambda capture after r196984.

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
resourceResponse is not used in the lambda.

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

3 years agoFix Mac CMake build.
achristensen@apple.com [Fri, 25 Mar 2016 17:00:02 +0000 (17:00 +0000)]
Fix Mac CMake build.

* PlatformMac.cmake:

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

3 years agoDetect correct number of processors on windows
commit-queue@webkit.org [Fri, 25 Mar 2016 16:25:28 +0000 (16:25 +0000)]
Detect correct number of processors on windows
https://bugs.webkit.org/show_bug.cgi?id=155884

Patch by Bill Ming <mbbill@gmail.com> on 2016-03-25
Reviewed by Alex Christensen.

* Tools/Scripts/run-jsc-stress-tests:

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

3 years ago[Win] Improve CMake build performance
bfulgham@apple.com [Fri, 25 Mar 2016 16:14:20 +0000 (16:14 +0000)]
[Win] Improve CMake build performance
https://bugs.webkit.org/show_bug.cgi?id=155871
<rdar://problem/24747822>

Reviewed by Alex Christensen.

.:

Add a flag to the PROCESS_ALLINONE_FILE macro so that it does not remove
the files contained in the passed all-in-one file, since this breaks
dependency checking and generation of the derived sources from the IDL.
Instead, include the header files in the project so that all files get
generated.

* Source/cmake/WebKitMacros: Updated for 'DerivedSources.cpp' use case.

Source/WebCore:

Treat DerivedSources.cpp as an 'All-in-one' file. Pass a flag to the
PROCESS_ALLINONE_FILE macro so that it does not remove the contents of
the file, since this breaks dependency checking and generation of the
sources from the IDL files. Instead, include the header files in the
project so that all files get generated.

* CMakeLists.txt: Updated for 'DerivedSources.cpp'
* DerivedSources.cpp: Add some generated files that were missing.

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

3 years agoUse webkitdirs::determineXcodeSDK() instead of webkitdirs::willUseIOSDeviceSDK()
dbates@webkit.org [Fri, 25 Mar 2016 16:05:22 +0000 (16:05 +0000)]
Use webkitdirs::determineXcodeSDK() instead of webkitdirs::willUseIOSDeviceSDK()
in copy-webkitlibraries-to-product-directory
https://bugs.webkit.org/show_bug.cgi?id=155869

Reviewed by Alexey Proskuryakov.

It is sufficient and more direct to call webkitdirs::determineXcodeSDK() instead of
webkitdirs::willUseIOSDeviceSDK() to process the --sdk/--device/--ios-simulator command
line argument.

* Scripts/copy-webkitlibraries-to-product-directory:

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

3 years agoWeb Inspector: Scrolling/selection is broken in Quick Open dialog resource tree
mattbaker@apple.com [Fri, 25 Mar 2016 15:23:42 +0000 (15:23 +0000)]
Web Inspector: Scrolling/selection is broken in Quick Open dialog resource tree
https://bugs.webkit.org/show_bug.cgi?id=155877
<rdar://problem/25356149>

Reviewed by Timothy Hatcher.

Dialog and tree outline now use "display: flex", causing the height of the
tree outline to be based on the height of the dialog. Overflow scrolling
in the tree outline now has the expected behavior.

* UserInterface/Views/OpenResourceDialog.css:
(.open-resource-dialog):
(.open-resource-dialog > .tree-outline):

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

3 years agoTurned on ENABLE_REQUEST_ANIMATION_FRAME by default for any port.
commit-queue@webkit.org [Fri, 25 Mar 2016 14:47:49 +0000 (14:47 +0000)]
Turned on ENABLE_REQUEST_ANIMATION_FRAME by default for any port.
https://bugs.webkit.org/show_bug.cgi?id=155882

Patch by Konstantin Tokarev <annulen@yandex.ru> on 2016-03-25
Reviewed by Michael Catanzaro.

It was already enabled in all trunk ports, and is required for
WebInspectorUI to work.

.:

* Source/cmake/OptionsGTK.cmake: Removed duplication of default value.
* Source/cmake/OptionsMac.cmake: Ditto.
* Source/cmake/WebKitFeatures.cmake: Turned
ENABLE_REQUEST_ANIMATION_FRAME ON.

Tools:

* Scripts/webkitperl/FeatureList.pm:

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

3 years ago[Fetch API] Add basic loading of resources
youenn.fablet@crf.canon.fr [Fri, 25 Mar 2016 14:19:31 +0000 (14:19 +0000)]
[Fetch API] Add basic loading of resources
https://bugs.webkit.org/show_bug.cgi?id=155637

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebasing test expectations.
Updating scheme-blob.js to ensure generated test names are stable run after run.

* web-platform-tests/fetch/api/basic/accept-header-expected.txt:
* web-platform-tests/fetch/api/basic/integrity-expected.txt:
* web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt:
* web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-about-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob.js:
(checkFetchResponse): Deleted.
(checkKoUrl): Deleted.
* web-platform-tests/fetch/api/basic/scheme-data-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-others-expected.txt:
* web-platform-tests/fetch/api/basic/stream-response-expected.txt:

Source/WebCore:

Adding support for basic fetch for Window (no support for Worker yet).
A FetchResponse object is created for every fetch task.
But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved.

Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method.

Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise.

Tests: http/tests/fetch/closing-while-fetching.html
       http/tests/fetch/get-response-body-while-loading.html
Also covered by rebased tests.

* Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching.
(WebCore::DOMWindowFetch::fetch):
* Modules/fetch/DOMWindowFetch.h:
* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::consume):
(WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer.
(WebCore::FetchBody::consumeText): Passing the promise as a reference.
(WebCore::blobFromArrayBuffer): Helper routine.
(WebCore::FetchBody::fulfillTextPromise): Helper routine.
(WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer.
(WebCore::FetchBody::loadedAsText):
(WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request.
(WebCore::FetchBody::extractFromText):
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::loadingBody):
(WebCore::FetchBody::FetchBody):
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore
but will directly call failure callbacks.
(WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines.
(WebCore::FetchBodyOwner::finishBlobLoading):
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::body):
(WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer):
* Modules/fetch/FetchHeaders.cpp:
(WebCore::FetchHeaders::fill):
(WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered.
* Modules/fetch/FetchHeaders.h:
(WebCore::FetchHeaders::internalHeaders):
* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
(WebCore::FetchLoader::didFailRedirectCheck):
* Modules/fetch/FetchLoader.h:
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader.
       * Modules/fetch/FetchRequest.h:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request.
(WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback.
(WebCore::FetchResponse::BodyLoader::didFail): Ditto.
(WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto.
(WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto.
(WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto.
(WebCore::FetchResponse::BodyLoader::start): Starting fetch loader.
(WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader.
(WebCore::FetchResponse::stop): Stop loader if any.
* Modules/fetch/FetchResponse.h:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET.
(WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers.
(WebCore::BlobResourceHandle::createAsync): Removing GET verb check.

LayoutTests:

* TestExpectations: Removed flaky test expectations.
* http/tests/fetch/closing-while-fetching-expected.txt: Added.
* http/tests/fetch/closing-while-fetching.html: Added.
* http/tests/fetch/get-response-body-while-loading-expected.txt: Added.
* http/tests/fetch/get-response-body-while-loading.html: Added.
* http/tests/resources/download-json-with-delay.php: Added.
* platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added.

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

3 years agoRemoved leftovers of WCHAR_UNICODE code path after r162782.
commit-queue@webkit.org [Fri, 25 Mar 2016 14:08:56 +0000 (14:08 +0000)]
Removed leftovers of WCHAR_UNICODE code path after r162782.
https://bugs.webkit.org/show_bug.cgi?id=155881

Patch by Konstantin Tokarev <annulen@yandex.ru> on 2016-03-25
Reviewed by Csaba Osztrogonác.

No new tests needed.

* platform/text/TextEncodingDetectorNone.cpp: Removed.
* platform/text/wchar/TextBreakIteratorWchar.cpp: Removed.

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

3 years agoUnreviewed EFL gardening.
gyuyoung.kim@webkit.org [Fri, 25 Mar 2016 14:08:11 +0000 (14:08 +0000)]
Unreviewed EFL gardening.

Mark new failing tests with existing or new bug.

* platform/efl/TestExpectations:

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

3 years agoUnreviewed EFL gardening.
gyuyoung.kim@webkit.org [Fri, 25 Mar 2016 09:42:44 +0000 (09:42 +0000)]
Unreviewed EFL gardening.

Mark some blink imported tests to timeout, imageonlyfailure.
Besides some AX tests need to have new baseline, which have been tested since r197616.

* platform/efl/TestExpectations:

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

3 years agoUnreviewed EFL gardening. Mark crash tests in proper category.
gyuyoung.kim@webkit.org [Fri, 25 Mar 2016 06:46:31 +0000 (06:46 +0000)]
Unreviewed EFL gardening. Mark crash tests in proper category.

* platform/efl/TestExpectations:

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

3 years agoDetermine architecture for running jsc stress tests on windows
commit-queue@webkit.org [Fri, 25 Mar 2016 05:14:16 +0000 (05:14 +0000)]
Determine architecture for running jsc stress tests on windows
https://bugs.webkit.org/show_bug.cgi?id=155840

Patch by Bill Ming <mbbill@gmail.com> on 2016-03-24
Reviewed by Alex Christensen.

* Tools/Scripts/run-jsc-stress-tests:

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

3 years agoFix Mac CMake build.
achristensen@apple.com [Fri, 25 Mar 2016 03:59:30 +0000 (03:59 +0000)]
Fix Mac CMake build.

Source/JavaScriptCore:

* PlatformMac.cmake:
Link to Security framework.

Source/WebCore:

* PlatformMac.cmake:
Add new file and directory.

Source/WebKit2:

* CMakeLists.txt:
Temporarily add DERIVED_SOURCES_JAVASCRIPTCORE_DIR after DERIVED_SOURCES_WEBCORE_DIR,
because both contain a unique header named InspectorBackendDispatchers.h and this include
order includes the correct one for WebKit2 first.
* PlatformMac.cmake:
Add new files.  Optionally link to AVFAudio.

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

3 years agoUnreviewed, rolling out r198500.
cdumez@apple.com [Fri, 25 Mar 2016 02:24:51 +0000 (02:24 +0000)]
Unreviewed, rolling out r198500.

Roll back in r197552 as it did not seem to cause a PLT
regression after all

Reverted changeset:

"Unreviewed, rolling out r197552."
https://bugs.webkit.org/show_bug.cgi?id=154986
http://trac.webkit.org/changeset/198500

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

3 years agoCSP: Move logic for reporting a violation from ContentSecurityPolicyDirectiveList...
dbates@webkit.org [Fri, 25 Mar 2016 02:14:14 +0000 (02:14 +0000)]
CSP: Move logic for reporting a violation from ContentSecurityPolicyDirectiveList to ContentSecurityPolicy
https://bugs.webkit.org/show_bug.cgi?id=155842
<rdar://problem/25340377>
And
https://bugs.webkit.org/show_bug.cgi?id=155133

Reviewed by Brent Fulgham.

Source/WebCore:

Towards associating source file, line-, and column- numbers (https://bugs.webkit.org/show_bug.cgi?id=114317)
with a CSP console message we should move the logic for logging the console message/reporting the violation
from class ContentSecurityPolicyDirectiveList to class ContentSecurityPolicy so that it is closer to the
script execution context that can access such information.

The responsibilities of the class ContentSecurityPolicyDirectiveList have been reduced. It is responsible
for parsing a string representation of the Content Security Policy and providing functions to determine
the violated directive (if any) for a given source (e.g. URL). ContentSecurityPolicyDirectiveList no longer
takes responsibility logging a console message or sending a violation report (if applicable). Falling out
from this decrease in responsibility is the removal of enum ContentSecurityPolicyDirectiveList::ReportingStatus
and the need to pass a enumerator of this enum to each ContentSecurityPolicyDirectiveList to suppress
the sending of a violation report. The caller of ContentSecurityPolicyDirectiveList is responsible for
making this determination.

With the exception of a change to the error message for an inline event handler violation, there are no
other functional changes. When an inline event handler violation occurs we will emit either:

    Refused to execute a script for an inline event handler because 'unsafe-inline' does not appear in the
    script-src directive of the Content Security Policy.

Or:

    Refused to execute a script for an inline event handler because 'unsafe-inline' appears in neither the
    script-src directive nor the default-src directive of the Content Security Policy.

depending on whether the Content Security Policy contains a script-src directive or not.

* CMakeLists.txt: Add files ContentSecurityPolicyDirective.cpp and ContentSecurityPolicyDirectiveNames.cpp.
* WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyDirective.cpp and ContentSecurityPolicyDirectiveNames.{cpp, h}.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::consoleMessageForViolation): Moved from file ContentSecurityPolicyDirectiveList.cpp and
incorporates the functionality of ContentSecurityPolicyDirectiveList::reportViolation(). Modified
to take a reference to the violated directive (ContentSecurityPolicyDirective object) and removed
the boolean parameter violatesDefaultSrc as we can deduce this from the violated directive.
(WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to call ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeEval().
(WebCore::ContentSecurityPolicy::foundHashOfContentInAllPolicies): Renamed; Formerly named allPoliciesAllowHashFromContent.
Modified to early return if either no algorithms are given or the specified content to hash is
the empty string.
(WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Moved logic for reporting a violation from
ContentSecurityPolicyDirectiveList member function of the same name to here.
(WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Moved logic for reporting a violation from
ContentSecurityPolicyDirectiveList member function of the same name to here. Additionally, changed the
error message text to better describe the reason for the violation.
(WebCore::ContentSecurityPolicy::allowScriptWithNonce): Ditto.
(WebCore::ContentSecurityPolicy::allowStyleWithNonce): Ditto.
(WebCore::ContentSecurityPolicy::allowInlineScript): Ditto.
(WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
(WebCore::ContentSecurityPolicy::allowEval): Ditto.
(WebCore::ContentSecurityPolicy::allowFrameAncestors): Ditto.
(WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
(WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
(WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
(WebCore::ContentSecurityPolicy::allowBaseURI): Ditto.
(WebCore::ContentSecurityPolicy::reportViolation): Simplified signature by having it take a reference to
a ContentSecurityPolicyDirective object. Also split functionality into two variants: one variant takes a
pointer to a JSC::ExecState, one variant takes a source file, and line and column positions.
(WebCore::ContentSecurityPolicy::allPoliciesAllowHashFromContent): Deleted.
(WebCore::ContentSecurityPolicy::gatherReportURIs): Deleted.
* page/csp/ContentSecurityPolicy.h:
(WebCore::ContentSecurityPolicy::violatedDirectiveInAnyPolicy): Formerly named allPoliciesAllow. Modified
to return the violated directive.
(WebCore::ContentSecurityPolicy::allPoliciesAllow): Deleted.
* page/csp/ContentSecurityPolicyDirective.cpp: Added.
* page/csp/ContentSecurityPolicyDirective.h: Added.
(WebCore::ContentSecurityPolicyDirective::ContentSecurityPolicyDirective): Modified to take a reference to the
directive list that contains this directive instead of pointer to a ContentSecurityPolicy object.
(WebCore::ContentSecurityPolicyDirective::name): Added.
(WebCore::ContentSecurityPolicyDirective::directiveList): Added.
(WebCore::ContentSecurityPolicyDirective::isDefaultSrc): Added.
(WebCore::ContentSecurityPolicyDirective::policy): Deleted.
* page/csp/ContentSecurityPolicyDirectiveList.cpp: Remove unused header <wtf/Optional.h>. Also remove header wtf/text/StringBuilder.h
as the function that made use of it, consoleMessageForViolation, was moved to file ContentSecurityPolicy.cpp.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeEval): Formerly named allowEval.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineScript): Formerly named allowInlineScript.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForUnsafeInlineStyle): Formerly named allowInlineStyle.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScriptHash): Formerly named allowInlineScriptWithHash.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyleHash): Formerly named allowInlineStyleWithHash.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScriptNonce): Formerly named allowScriptWithNonce.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyleNonce): Formerly named allowStyleWithNonce.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForBaseURI): Formerly named allowBaseURI.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForChildContext): Formerly named allowChildContextFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForConnectSource): Formerly named allowConnectToSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFont): Formerly named allowFontFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFormAction): Formerly named allowFormAction.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrame): Formerly named allowChildFrameFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestor): Formerly named allowFrameAncestors.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForImage): Formerly named allowImageFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForMedia): Formerly named allowMediaFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForObjectSource): Formerly named allowObjectFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForPluginType): Formerly named allowPluginType.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScript): Formerly named allowScriptFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForStyle): Formerly named allowStyleFromSource.
(WebCore::ContentSecurityPolicyDirectiveList::parse): Update code to make use of ContentSecurityPolicyDirectiveNames constants.
(WebCore::ContentSecurityPolicyDirectiveList::setCSPDirective): Pass |this| instead of the ContentSecurityPolicy object.
(WebCore::ContentSecurityPolicyDirectiveList::addDirective): Update code to make use of ContentSecurityPolicyDirectiveNames constants.
(WebCore::isExperimentalDirectiveName): Deleted.
(WebCore::isCSPDirectiveName): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::reportViolation): Deleted.
(WebCore::consoleMessageForViolation): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowJavaScriptURLs): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineEventHandlers): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineScript): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineScriptWithHash): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowScriptWithNonce): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyle): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyleWithHash): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowStyleWithNonce): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowEval): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowPluginType): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowScriptFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowObjectFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowChildContextFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowChildFrameFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowImageFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowStyleFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowFontFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowMediaFromSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowConnectToSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowFormAction): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowBaseURI): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Deleted.
* page/csp/ContentSecurityPolicyDirectiveList.h:
(WebCore::ContentSecurityPolicyDirectiveList::defaultSrc): Added.
(WebCore::ContentSecurityPolicyDirectiveList::policy): Added. Also added FIXME comment to remove this function. This
function is only used by ContentSecurityPolicyMediaListDirective so that it can log a console message on a parsing error.
(WebCore::ContentSecurityPolicyDirectiveList::denyIfEnforcingPolicy): Deleted.
* page/csp/ContentSecurityPolicyDirectiveNames.cpp: Added.
* page/csp/ContentSecurityPolicyDirectiveNames.h: Added.
* page/csp/ContentSecurityPolicyMediaListDirective.cpp:
(WebCore::ContentSecurityPolicyMediaListDirective::ContentSecurityPolicyMediaListDirective): Modified to take a reference to the
directive list that contains this directive instead of pointer to a ContentSecurityPolicy object.
(WebCore::ContentSecurityPolicyMediaListDirective::parse): Updated code to use ContentSecurityPolicyDirectiveList::policy() instead
of ContentSecurityPolicyDirective::policy() as the latter was removed. Ideally this class should not need to use the ContentSecurityPolicy
object to log a console message.
* page/csp/ContentSecurityPolicyMediaListDirective.h:
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::isExperimentalDirectiveName): Moved from file ContentSecurityPolicyDirectiveList.cpp because this function is only used
in this file.
(WebCore::isCSPDirectiveName): Ditto.
(WebCore::ContentSecurityPolicySourceList::isProtocolAllowedByStar): Update code to make use of ContentSecurityPolicyDirectiveNames constants.
* page/csp/ContentSecurityPolicySourceListDirective.cpp:
(WebCore::ContentSecurityPolicySourceListDirective::ContentSecurityPolicySourceListDirective): Modified to take a reference to
the directive list that contains this directive instead of pointer to a ContentSecurityPolicy object.
* page/csp/ContentSecurityPolicySourceListDirective.h:

LayoutTests:

Update expected results to reflect new error message text for an inline event handler violation.

* http/tests/security/contentSecurityPolicy/inline-event-handler-blocked-after-injecting-meta-expected.txt:
* http/tests/security/contentSecurityPolicy/inline-script-blocked-goofy-expected.txt:
* http/tests/security/contentSecurityPolicy/script-src-none-inline-event-expected.txt:

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

3 years ago[OS X] Overflow:scroll scrollbars do not obey overlay/always-on system preference...
mmaxfield@apple.com [Fri, 25 Mar 2016 02:03:25 +0000 (02:03 +0000)]
[OS X] Overflow:scroll scrollbars do not obey overlay/always-on system preference changes
https://bugs.webkit.org/show_bug.cgi?id=155830

Reviewed by Simon Fraser.

When the scrollbar style changes, the available width of all ScrollableAreas change,
and therefore a relayout must occur.

Each ScrollableArea owns its own ScrollAnimator (if necessary). Upon creation, the
ScrollAnimator will start listening for changes to the system preference for
overlay / always-on scrollbars. When notified, the ScrollAnimator tells its owning
ScrollableArea that scrollbarStyleChanged().

For main-frame scrolling, FrameView overrides scrollbarStyleChanged and causes a
relayout. However, for overflow:scroll elements, no relayout is triggered. This
patch overrides availableContentSizeChanged() for RenderLayer (which is used for
overflow:scroll elements). This override triggers a relayout.

It also updates the mechanism in RenderBlock::recomputeLogicalWidth() to ensure that
a change in scrollbar size causes RenderBlockFlow::layoutBlock() to relayout its
children. This is appropriate because block child positioning is affected by
scrollbar size.

No new tests (for now). Presumably we could mock the message we receive when the
system preference is changed. However, I haven't implemented that yet.

* rendering/RenderBlock.cpp: Rename setHasBorderOrPaddingLogicalWidthChanged().
(WebCore::RenderBlock::styleDidChange):
(WebCore::RenderBlock::recomputeLogicalWidth):
* rendering/RenderBlock.h: Ditto.
(WebCore::RenderBlock::setShouldForceRelayoutChildren):
(WebCore::RenderBlock::shouldForceRelayoutChildren):
* rendering/RenderElement.cpp: Ditto.
(WebCore::RenderElement::RenderElement):
* rendering/RenderElement.h: Ditto.
(WebCore::RenderElement::setRenderBlockShouldForceRelayoutChildren):
(WebCore::RenderElement::renderBlockShouldForceRelayoutChildren):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::availableContentSizeChanged): Cause a relayout to occur.
* rendering/RenderLayer.h:

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

3 years agoChange NativeImagePtr for CG to be RetainPtr<CGImageRef>
commit-queue@webkit.org [Fri, 25 Mar 2016 01:13:10 +0000 (01:13 +0000)]
Change NativeImagePtr for CG to be RetainPtr<CGImageRef>
https://bugs.webkit.org/show_bug.cgi?id=155412

Patch by Said Abou-Hallawa <sabouhallawa@apple,com> on 2016-03-24
Reviewed by Darin Adler.

Source/WebCore:

Having NativeImagePtr as a raw pointer makes managing the life cycle of
the returned CGImageRef hard. A lot of work was done to ensure the CG
pointer is refcounted correctly. It was also not possible to move a
FrameData since calling the destructor was releasing the CGImageRef.

With this change, PassNativeImagePtr is not needed anymore. So all the
instance of PassNativeImagePtr can be replaced by NativeImagePtr.

* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::nativeImageForCurrentTime):
* html/HTMLVideoElement.h: Replace PassNativeImagePtr with NativeImagePtr.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawImage): Replace PassNativeImagePtr
with NativeImagePtr.

* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::addImageToCache):
* loader/cache/MemoryCache.h: Remove USE(CG) and CFRetain(image) since
this code can compile on all platforms. The image refcount will be
incremented when the image is assigned to FrameData.m_image in the
BitmapImage constructor.

* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::synchronousNativeIconForPageURL):
* loader/icon/IconDatabase.h:
* loader/icon/IconDatabaseBase.h: Replace PassNativeImagePtr with NativeImagePtr.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::haveFrameImageAtIndex):
(WebCore::BitmapImage::cacheFrame):
(WebCore::BitmapImage::ensureFrameIsCached):
(WebCore::BitmapImage::frameImageAtIndex):
(WebCore::BitmapImage::nativeImageForCurrentFrame):
(WebCore::BitmapImage::haveFrameAtIndex): Deleted.
(WebCore::BitmapImage::frameAtIndex): Deleted.
Replace PassNativeImagePtr with NativeImagePtr, m_frame with m_image and
*Frame* with *FrameImage*.

* platform/graphics/BitmapImage.h:
(WebCore::FrameData::FrameData):
A BitmapImage can have one or more FrameData. A FrameData member can be
named for shortness as "frame", "m_frames", etc. A FrameData can have
zero or one NativeImagePtr. A NativeImagePtr can be named as "image",
"m_image", etc.

* platform/graphics/GraphicsContext.h: Replace PassNativeImagePtr with
NativeImagePtr.

* platform/graphics/GraphicsContext3D.h:
* platform/graphics/Icon.h:
Change the members of type CGImageRef to be RetainPtr<CGImageRef>.

* platform/graphics/Image.h:
(WebCore::Image::nativeImageForCurrentFrame):
(WebCore::Image::getNSImage):
(WebCore::Image::getTIFFRepresentation):
(WebCore::Image::getCGImageRef):
(WebCore::Image::getFirstCGImageRefOfSize):
(WebCore::Image::getCGImageArray):
(WebCore::Image::getGdkPixbuf):
(WebCore::Image::getEvasObject):
* platform/graphics/ImageBuffer.h:
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::createFrameImageAtIndex):
(WebCore::ImageSource::createFrameAtIndex): Deleted.
* platform/graphics/ImageSource.h:
Change 0 to nullptr, PassRefPtr to RefPtr and PassNativeImagePtr to
NativeImagePtr.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::nativeImageForCurrentTime):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::nativeImageForCurrentTime):
Replace PassNativeImagePtr with NativeImagePtr.

* platform/graphics/NativeImagePtr.h:
Make NativeImagePtr a smart pointer for CG. Get rid of PassNativeImagePtr
since NativeImagePtr is now a smart pointer on all platforms.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::nativeImageForCurrentTime):
Replace PassNativeImagePtr with NativeImagePtr.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToImage):
Since Image::nativeImageForCurrentFrame() returns a RetainPtr, move it
to m_pendingContentsImage to remove the refcount churn.

* platform/graphics/cairo/BitmapImageCairo.cpp:
(WebCore::BitmapImage::BitmapImage):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::checkForSolidColor):
(WebCore::FrameData::clear):
Replace m_frame with m_image and frame* with frameImage*.

* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::copyCairoImageSurface):
* platform/graphics/cairo/CairoUtilities.h:
Replace PassRefPtr with RefPtr.

* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
Replace *Frame* with *FrameImage*.

* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawNativeImage):
Replace PassNativeImagePtr with NativeImagePtr.

* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::copyImage): Create a new NativeImagePtr so it can
be moved to the BitmapImage::create().
(WebCore::copySurfaceToImageAndAdjustRect):
(WebCore::getImageData):
(WebCore::ImageBuffer::getUnmultipliedImageData):
(WebCore::ImageBuffer::getPremultipliedImageData):
Replace PassRefPtr with RefPtr.

* platform/graphics/cg/BitmapImageCG.cpp:
(WebCore::FrameData::clear): No need to call CGImageRelease(). Just assign
m_image to nullptr and CGImageRelease() will be called from the RetainPtr
destructor.

(WebCore::BitmapImage::BitmapImage):
(WebCore::BitmapImage::checkForSolidColor):
(WebCore::BitmapImage::getCGImageRef):
(WebCore::BitmapImage::getFirstCGImageRefOfSize):
(WebCore::BitmapImage::getCGImageArray):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::copyUnscaledFrameImageAtIndex):
(WebCore::BitmapImage::copyUnscaledFrameAtIndex): Deleted.
Replace CGImageRef with RetainPtr<CGImageRef>. Replace *Frame* with
*FrameImage*.

* platform/graphics/cg/GraphicsContext3DCG.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
(WebCore::GraphicsContext3D::paintToCanvas):
Use m_cgImage.get() instead of m_cgImage when calling CG functions.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawNativeImage):
(WebCore::GraphicsContext::drawPattern):
Replace PassNativeImagePtr with NativeImagePtr. Get the raw CGImageRef
from the NativeImagePtr when calling the CG functions.

* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::createBitmapImageAfterScalingIfNeeded): Move the image argument
when calling BitmapImage::create().

(WebCore::ImageBuffer::getUnmultipliedImageData):
(WebCore::ImageBuffer::getPremultipliedImageData):
Replace PassRefPtr with RefPtr.

* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::createFrameImageAtIndex):
(WebCore::ImageSource::createFrameAtIndex): Deleted.
Rename the function and simplify the code since the local variable
and the return value are both smart pointers.

* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawNativeImage::DrawNativeImage):
(WebCore::DisplayList::DrawNativeImage::apply):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawNativeImage::create):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawNativeImage):
* platform/graphics/displaylists/DisplayListRecorder.h:
Replace PassNativeImagePtr with NativeImagePtr and use constant reference.

* platform/graphics/efl/GraphicsContext3DEfl.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
Call a function with its new name.

* platform/graphics/efl/IconEfl.cpp:
(WebCore::Icon::createIconForFiles):
* platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
(ImageGStreamer::ImageGStreamer):
* platform/graphics/gtk/IconGtk.cpp:
(WebCore::Icon::createIconForFiles):
* platform/graphics/ios/IconIOS.mm:
(WebCore::Icon::Icon):
(WebCore::Icon::createIconForFiles):
(WebCore::Icon::createIconForImage):
* platform/graphics/mac/IconMac.mm:
(WebCore::Icon::createIconForFiles):
Use smart pointers RetainPtr<CGImageRef> instead of raw pointers CGImageRef.
And change PassRefPtr to RefPtr and 0 to nullptr.

* platform/graphics/mac/ImageMac.mm:
(WebCore::BitmapImage::getTIFFRepresentation): Get the raw pointer from the
returned smart pointer.

* platform/graphics/texmap/coordinated/CoordinatedSurface.cpp:
(WebCore::CoordinatedSurface::create):
* platform/graphics/texmap/coordinated/CoordinatedSurface.h:
Replace PassRefPtr with RefPtr.

* platform/graphics/win/IconWin.cpp:
(WebCore::Icon::createIconForFiles): Change PassRefPtr to RefPtr.

* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::create): Replace PassRefPtr with RefPtr.
(WebCore::BitmapImage::drawFrameMatchingSourceSize): Call the function
with its new name and get the raw pointer from the returned smart pointer.

* platform/graphics/win/ImageCairoWin.cpp:
(WebCore::BitmapImage::create): Replace PassRefPtr with ReftPtr and use
the move semantics for passing the argument to BitmapImage::create().
(WebCore::BitmapImage::drawFrameMatchingSourceSize): Call the function
with its new name.

* platform/image-decoders/ImageDecoder.h:
* platform/image-decoders/cairo/ImageDecoderCairo.cpp:
(WebCore::ImageFrame::asNewNativeImage):
* platform/win/DragImageCGWin.cpp:
(WebCore::createDragImageFromImage):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::nativeImageForCurrentFrame):
* svg/graphics/SVGImage.h:
* svg/graphics/SVGImageForContainer.cpp:
(WebCore::SVGImageForContainer::nativeImageForCurrentFrame):
* svg/graphics/SVGImageForContainer.h:
Replace PassNativeImagePtr with NativeImagePtr.

Source/WebKit/mac:

* Misc/WebCache.mm:
(+[WebCache addImageToCache:forURL:forFrame:]):
WebCore::MemoryCache() is taking an rvalue NativeImagePtr. We need to create
NativeImagePtr from the image raw pointer when calling this function.

Source/WebKit/win:

* Plugins/PluginView.h:
* Plugins/PluginViewWin.cpp:
(WebCore::PluginView::snapshot):
Replace PassRefPtr with RefPtr.

Source/WebKit2:

* Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
(WebKit::WebCoordinatedSurface::createWithSurface):
(WebKit::WebCoordinatedSurface::create):
(WebKit::WebCoordinatedSurface::WebCoordinatedSurface):
(WebKit::WebCoordinatedSurface::copyToTexture):
* Shared/CoordinatedGraphics/WebCoordinatedSurface.h:
* Shared/ShareableBitmap.cpp:
(WebKit::ShareableBitmap::create):
(WebKit::ShareableBitmap::createShareable):
(WebKit::ShareableBitmap::ShareableBitmap):
* Shared/ShareableBitmap.h:
Replace PassRefPtr with RefPtr and use WTFMove() instead of RefPtr::release()
when passing the RefPtr.

* Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::createSurfaceFromData):
(WebKit::ShareableBitmap::createCairoSurface):
Replace PassRefPtr with RefPtr.

(WebKit::ShareableBitmap::createImage):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::createImage):
Replace PassRefPtr with RefPtr and use the move semantics when calling
BitmapImage::create().

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::createCoordinatedSurface):
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
Replace PassRefPtr with RefPtr

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

3 years agoSafari Crashes if audio.src is changed while connected to AudioAnalyserNode
jer.noble@apple.com [Fri, 25 Mar 2016 00:52:40 +0000 (00:52 +0000)]
Safari Crashes if audio.src is changed while connected to AudioAnalyserNode
https://bugs.webkit.org/show_bug.cgi?id=153593
<rdar://problem/23648082>

Reviewed by Eric Carlson.

m_ringBuffer is accessed on the high-priority WebAudio thread after it has been cleared (a
null-deref). Protect against unsafe access on multiple threads of a non-refcounted object by
a simple try_lock.

Additionally, limit the use of variables in use by both the separate WebAudio thread method
(provideInput()) and AVAudioMix thread method (process()) where possible, and convert to
std::atomic<> where ivars must be acessed by both threads. m_writeCount is entirely superfluous,
as it is a synonym for the endTime returned by m_ringBuffer->getCurrentFrameBounds().

* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::provideInput):
(WebCore::AudioSourceProviderAVFObjC::prepare):
(WebCore::AudioSourceProviderAVFObjC::unprepare):
(WebCore::AudioSourceProviderAVFObjC::process):

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

3 years agoAdopt new SPI from DataDetectorsCore to decide link behavior.
enrica@apple.com [Thu, 24 Mar 2016 23:56:27 +0000 (23:56 +0000)]
Adopt new SPI from DataDetectorsCore to decide link behavior.
https://bugs.webkit.org/show_bug.cgi?id=155780
rdar://problem/25303631

Reviewed by Sam Weinig.

Source/WebCore:

isDataDetectorLink and shouldCancelDefaultAction now
use the SPI provided by DataDetectorsCore to decide
what is the link behavior when the user taps on it.

* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::detectItemAtPositionWithRange):
(WebCore::DataDetection::isDataDetectorLink):
(WebCore::DataDetection::requiresExtendedContext):
(WebCore::DataDetection::dataDetectorIdentifier):
(WebCore::DataDetection::shouldCancelDefaultAction):
* platform/cocoa/DataDetectorsCoreSoftLink.h:
* platform/cocoa/DataDetectorsCoreSoftLink.mm:
* platform/spi/cocoa/DataDetectorsCoreSPI.h:

Source/WebKit2:

Changed use of data detection functions to take
a reference to Element instead of a pointer.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleTap):
(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::getPositionInformation):

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

3 years agoES6: Implement IsRegExp function and use where needed in String.prototype.* methods
sbarati@apple.com [Thu, 24 Mar 2016 23:18:49 +0000 (23:18 +0000)]
ES6: Implement IsRegExp function and use where needed in String.prototype.* methods
https://bugs.webkit.org/show_bug.cgi?id=155854

Reviewed by Mark Lam.

Source/JavaScriptCore:

This patch is a straight forward implementation of IsRegExp
in the ES6 spec:
https://tc39.github.io/ecma262/#sec-isregexp
We now use this IsRegExp function inside String.prototype.(startsWith | endsWith | includes)
as is dictated by the spec.

* runtime/RegExpConstructor.h:
(JSC::RegExpConstructor::recordMatch):
(JSC::isRegExp):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncStartsWith):
(JSC::stringProtoFuncEndsWith):
(JSC::stringProtoFuncIncludes):
* tests/es6.yaml:
* tests/es6/well-known_symbols_Symbol.match_String.prototype.endsWith.js: Added.
(test):
* tests/es6/well-known_symbols_Symbol.match_String.prototype.includes.js: Added.
(test):
* tests/es6/well-known_symbols_Symbol.match_String.prototype.startsWith.js: Added.
(test):
* tests/stress/string-prototype-methods-endsWith-startsWith-includes-correctness.js: Added.
(assert):
(test):
(test.get let):
(get let):

LayoutTests:

* js/string-includes-expected.txt:

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

3 years ago[WK2] Disable network cache speculative validation by default
cdumez@apple.com [Thu, 24 Mar 2016 23:16:53 +0000 (23:16 +0000)]
[WK2] Disable network cache speculative validation by default
https://bugs.webkit.org/show_bug.cgi?id=155857
<rdar://problem/25233210>

Reviewed by Alex Christensen.

Disable network cache speculative validation by default. Clients such
as Safari now use the API added in r198544 to enable if they want.

* UIProcess/API/APIProcessPoolConfiguration.h:

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

3 years agoDataDetection creates links that are longer than the actual result.
enrica@apple.com [Thu, 24 Mar 2016 23:09:18 +0000 (23:09 +0000)]
DataDetection creates links that are longer than the actual result.
https://bugs.webkit.org/show_bug.cgi?id=155850
rdar://problem/25280740

Reviewed by Anders Carlsson.

When a data detection result is composed of multiple fragments,
the range for the last fragment should take into account the end
offset of the query range structure, since there could be additional
content in that range that is not part of the result.

* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::detectContentInRange):

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

3 years agoUnreviewed, rolling out r198627.
commit-queue@webkit.org [Thu, 24 Mar 2016 23:01:45 +0000 (23:01 +0000)]
Unreviewed, rolling out r198627.
https://bugs.webkit.org/show_bug.cgi?id=155856

Caused use-after-free (Requested by ap on #webkit).

Reverted changeset:

"[Fetch API] Add basic loading of resources"
https://bugs.webkit.org/show_bug.cgi?id=155637
http://trac.webkit.org/changeset/198627

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

3 years agoWeb Inspector: Separate Debugger enable state from the debugger breakpoints enabled...
sbarati@apple.com [Thu, 24 Mar 2016 22:43:06 +0000 (22:43 +0000)]
Web Inspector: Separate Debugger enable state from the debugger breakpoints enabled state
https://bugs.webkit.org/show_bug.cgi?id=152193
<rdar://problem/23867520>

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

When all breakpoints are disabled, we can recompile all JS
code and remove the necessary debugging code that is emitted.
This allows for the code that is executing to be almost as fast
as it is with the debugger completely disabled. This is in preparation for:
https://bugs.webkit.org/show_bug.cgi?id=155809
which will introduce a high fidelity profiler. That profiler
could be built off the principle that breakpoints are disabled
when we're performing a high fidelity profile. Doing so, for example,
allows the sampling profiler to better measure the real performance
of the JS of a particular application.

* debugger/Debugger.cpp:
(JSC::Debugger::setBreakpointsActivated):
(JSC::Debugger::setPauseOnExceptionsState):
* debugger/Debugger.h:
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::Graph):
* inspector/JSGlobalObjectScriptDebugServer.cpp:
(Inspector::JSGlobalObjectScriptDebugServer::attachDebugger):
(Inspector::JSGlobalObjectScriptDebugServer::detachDebugger):
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::enable):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::newCodeBlockFor):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::createProgramCodeBlock):
(JSC::JSGlobalObject::createEvalCodeBlock):
(JSC::JSGlobalObject::createModuleProgramCodeBlock):
(JSC::JSGlobalObject::queueMicrotask):
(JSC::JSGlobalObject::hasDebugger):
(JSC::JSGlobalObject::hasInteractiveDebugger):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::runtimeFlags):
(JSC::JSGlobalObject::hasDebugger): Deleted.

Source/WebCore:

No new tests because this is already tested by inspector tests.

* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::attachDebugger):
(WebCore::PageScriptDebugServer::detachDebugger):

LayoutTests:

* inspector/script-profiler/event-type-API.html:
* inspector/script-profiler/event-type-Microtask.html:
* inspector/script-profiler/event-type-Other.html:

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

3 years agoCreate private builtin helper advanceStringIndexUnicode() for use by RegExp builtins
msaboff@apple.com [Thu, 24 Mar 2016 22:35:35 +0000 (22:35 +0000)]
Create private builtin helper advanceStringIndexUnicode() for use by RegExp builtins
https://bugs.webkit.org/show_bug.cgi?id=155855

Reviewed by Mark Lam.

Moved advanceStringIndexUnicode() as a separate helper.  Added it as a private builtin
to the GlobalObject like other private builtins.

* builtins/RegExpPrototype.js:
(advanceStringIndexUnicode):
(match):
(match.advanceStringIndexUnicode): Deleted.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):

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

3 years ago[MSE] Make calling HTMLMediaElement.buffered less expensive
jer.noble@apple.com [Thu, 24 Mar 2016 22:27:45 +0000 (22:27 +0000)]
[MSE] Make calling HTMLMediaElement.buffered less expensive
https://bugs.webkit.org/show_bug.cgi?id=155846

Reviewed by Eric Carlson.

The MSE specification requires a new TimeRanges object be returned when calling
HTMLMediaElement.buffered. Additionally, the requirements for generating the buffered time
ranges for MediaSource and its constituent SourceBuffers are specific and expensive. Rather
than perform all these steps each time HTMLMediaElement.buffered is queried, cache the final
result and only regenerate the cached value if the buffered ranges of the consituent
SourceBuffers has changed.

Also, make copying a PlatformTimeRanges more efficient by doing a straight vector-to-vector
copy of the PlatformTimeRange's data.

* Modules/mediasource/MediaSource.cpp:
(WebCore::MediaSource::buffered):
(WebCore::MediaSource::regenerateActiveSourceBuffers):
* Modules/mediasource/MediaSource.h:
* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::removeCodedFrames):
(WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
* Modules/mediasource/SourceBuffer.h:
* platform/graphics/PlatformTimeRanges.cpp:
(WebCore::PlatformTimeRanges::PlatformTimeRanges): Deleted.
(WebCore::PlatformTimeRanges::operator=): Deleted.
(WebCore::PlatformTimeRanges::copy): Deleted.
* platform/graphics/PlatformTimeRanges.h:

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

3 years agoWeb Inspector: Reduce forced layouts
commit-queue@webkit.org [Thu, 24 Mar 2016 22:20:52 +0000 (22:20 +0000)]
Web Inspector: Reduce forced layouts
https://bugs.webkit.org/show_bug.cgi?id=155852
<rdar://problem/25345197>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-24
Reviewed by Timothy Hatcher.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.layout):
(WebInspector.DataGrid.prototype._positionResizerElements):
(WebInspector.DataGrid.prototype._positionHeaderViews):
In loops, force layout once, calculate values, then set styles.

* UserInterface/Views/RadioButtonNavigationItem.js:
(WebInspector.RadioButtonNavigationItem):
(WebInspector.RadioButtonNavigationItem.prototype.updateLayout):
Force layout once to calculate the min-width, then never again.

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

3 years agoWeb Inspector: Open Resource Dialog should not system beep when using Enter to select...
commit-queue@webkit.org [Thu, 24 Mar 2016 22:18:48 +0000 (22:18 +0000)]
Web Inspector: Open Resource Dialog should not system beep when using Enter to select an item
https://bugs.webkit.org/show_bug.cgi?id=155853

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-24
Reviewed by Timothy Hatcher.

* UserInterface/Views/OpenResourceDialog.js:
(WebInspector.OpenResourceDialog.prototype._handleKeydownEvent):
Prevent default when handling Enter with a selected result.

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

3 years agoUpdate expected results following <http://trac.webkit.org/changeset/198591>
dbates@webkit.org [Thu, 24 Mar 2016 22:14:44 +0000 (22:14 +0000)]
Update expected results following <trac.webkit.org/changeset/198591>
(https://bugs.webkit.org/show_bug.cgi?id=155777)

* http/tests/security/contentSecurityPolicy/audio-redirect-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/video-redirect-blocked-expected.txt:

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

3 years agoAdd mocha server tests for /api/build-requests
rniwa@webkit.org [Thu, 24 Mar 2016 20:17:01 +0000 (20:17 +0000)]
Add mocha server tests for /api/build-requests
https://bugs.webkit.org/show_bug.cgi?id=155831

Reviewed by Chris Dumez.

Added the new mocha.js based server-tests for /api/build-requests. The new harness automatically:
 - starts a new Apache instance
 - switches the database during testing via setting an environmental variable
 - backups and restores public/data directory during testing

As a result, developer no longer has to manually setup Apache, edit config.json manually to use
a testing database, or run /api/manifest.php to re-generate the manifest file after testing.

This patch also makes ID resolution optional on /api/build-requests so that v3 model based syncing
scripts can re-use the same code as the v3 UI to process the JSON. tools/sync-with-buildbot.py has
been modified to use this option (useLegacyIdResolution).

* config.json: Added configurations for the test httpd server.
* init-database.sql: Don't error when tables and types don't exist (when database is empty).
* public/api/build-requests.php:
(main): Made the ID resolution optional with useLegacyIdResolution. Also removed "updates" from the
results JSON since it's never used.
* public/include/build-requests-fetcher.php:
(BuildRequestsFetcher::__construct):
(BuildRequestsFetcher::fetch_roots_for_set_if_needed): Fixed the bug that we would include the same
commit multiple times for each root set.
* public/include/db.php:
(config): If present, use ORG_WEBKIT_PERF_CONFIG_PATH instead of Websites/perf.webkit.org/config.json.
* server-tests: Added.
* server-tests/api-build-requests-tests.js: Added. Tests for /api/build-requests.
(.addMockData):
* server-tests/resources: Added.
* server-tests/resources/test-server.conf: Added. Apache configuration file for testing.
* server-tests/resources/test-server.js: Added.
(TestSever): Added.
(TestSever.prototype.start): Added.
(TestSever.prototype.stop): Added.
(TestSever.prototype.remoteAPI): Added. Configures RemoteAPI to be used with the test sever.
(TestSever.prototype.database): Added. Returns Database configured to use the test database.
(TestSever.prototype._constructTestConfig): Creates config.json for testing. The file is generated by
_start and db.php's config() reads it from the environmental variable: ORG_WEBKIT_PERF_CONFIG_PATH.
(TestSever.prototype._ensureDataDirectory): Renames public/data to public/original-data if exists,
and creates a new empty public/data.
(TestSever.prototype._restoreDataDirectory): Deletes public/data and renames public/original-data
back to public/data.
(TestSever.prototype._ensureTestDatabase): Drops the test database if exists and creates a new one.
(TestSever.prototype.initDatabase): Run init-database.sql to start each test with a consistent state.
(TestSever.prototype._executePgsqlCommand): Executes a postgres command line tool such as psql.
(TestSever.prototype._determinePgsqlDirectory): Finds the directory that contains psql.
(TestSever.prototype._startApache): Starts an Apache instance for testing.
(TestSever.prototype._stopApache): Stops the Apache instance for testing.
(TestSever.prototype._waitForPid): Waits for the Apache pid file to appear or disappear.
(before): Start the test server at the beginning.
(beforeEach): Re-initialize all tables before each test.
(after): Stop the test server at the end.
* tools/js/config.js:
(Config.prototype.path):
(Config.prototype.serverRoot): Added. The path to Websites/perf.webkit.org/public/.
(Config.prototype.pathFromRoot): Added. Resolves a path from Websites/perf.webkit.org.
* tools/js/database.js:
(Database): Now optionally takes the database name to use a different database during testing.
(Database.prototype.connect):
(Database.prototype.query): Added.
(Database.prototype.insert): Added.
(tableToPrefixMap): Maps table name to its prefix. Used by Database.insert.
* tools/js/remote.js: Added.
(RemoteAPI): Added. This is node.js equivalent of RemoteAPI in public/v3/remote.js.
(RemoteAPI.prototype.configure): Added.
(RemoteAPI.prototype.fetchJSON): Added.
(RemoteAPI.prototype.fetchJSONWithStatus): Added.
(RemoteAPI.prototype.sendHttpRequest): Added.
* tools/sync-with-buildbot.py:
(main): Use useLegacyIdResolution as this script relies on the legacy behavior.
* unit-tests/checkconfig.js: pg was never directly used in this test.

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

3 years agoFix iOS9 performance regression after r197572
cdumez@apple.com [Thu, 24 Mar 2016 19:56:58 +0000 (19:56 +0000)]
Fix iOS9 performance regression after r197572
https://bugs.webkit.org/show_bug.cgi?id=155845
<rdar://problem/25144924>

Patch by Alex Christensen <achristensen@webkit.org> on 2016-03-24
Reviewed by Chris Dumez.

* wtf/Platform.h:
Use CFURLConnection instead of NSURLConnection on internal iOS9 builds.

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

3 years agoFix some new PDFKit-related warnings
timothy_horton@apple.com [Thu, 24 Mar 2016 19:05:22 +0000 (19:05 +0000)]
Fix some new PDFKit-related warnings
https://bugs.webkit.org/show_bug.cgi?id=155847
<rdar://problem/25340312>

Reviewed by Anders Carlsson.

* WebView/WebPDFView.mm:
(-[WebPDFView setViewState:]):
* WebView/WebPreferences.mm:
(-[WebPreferences PDFDisplayMode]):
PDFDisplayMode is now a real enum.

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

3 years agoImprove update-webkit-dependency script.
commit-queue@webkit.org [Thu, 24 Mar 2016 18:42:57 +0000 (18:42 +0000)]
Improve update-webkit-dependency script.
https://bugs.webkit.org/show_bug.cgi?id=155576

Patch by Jeremy Zerfas <WebKit@JeremyZerfas.com> on 2016-03-24
Reviewed by Brent Fulgham.

* Scripts/update-webkit-dependency:
-Updated script to also use ETags for helping to determine whether dependency is up to date.
-Updated script so it usually won't need to download the entire dependency each time it is
 ran.
-Updated script to ensure zip file contains expected directories before trying to install.
-Added some more error checking and improved error messages.
(lastModifiedToUnixTime): Deleted.

* Scripts/update-webkit-wincairo-libs:
-Corrected comment about what script does.

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

3 years agoREGRESSION(r189129): <audio> elements do not have playback controls on iOS.
jer.noble@apple.com [Thu, 24 Mar 2016 18:42:04 +0000 (18:42 +0000)]
REGRESSION(r189129): <audio> elements do not have playback controls on iOS.
https://bugs.webkit.org/show_bug.cgi?id=155808
<rdar://problem/23822457>

Reviewed by Eric Carlson.

Audio elements should never require fullscreen for playback.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):

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

3 years agoClean up cookie jar after r198195
commit-queue@webkit.org [Thu, 24 Mar 2016 18:04:46 +0000 (18:04 +0000)]
Clean up cookie jar after r198195
https://bugs.webkit.org/show_bug.cgi?id=155484

Patch by Alex Christensen <achristensen@webkit.org> on 2016-03-24
Reviewed by Tim Horton.

Get rid of a now unneeded macro.

* loader/CookieJar.cpp:
(WebCore::storageSession):
(WebCore::cookies):
(WebCore::setCookies):
(WebCore::cookiesEnabled):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::getRawCookies):
(WebCore::deleteCookie):

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

3 years agoFix null dereferencing in NetworkLoad::continueCanAuthenticateAgainstProtectionSpace
achristensen@apple.com [Thu, 24 Mar 2016 17:07:54 +0000 (17:07 +0000)]
Fix null dereferencing in NetworkLoad::continueCanAuthenticateAgainstProtectionSpace
https://bugs.webkit.org/show_bug.cgi?id=155799
rdar://25289012

Reviewed by Tim Horton.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
Null-check all the things!

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

3 years agoFix webkitpy tests after r198617
achristensen@apple.com [Thu, 24 Mar 2016 17:01:10 +0000 (17:01 +0000)]
Fix webkitpy tests after r198617
https://bugs.webkit.org/show_bug.cgi?id=155827

Patch by Bill Ming <mbbill@gmail.com> on 2016-03-24
Reviewed by Alex Christensen.

* Scripts/webkitpy/tool/steps/confirmdiff.py:
(ConfirmDiff._show_pretty_diff):

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

3 years ago[Fetch API] Add basic loading of resources
youenn.fablet@crf.canon.fr [Thu, 24 Mar 2016 16:53:36 +0000 (16:53 +0000)]
[Fetch API] Add basic loading of resources
https://bugs.webkit.org/show_bug.cgi?id=155637

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebasing test expectations.
Updating scheme-blob.js to ensure generated test names are stable run after run.

* web-platform-tests/fetch/api/basic/accept-header-expected.txt:
* web-platform-tests/fetch/api/basic/integrity-expected.txt:
* web-platform-tests/fetch/api/basic/mode-no-cors-expected.txt:
* web-platform-tests/fetch/api/basic/mode-same-origin-expected.txt:
* web-platform-tests/fetch/api/basic/request-forbidden-headers-expected.txt:
* web-platform-tests/fetch/api/basic/request-headers-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-about-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob-worker-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-blob.js:
(checkFetchResponse): Deleted.
(checkKoUrl): Deleted.
* web-platform-tests/fetch/api/basic/scheme-data-expected.txt:
* web-platform-tests/fetch/api/basic/scheme-others-expected.txt:
* web-platform-tests/fetch/api/basic/stream-response-expected.txt:

Source/WebCore:

Adding support for basic fetch for Window (no support for Worker yet).
A FetchResponse object is created for every fetch task.
But it will only be exposed to JS at promise fulfillment time, i.e. once initial response headers are retrieved.

Updating Blob resource handle to add Content-Type and Content-Length header and notifying of error in case of erroneous HTTP method.

Fetch is limited to same origin requests currently due to some WPT tests that would timeout otherwise.

Tests: http/tests/fetch/closing-while-fetching.html
       http/tests/fetch/get-response-body-while-loading.html
Also covered by rebased tests.

* Modules/fetch/DOMWindowFetch.cpp: Creating a FetchResponse to start fetching.
(WebCore::DOMWindowFetch::fetch):
* Modules/fetch/DOMWindowFetch.h:
* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::consume):
(WebCore::FetchBody::consumeArrayBuffer): Handling of body promises in case of data stored as a buffer.
(WebCore::FetchBody::consumeText): Passing the promise as a reference.
(WebCore::blobFromArrayBuffer): Helper routine.
(WebCore::FetchBody::fulfillTextPromise): Helper routine.
(WebCore::FetchBody::loadedAsArrayBuffer): Updated to handle storing of data as a buffer.
(WebCore::FetchBody::loadedAsText):
(WebCore::FetchBody::bodyForInternalRequest): Helper routine to generate the request body data to be sent as part of the fetch request.
(WebCore::FetchBody::extractFromText):
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::loadingBody):
(WebCore::FetchBody::FetchBody):
* Modules/fetch/FetchBodyOwner.cpp:
(WebCore::FetchBodyOwner::loadBlob): Updated to cope with the change that FetchLoader::start does not return a boolean anymore
but will directly call failure callbacks.
(WebCore::FetchBodyOwner::loadedBlobAsText): Moving it closer to other blob loading routines.
(WebCore::FetchBodyOwner::finishBlobLoading):
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::body):
(WebCore::FetchBodyOwner::loadedBlobAsArrayBuffer):
* Modules/fetch/FetchHeaders.cpp:
(WebCore::FetchHeaders::fill):
(WebCore::FetchHeaders::filterAndFill): Helper routine to fill headers from a HTTPHeaderMap after being filtered.
* Modules/fetch/FetchHeaders.h:
(WebCore::FetchHeaders::internalHeaders):
* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
(WebCore::FetchLoader::didFailRedirectCheck):
* Modules/fetch/FetchLoader.h:
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::internalRequest): Routine used to create the ResourceRequest transmitted to ThreadableLoader.
       * Modules/fetch/FetchRequest.h:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::fetch): Start fetching by creating a FetchLoader based on passed request.
(WebCore::FetchResponse::BodyLoader::didSucceed): FetchLoader callback.
(WebCore::FetchResponse::BodyLoader::didFail): Ditto.
(WebCore::FetchResponse::BodyLoader::BodyLoader): Ditto.
(WebCore::FetchResponse::BodyLoader::didReceiveResponse): Ditto.
(WebCore::FetchResponse::BodyLoader::didFinishLoadingAsArrayBuffer): Ditto.
(WebCore::FetchResponse::BodyLoader::start): Starting fetch loader.
(WebCore::FetchResponse::BodyLoader::stop): Stopping fetch loader.
(WebCore::FetchResponse::stop): Stop loader if any.
* Modules/fetch/FetchResponse.h:
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::doStart: Notifying the loader with an error if verb is not GET.
(WebCore::BlobResourceHandle::notifyResponseOnSuccess): Adding support for Content-Type and Content-Lenth headers.
(WebCore::BlobResourceHandle::createAsync): Removing GET verb check.

LayoutTests:

* TestExpectations: Removed flaky test expectations.
* http/tests/fetch/closing-while-fetching-expected.txt: Added.
* http/tests/fetch/closing-while-fetching.html: Added.
* http/tests/fetch/get-response-body-while-loading-expected.txt: Added.
* http/tests/fetch/get-response-body-while-loading.html: Added.
* http/tests/resources/download-json-with-delay.php: Added.
* platform/gtk/imported/w3c/web-platform-tests/fetch/api/basic/request-headers-expected.txt: Added.

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

3 years agoRemove virtual inheritance from SVGTransformable.
akling@apple.com [Thu, 24 Mar 2016 16:20:44 +0000 (16:20 +0000)]
Remove virtual inheritance from SVGTransformable.
<https://webkit.org/b/155837>

Reviewed by Anders Carlsson.

Nothing else inherits SVGLocatable, so make the inheritance non-virtual.

* svg/SVGTransformable.h:

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

3 years ago[ES6] Add Proxy based tests for RegExp.prototype[@@match]
msaboff@apple.com [Thu, 24 Mar 2016 16:13:46 +0000 (16:13 +0000)]
[ES6] Add Proxy based tests for RegExp.prototype[@@match]
https://bugs.webkit.org/show_bug.cgi?id=155807

Reviewed by Saam Barati.

Added new test that uses Proxy to verify RegExp.prototype[@@match] processing
conforms to the ES6 standard

Modified builtin RegExp.prototype[@@match] to be ES6 spec conformant.

Updated es6.yaml as Proxy_internal_get_calls_RegExp.prototype[Symbol.match].js now passes.

* builtins/RegExpPrototype.js:
(match):
* tests/es6.yaml: Updated.
* tests/stress/regexp-match-proxy.js: Added.
(assert):
(let.getProxyNullExec.new.Proxy):
(let.getSetProxyNullExec.new.Proxy):
(get resetTracking):
(let.getSetProxyMatches_s.new.Proxy):
(set get getSetProxyNullExec):
(let.getSetProxyMatches_tx_Greedy.new.Proxy):
(set get getSetProxyMatches_s):
(let.getSetProxyMatchesUnicode_digit_nonGreedy.new.Proxy):
(set get getSetProxyMatches_tx_Greedy):

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

3 years ago[ES6] Greedy unicode RegExp's don't properly backtrack past non BMP characters
msaboff@apple.com [Thu, 24 Mar 2016 14:19:37 +0000 (14:19 +0000)]
[ES6] Greedy unicode RegExp's don't properly backtrack past non BMP characters
https://bugs.webkit.org/show_bug.cgi?id=155829

Reviewed by Saam Barati.

Source/JavaScriptCore:

When we backup when matching part of a unicode pattern, we can't just backup one character.
Instead we need to save our start position before trying to match a character and
restore the position if the match fails.  This was done in other places, but wasn't
done for all greedy types.

Fixed matchGlobal() to properly handle advancing past non BMP characters.

* runtime/RegExpObject.cpp:
(JSC::RegExpObject::matchGlobal):
* runtime/RegExpObjectInlines.h:
(JSC::RegExpObject::advanceStringUnicode):
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::matchCharacterClass):
(JSC::Yarr::Interpreter::matchDisjunction):

LayoutTests:

Added new test cases.

* js/regexp-unicode-expected.txt:
* js/script-tests/regexp-unicode.js:

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

3 years agoUnreviewed EFL gardening.
gyuyoung.kim@webkit.org [Thu, 24 Mar 2016 13:27:30 +0000 (13:27 +0000)]
Unreviewed EFL gardening.

Unskip passing tests, which have been passed a long time ago.
Failed to track correct revision on EFL buildbot.

* platform/efl/TestExpectations:

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

3 years agoRemove DeferredWrapper::resolve<Vector<unsigned char>>
youenn.fablet@crf.canon.fr [Thu, 24 Mar 2016 10:36:45 +0000 (10:36 +0000)]
Remove DeferredWrapper::resolve<Vector<unsigned char>>
https://bugs.webkit.org/show_bug.cgi?id=154849

Reviewed by Darin Adler.

Adding fulfillPromiseWithArrayBuffer to resolve a promise with an ArrayBuffer.
If the ArrayBuffer is null, the promise is rejected with an OutOfMemory exception.

Not covered by tests since we would need to make tryCreate return null on failing allocation.

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::processIfEmptyOrDisturbed):
(WebCore::FetchBody::loadedAsArrayBuffer):
* bindings/js/JSDOMPromise.cpp:
(WebCore::fulfillPromiseWithArrayBuffer):
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::resolve<JSC::JSValue>): Deleted.
(WebCore::DeferredWrapper::resolve): Deleted.
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::JSSubtleCrypto::encrypt):
(WebCore::JSSubtleCrypto::decrypt):
(WebCore::JSSubtleCrypto::sign):
(WebCore::JSSubtleCrypto::digest):
(WebCore::JSSubtleCrypto::exportKey):
(WebCore::JSSubtleCrypto::wrapKey):

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

3 years ago[JSC] In some cases, the integer range optimization phase never converges
commit-queue@webkit.org [Thu, 24 Mar 2016 09:02:55 +0000 (09:02 +0000)]
[JSC] In some cases, the integer range optimization phase never converges
https://bugs.webkit.org/show_bug.cgi?id=155828
rdar://problem/25155460

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-03-24
Reviewed by Filip Pizlo.

In certain conditions, the integer range optimization phase continuously
changes the representation of the same truth, preventing it from
converging to a stable state.

The bug starts by having the same ground truth incomming into a block
in different valid forms. For example, you can have x < 42 coming as:
    1) x < 42
    2) x < 41 + 1
    3) x < 43 - 1

Having those 3 alone coming from predecessors would be okay, we would
just accumulate them. The problem is when you have a combination
of rule that filter out the previously obtained truth, then add a new
form of the same truth.

Let's use the test case as an example. We have two incoming blocks:
    Block #1:
      -i < 42
      -i != 41
    Block #2:
      -i < 41
      -i == 42 - 42 (i == 0 refining the rule above).

Let say that our conditions at head are now [i < 41, i < 42 - 1].

If we merge block #2:
      -i < 42 and i < 41      -> i < 42
      -i < 42 and i < 42 - 1  -> i < 42
      -i != 41 and i < 41     -> i < 41
      -i != 41 and i < 42 - 1 -> nothing

The new head is: [i < 41, i < 42]

If we merge block #1:
      -i < 41 and i < 41       -> i < 41
      -i < 41 and i < 42       -> i < 42
      -i == 42 - 42 and i < 41 -> (i < 41 and i < 42 - 1)
      -i == 42 - 42 and i < 42 -> i < 42

After filter, we are back to [i < 41, i < 42 - 1].

There are several variations of this idea where the same truth
rotate different forms with each merge().

One possible solution is to make filter() more aggressive
to avoid the better form occuring at merge(). I'll probably
do that at some point but that seems fragile since the same
problem could reappear if merge() is later improved.

For this patch, I went with a more generic solution after
merge(): if the generated form is equivalent to one that
previously existed at head, pick the existing form.

In the previous example, what happens is we only have
either [i < 41] or [i < 42 - 1] but never both simultaneously.

* dfg/DFGIntegerRangeOptimizationPhase.cpp:
* tests/stress/integer-range-optimization-constant-representation-1.js: Added.
* tests/stress/integer-range-optimization-constant-representation-2.js: Added.
Two variation. One timeout in release because of the additional flags.
The other is gets more type of run but only assert in debug.

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

3 years agoWeb Inspector: Miscellaneous performance fixes in Timeline recording
commit-queue@webkit.org [Thu, 24 Mar 2016 08:10:01 +0000 (08:10 +0000)]
Web Inspector: Miscellaneous performance fixes in Timeline recording
https://bugs.webkit.org/show_bug.cgi?id=155832

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-24
Reviewed by Timothy Hatcher.

* UserInterface/Models/CallingContextTree.js:
(WebInspector.CCTNode.prototype.hasChildren):
No need to allocate an array with all of the properties, we can just
check if there is at least one property using a short circuit for..in.
Performance was always faster for empty, small, and large objects
in micro benchmarks.

* UserInterface/Views/DataGrid.js:
(WebInspector.DataGrid.prototype.layout):
Avoid causing DOM layout when positioning resizers. They only need
a layout if we are resizing the DataGrid, or the initial layout.

* UserInterface/Views/NavigationBar.js:
(WebInspector.NavigationBar):
(WebInspector.NavigationBar.prototype.needsLayout):
(WebInspector.NavigationBar.prototype.layout):
Avoid causing DOM layout every View layout. In fact, only do a
DOM layout when someone has triggered a needsLayout on this
navigation bar. A basic dirty layout (triggered by a parent)
should not have caused us to resize.

* UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js:
* UserInterface/Views/LayoutTimelineOverviewGraph.js:
(WebInspector.LayoutTimelineOverviewGraph.prototype.layout):
* UserInterface/Views/MemoryTimelineOverviewGraph.js:
(WebInspector.MemoryTimelineOverviewGraph.prototype.reset):
(WebInspector.MemoryTimelineOverviewGraph.prototype._updateLegend):
* UserInterface/Views/NetworkTimelineOverviewGraph.js:
* UserInterface/Views/RenderingFrameTimelineOverviewGraph.js:
(WebInspector.RenderingFrameTimelineOverviewGraph.prototype.layout):
* UserInterface/Views/ScriptTimelineOverviewGraph.js:
Avoid doing any work in non-visible graphs. This was very common
because the RenderingFrameTimelineOverviewGraph is never visible
when the other timeline graphs are, but was performing lots of work.

* UserInterface/Views/MemoryCategoryView.js:
(WebInspector.MemoryCategoryView.prototype.clear):
(WebInspector.MemoryCategoryView.prototype._updateDetails):
(WebInspector.MemoryCategoryView):
* UserInterface/Views/MemoryTimelineView.js:
(WebInspector.MemoryTimelineView.prototype.reset):
(WebInspector.MemoryTimelineView.prototype._updateUsageLegend):
(WebInspector.MemoryTimelineView.prototype._updateMaxComparisonLegend):
Cache values to avoid textContent calls even if the content did not change.
This reduces unnecessary work when the values wouldn't change.

* UserInterface/Views/TimelineRecordBar.js:
(WebInspector.TimelineRecordBar.createCombinedBars):
(WebInspector.TimelineRecordBar.prototype.set records):
Revert to fast loop and as this code path is very hot and for..of iteration
was showing up in profiles. Remove assert which seems rather pointless but
showed up in profiles.

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

3 years agoWeb Inspector: Large repaints while typing in the console tab
nvasilyev@apple.com [Thu, 24 Mar 2016 07:13:05 +0000 (07:13 +0000)]
Web Inspector: Large repaints while typing in the console tab
https://bugs.webkit.org/show_bug.cgi?id=155627
<rdar://problem/25234875>

Reviewed by Timothy Hatcher.

Use a `position: absolute` workaround to reduce large repaint areas caused by flexbox.

* UserInterface/Views/LogContentView.css:
(body.selected-tab-console #content):
This selector must only affect the console tab as it breaks sidebars in other tabs.

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
(WebInspector._tabBarItemSelected):
* UserInterface/Views/TabBar.js:
(WebInspector.TabBar.prototype.set selectedTabBarItem):
Add "selected-tab-console" class to <body> when the console tab is selected.

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

3 years agoWeb Inspector: Timeline range selection changes with ProfileView should not cause...
commit-queue@webkit.org [Thu, 24 Mar 2016 06:32:27 +0000 (06:32 +0000)]
Web Inspector: Timeline range selection changes with ProfileView should not cause navigation bar items to flicker
https://bugs.webkit.org/show_bug.cgi?id=155834

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-23
Reviewed by Timothy Hatcher.

* UserInterface/Views/ProfileView.js:
(WebInspector.ProfileView.prototype._recreate):
The only reason our selection path components would change is if we
had focus nodes before and do not anymore.

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

3 years agowebkit-patch failed to open pretty diff on Windows
commit-queue@webkit.org [Thu, 24 Mar 2016 05:16:56 +0000 (05:16 +0000)]
webkit-patch failed to open pretty diff on Windows
https://bugs.webkit.org/show_bug.cgi?id=155827

Patch by Bill Ming <mbbill@gmail.com> on 2016-03-23
Reviewed by Alex Christensen.

* Scripts/webkitpy/tool/steps/confirmdiff.py:
(ConfirmDiff._show_pretty_diff):

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

3 years agoFixed ninja build path.
commit-queue@webkit.org [Thu, 24 Mar 2016 05:13:35 +0000 (05:13 +0000)]
Fixed ninja build path.
https://bugs.webkit.org/show_bug.cgi?id=155796

Patch by Bill Ming <mbbill@gmail.com> on 2016-03-23
Reviewed by Alex Christensen.

* Tools/Scripts/build-webkit:

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

3 years agoDelete a file that was supposed to be removed in r198614 for real.
rniwa@webkit.org [Thu, 24 Mar 2016 03:31:54 +0000 (03:31 +0000)]
Delete a file that was supposed to be removed in r198614 for real.

* unit-tests/resources/v3-models.js: Removed.

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

3 years agoAdd a model for parsing buildbot JSON with unit tests
rniwa@webkit.org [Thu, 24 Mar 2016 03:25:10 +0000 (03:25 +0000)]
Add a model for parsing buildbot JSON with unit tests
https://bugs.webkit.org/show_bug.cgi?id=155814

Reviewed by Joseph Pecoraro.

Added BuildbotSyncer and BuildbotBuildEntry classes to parse buildbot JSON files with unit tests.
They will be used in the new syncing scripts to improve A/B testing.

* public/v3/models/build-request.js:
(BuildRequest):
* tools/js/buildbot-syncer.js: Added.
(BuildbotBuildEntry): Added.
(BuildbotBuildEntry.prototype.slaveName): Added.
(BuildbotBuildEntry.prototype.buildRequestId): Added.
(BuildbotBuildEntry.prototype.isInProgress): Added.
(BuildbotSyncer): Added.
(BuildbotSyncer.prototype.testPath): Added.
(BuildbotSyncer.prototype.builderName): Added.
(BuildbotSyncer.prototype.platformName): Added.
(BuildbotSyncer.prototype.fetchPendingRequests): Added.
(BuildbotSyncer.prototype._propertiesForBuildRequest): Added.
(BuildbotSyncer.prototype._revisionSetFromRootSetWithExclusionList): Added.
(BuildbotSyncer._loadConfig): Added.
(BuildbotSyncer._validateAndMergeConfig): Added.
(BuildbotSyncer._validateAndMergeProperties): Added.
* tools/js/v3-models.js: Copied from unit-tests/resources/v3-models.js.
(beforeEach): Deleted since this only defined inside mocha.
* unit-tests/analysis-task-tests.js:
* unit-tests/buildbot-syncer-tests.js: Added.
(sampleiOSConfig):
(createSampleBuildRequest):
(.smallConfiguration):
* unit-tests/measurement-adaptor-tests.js:
* unit-tests/measurement-set-tests.js:
* unit-tests/resources/mock-v3-models.js: Renamed from unit-tests/resources/v3-models.js.
(beforeEach):
* unit-tests/test-groups-tests.js:
(sampleTestGroup):

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

3 years agoCSP: Simplify logic for checking policies
dbates@webkit.org [Thu, 24 Mar 2016 02:41:28 +0000 (02:41 +0000)]
CSP: Simplify logic for checking policies
https://bugs.webkit.org/show_bug.cgi?id=155817
<rdar://problem/25326546>

Reviewed by Zalan Bujtas.

Consolidate the various static template functions into a single function called ContentSecurityPolicy::allPoliciesAllow()
that tests whether a resource request when evaluated with respect to a directive (given as a ContentSecurityPolicyDirectiveList
pointer-to-member function) violates any of the CSPs that were delivered with the document.

No functionality changed. So, no new tests.

* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allPoliciesAllowHashFromContent): Formerly name isAllowedByAllWithHash. Made it
a member function so that we query for the document encoding instead of taking it as an argument. Modified
it to take a predicate function to pass it to allPoliciesAllow().
(WebCore::ContentSecurityPolicy::allowJavaScriptURLs): Modified to use ContentSecurityPolicy::allPoliciesAllow().
(WebCore::ContentSecurityPolicy::allowInlineEventHandlers): Ditto.
(WebCore::ContentSecurityPolicy::allowScriptWithNonce): Ditto.
(WebCore::ContentSecurityPolicy::allowStyleWithNonce): Ditto.
(WebCore::ContentSecurityPolicy::allowInlineScript): Modified to use ContentSecurityPolicy::allPoliciesAllow() and
ContentSecurityPolicy::allPoliciesAllowHashFromContent().
(WebCore::ContentSecurityPolicy::allowInlineStyle): Ditto.
(WebCore::ContentSecurityPolicy::allowEval): Modified to use ContentSecurityPolicy::allPoliciesAllow().
(WebCore::ContentSecurityPolicy::allowFrameAncestors): Ditto.
(WebCore::ContentSecurityPolicy::allowPluginType): Ditto.
(WebCore::ContentSecurityPolicy::allowScriptFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowObjectFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowChildFrameFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowChildContextFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowImageFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowStyleFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowFontFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowMediaFromSource): Ditto.
(WebCore::ContentSecurityPolicy::allowConnectToSource): Ditto.
(WebCore::ContentSecurityPolicy::allowFormAction): Ditto.
(WebCore::ContentSecurityPolicy::allowBaseURI): Ditto.
(WebCore::isAllowedByAllWithFrame): Deleted.
(WebCore::isAllowedByAll): Deleted.
(WebCore::isAllowedByAllWithState): Deleted.
(WebCore::isAllowedByAllWithContext): Deleted.
(WebCore::isAllowedByAllWithNonce): Deleted.
(WebCore::isAllowedByAllWithHash): Deleted.
(WebCore::isAllowedByAllWithHashFromContent): Deleted.
(WebCore::isAllowedByAllWithURL): Deleted.
(WebCore::ContentSecurityPolicy::documentEncoding): Deleted. Incorporated its functionality into ContentSecurityPolicy::allPoliciesAllowHashFromContent().
(WebCore::ContentSecurityPolicy::isActive): Deleted. This function has been unused since the removal of the CSP script
interface in <http://trac.webkit.org/changeset/197142>.
* page/csp/ContentSecurityPolicy.h:
(WebCore::ContentSecurityPolicy::allPoliciesAllow): Added. Returns whether the predicate function evaluates to true
for all CSP policies.

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

3 years agoUpdate focus and leaves tests
jonlee@apple.com [Thu, 24 Mar 2016 02:40:36 +0000 (02:40 +0000)]
Update focus and leaves tests
https://bugs.webkit.org/show_bug.cgi?id=155825

Reviewed by Simon Fraser.

Particles would improperly disappear, before they were fully off stage. Update the calculation.
* Animometer/tests/dom/resources/leaves.js:
* Animometer/tests/master/resources/leaves.js:

* Animometer/tests/master/focus.html: Update the center element styling.
* Animometer/tests/master/resources/focus.js:
(FocusElement.Utilities.createClass): Give enough space in the container for each particle for the blur
to spread. It should be about 3x more space than the blur radius on each side.
(Stage.call.initialize): Ditto for the center element.

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

3 years agoUpdate support for other platforms
jonlee@apple.com [Thu, 24 Mar 2016 02:40:03 +0000 (02:40 +0000)]
Update support for other platforms
https://bugs.webkit.org/show_bug.cgi?id=155824

Reviewed by Simon Fraser.

* Animometer/resources/debug-runner/animometer.css: Remove extraneous media query. All of it should
be handled in the release stylesheet.
* Animometer/resources/debug-runner/animometer.js: Add support for browsers that return an HTMLCollection
when retrieving radio elements with a name, instead of the selected value.
* Animometer/resources/runner/animometer.css: Adjust the queries for devices of varying widths.
(.frame-container): Move overflow:hidden to #stage.
* Animometer/tests/master/resources/stage.css: Consolidate into tests/resources/stage.css.
* Animometer/tests/resources/stage.css:
(body): Remove overflow:hidden.
(#stage): Set overflow:hidden here.
(#center-text): Moved from master/resources/stage.css.

Update stylesheet hrefs.
* Animometer/tests/master/canvas-stage.html:
* Animometer/tests/master/focus.html:
* Animometer/tests/master/leaves.html:
* Animometer/tests/master/multiply.html:
* Animometer/tests/master/particles.html:
* Animometer/tests/master/text.html: Adjust text size to fit in the device screen.

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

3 years agoMake the benchmark require device to be in landscape orientation
jonlee@apple.com [Thu, 24 Mar 2016 02:08:13 +0000 (02:08 +0000)]
Make the benchmark require device to be in landscape orientation
https://bugs.webkit.org/show_bug.cgi?id=155822
rdar://problem/25258650

Reviewed by Ryosuke Niwa.

Check that the device is in landscape orientation. If not, disable the button to start it,
and show a warning message.

* Animometer/developer.html: Add a message about how the browser should be set up. Include a
warning message that appears if the orientation is incorrect on mobile devices.
* Animometer/index.html: Ditto.

* Animometer/resources/debug-runner/animometer.css: Migrate the .hidden rule into the release
stylesheet. Update the style to accommodate the new UI.
* Animometer/resources/runner/animometer.css:

* Animometer/resources/runner/animometer.js:
(window.benchmarkController.initialize): Add the orientation listener is needed.
(window.benchmarkController.addOrientationListenerIfNecessary): Only mobile devices need this. Check
to see for support of window.orientation.
(window.benchmarkController._orientationChanged): Toggle the warning based on whether we match the
landscape query. Set a state variable, which is needed for the debug harness. Call updateStartButtonState.
(window.benchmarkController.updateStartButtonState):
* Animometer/resources/debug-runner/animometer.js: Change _updateStartButtonState to return
a boolean about whether at least one test is selected. That will be used in
benchmarkController.updateStartButtonState(). Move the load event listener to the release version.
(window.benchmarkController.updateStartButtonState): Override the release version, and also check
that at least one test is selected.

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

3 years agoMedia elements allowed to play without a user gesture, but requiring fullscreen playb...
jer.noble@apple.com [Thu, 24 Mar 2016 00:43:39 +0000 (00:43 +0000)]
Media elements allowed to play without a user gesture, but requiring fullscreen playback, should not be allowed to autoplay.
https://bugs.webkit.org/show_bug.cgi?id=155599

Reviewed by Darin Adler.

Test: media/video-autoplay-allowed-but-fullscreen-required.html

Entering fullscreen should always require a user gesture.

* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted):

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

3 years ago[ios-sim] RequiresUserActionForPlaybackTest.DoesNotRequireUserActionForMediaPlayback...
jer.noble@apple.com [Thu, 24 Mar 2016 00:42:04 +0000 (00:42 +0000)]
[ios-sim] RequiresUserActionForPlaybackTest.DoesNotRequireUserActionForMediaPlayback and RequiresUserActionForVideoButNotAudioPlayback failing
https://bugs.webkit.org/show_bug.cgi?id=155764

Reviewed by Eric Carlson.

Remove the requirement for media elements to have webkit-playsinline attributes on iOS.

* TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm:
(RequiresUserActionForPlaybackTest::SetUp):

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

3 years agoUnreviewed, rolling out r198538.
commit-queue@webkit.org [Thu, 24 Mar 2016 00:13:24 +0000 (00:13 +0000)]
Unreviewed, rolling out r198538.
https://bugs.webkit.org/show_bug.cgi?id=155819

Broke two API tests on iOS simulator (Requested by ap on
#webkit).

Reverted changeset:

"Media elements allowed to play without a user gesture, but
requiring fullscreen playback, should not be allowed to
autoplay."
https://bugs.webkit.org/show_bug.cgi?id=155599
http://trac.webkit.org/changeset/198538

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

3 years agobmalloc: Added an Object helper class
ggaren@apple.com [Thu, 24 Mar 2016 00:12:05 +0000 (00:12 +0000)]
bmalloc: Added an Object helper class
https://bugs.webkit.org/show_bug.cgi?id=155818

Reviewed by Gavin Barraclough.

Object is an abstraction that breaks out a void* into its component
metadata pointers.

This is slightly faster than recomputing them, and it enables a future
patch in which Object will tell us whether it is small or large.

* bmalloc.xcodeproj/project.pbxproj: Added to the project.

* bmalloc/Allocator.cpp:
(bmalloc::Allocator::reallocate): Use Object to compute size.

* bmalloc/Deallocator.cpp:
(bmalloc::Deallocator::processObjectLog):
* bmalloc/Heap.cpp:
(bmalloc::Heap::allocateSmallPage):
(bmalloc::Heap::deallocateSmallLine):
* bmalloc/Heap.h:
(bmalloc::Heap::derefSmallLine): Use Object to deallocate.

* bmalloc/Object.h: Added.
(bmalloc::Object::Object):
(bmalloc::Object::chunk):
(bmalloc::Object::line):
(bmalloc::Object::page): Helper class to break out a void* into its
component metadata pointers.

* bmalloc/SmallChunk.h:
(bmalloc::SmallChunk::SmallChunk): SmallPage::get doesn't exist anymore
so we use our new helper functions instead.

(bmalloc::SmallChunk::offset):
(bmalloc::SmallChunk::object):
(bmalloc::SmallChunk::page):
(bmalloc::SmallChunk::line):
(bmalloc::SmallLine::begin):
(bmalloc::SmallLine::end):
(bmalloc::SmallPage::begin): New helpers that operate on the data
stored in Object.

(bmalloc::SmallLine::get): Deleted.
(bmalloc::SmallPage::get): Deleted.

* bmalloc/SmallLine.h:
(bmalloc::SmallLine::refCount): Added a default ref value for convenience.

* bmalloc/SmallPage.h:
(bmalloc::SmallPage::SmallPage):

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

3 years agoWeb Inspector: Allow clicking the Timeline in Editing Mode to toggle the checkbox
commit-queue@webkit.org [Wed, 23 Mar 2016 23:47:35 +0000 (23:47 +0000)]
Web Inspector: Allow clicking the Timeline in Editing Mode to toggle the checkbox
https://bugs.webkit.org/show_bug.cgi?id=155815

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-23
Reviewed by Timothy Hatcher.

* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview.prototype._startEditingInstruments):
Remove unused variable.

* UserInterface/Views/TimelineTreeElement.js:
(WebInspector.TimelineTreeElement.prototype.onattach):
(WebInspector.TimelineTreeElement.prototype._clickHandler):
Make clicking on the tree element toggle the checkbox.

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

3 years agoCrash when using KVO from within -[WebView initWithCoder:]
andersca@apple.com [Wed, 23 Mar 2016 23:47:29 +0000 (23:47 +0000)]
Crash when using KVO from within -[WebView initWithCoder:]
https://bugs.webkit.org/show_bug.cgi?id=155816
rdar://problem/17073265

Reviewed by Dan Bernstein.

Source/WebKit/mac:

Get rid of the observationInfo getter and setter. It's not clear why they were added (in 2003),
and the methods on NSObject are good enough for us.

* WebView/WebView.mm:
(-[WebView setObservationInfo:]): Deleted.
(-[WebView observationInfo]): Deleted.
* WebView/WebViewData.h:

Tools:

Add test.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/EarlyKVOCrash.mm: Added.
(-[EarlyKVOCrashResponder initWithWebView:]):
(-[EarlyKVOCrashResponder initWithCoder:]):
(-[EarlyKVOCrashResponder dealloc]):
(-[EarlyKVOCrashResponder encodeWithCoder:]):
(TestWebKitAPI::TEST):

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

3 years agoWeb Inspector: Timeline Tab sometimes restores as blank
commit-queue@webkit.org [Wed, 23 Mar 2016 23:42:18 +0000 (23:42 +0000)]
Web Inspector: Timeline Tab sometimes restores as blank
https://bugs.webkit.org/show_bug.cgi?id=155811

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-23
Reviewed by Timothy Hatcher.

* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView.prototype.restoreFromCookie):
When early bailing in restore, if there is no content view to restore,
then at least fallback to showing the Overview.

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

3 years agoWeb Inspector: REGRESSION: Timeline Reset does not clear datagrids
commit-queue@webkit.org [Wed, 23 Mar 2016 22:45:55 +0000 (22:45 +0000)]
Web Inspector: REGRESSION: Timeline Reset does not clear datagrids
https://bugs.webkit.org/show_bug.cgi?id=155804

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-23
Reviewed by Timothy Hatcher.

* UserInterface/Views/HeapAllocationsTimelineView.js:
(WebInspector.HeapAllocationsTimelineView.prototype.shown):
(WebInspector.HeapAllocationsTimelineView.prototype.hidden):
(WebInspector.HeapAllocationsTimelineView.prototype.closed):
(WebInspector.HeapAllocationsTimelineView.prototype.reset):
Although we don't use the popover features of TimelineDataGrid,
be a good citizen and call methods on the datagrid.

* UserInterface/Views/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView.prototype.reset):
Clear the datagrid on reset.

* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype.reset):
Clear the datagrid on reset.

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

3 years agoWeb Inspector: Uncaught exceptions closing Timeline tab
commit-queue@webkit.org [Wed, 23 Mar 2016 22:45:15 +0000 (22:45 +0000)]
Web Inspector: Uncaught exceptions closing Timeline tab
https://bugs.webkit.org/show_bug.cgi?id=155805

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-03-23
Reviewed by Timothy Hatcher.

* UserInterface/Views/ScriptClusterTimelineView.js:
(WebInspector.ScriptClusterTimelineView.prototype._scriptClusterViewCurrentContentViewDidChange):
Gracefully handle if there is no content view.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype.closed): Deleted.
Fix typo.

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

3 years agoUnreviewed, rolling out r198582.
commit-queue@webkit.org [Wed, 23 Mar 2016 22:33:17 +0000 (22:33 +0000)]
Unreviewed, rolling out r198582.
https://bugs.webkit.org/show_bug.cgi?id=155812

"It broke debugging in the web inspector" (Requested by
saamyjoon on #webkit).

Reverted changeset:

"We should not disable inlining when the debugger is enabled"
https://bugs.webkit.org/show_bug.cgi?id=155741
http://trac.webkit.org/changeset/198582

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

3 years agoChange the paint count indicator to indicate whether a layer is opaque
simon.fraser@apple.com [Wed, 23 Mar 2016 22:27:42 +0000 (22:27 +0000)]
Change the paint count indicator to indicate whether a layer is opaque
https://bugs.webkit.org/show_bug.cgi?id=155810

Reviewed by Tim Horton.

In non-opaque layers, give the paint count indicator a diagonal top left corner. Being
able to see layer opaqueness helps diagnose bugs.

Also use CGContextStateSaver, and move the indicator in by a pixel to overlap less
with the layer border.

* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator):

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

3 years agoAdd unit tests for test-group.js
rniwa@webkit.org [Wed, 23 Mar 2016 21:55:55 +0000 (21:55 +0000)]
Add unit tests for test-group.js
https://bugs.webkit.org/show_bug.cgi?id=155781

Reviewed by Joseph Pecoraro.

Added unit tests for test-group.js that would have caught regressions fixed in r198503.

* public/v3/components/chart-pane-base.js:
(ChartPaneBase.prototype._renderAnnotations): Added a forgotten break statement.
* public/v3/models/build-request.js:
(BuildRequest.prototype.setResult):
(BuildRequest):
* public/v3/models/test-group.js:
* unit-tests/measurement-set-tests.js: Use ./resources/v3-models.js to reduce the code duplication.
* unit-tests/resources/v3-models.js: Import more stuff from v3 models.
(beforeEach):
* unit-tests/test-groups-tests.js: Added. Added some unit tests for TestGroup.
(sampleTestGroup):
(.testGroupWithStatusList):

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

3 years agoASSERTION FAILED: y2 >= y1 in WebCore::RenderElement::drawLineForBoxSide
zalan@apple.com [Wed, 23 Mar 2016 21:40:40 +0000 (21:40 +0000)]
ASSERTION FAILED: y2 >= y1 in WebCore::RenderElement::drawLineForBoxSide
https://bugs.webkit.org/show_bug.cgi?id=155791

Reviewed by Simon Fraser.

With certain combination of border rect and adjacent width, we could end up with an empty final rect.
This patch ensures that we don't try to paint this empty rect.

Source/WebCore:

Test: fast/borders/empty-outline-border-assert.html

* rendering/RenderElement.cpp:
(WebCore::RenderElement::drawLineForBoxSide):

LayoutTests:

* fast/borders/empty-outline-border-assert-expected.txt: Added.
* fast/borders/empty-outline-border-assert.html: Added.

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

3 years agoTeach kill-old-processes about perl 5.18.
lforschler@apple.com [Wed, 23 Mar 2016 21:29:33 +0000 (21:29 +0000)]
Teach kill-old-processes about perl 5.18.

Reviewed by Alexey Proskuryakov

* BuildSlaveSupport/kill-old-processes:
(main):

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

3 years agoScreen queries should query the exact screen, not a default
dino@apple.com [Wed, 23 Mar 2016 21:20:38 +0000 (21:20 +0000)]
Screen queries should query the exact screen, not a default
https://bugs.webkit.org/show_bug.cgi?id=155806
<rdar://problem/25322916>

Reviewed by Simon Fraser.

Some of our media queries were using helper functions that
would query the capabilities of the deepest screen, rather
than the currently used screen. I changed them to use
the existing helper function (that works with WebKit 2)
and comment in some other helpers why a generic check is
ok.

Covered by the existing tests.

* platform/mac/PlatformScreenMac.mm:
(WebCore::screenDepth): Use the helper function.
(WebCore::screenDepthPerComponent):
(WebCore::screenIsMonochrome): Move these and make a comment.
(WebCore::screenHasInvertedColors):

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

3 years agobmalloc: process the object log before asking for new memory
ggaren@apple.com [Wed, 23 Mar 2016 21:07:35 +0000 (21:07 +0000)]
bmalloc: process the object log before asking for new memory
https://bugs.webkit.org/show_bug.cgi?id=155801

Reviewed by Gavin Barraclough.

This is a step toward merging large and small objects: In future, if we
have large objects in the log, we need to process them right away to
avoid pushing up peak memory use.

But it also appears to be a speedup and memory use improvement now.

* bmalloc/Allocator.cpp:
(bmalloc::Allocator::allocate):
(bmalloc::Allocator::refillAllocatorSlowCase):
(bmalloc::Allocator::allocateLarge): Process the log before asking for
more memory.

* bmalloc/Deallocator.cpp:
(bmalloc::Deallocator::processObjectLog):
(bmalloc::Deallocator::deallocateSlowCase):
* bmalloc/Deallocator.h: Provide a public API for processing the object log.

* bmalloc/Heap.cpp:
(bmalloc::Heap::allocateSmallPage): Pop fragmented pages from the front
instead of from the back. This resolves a regression on tree_churn
--parallel. Popping from the front gives us the oldest pages. The oldest
pages have had the most time to accumulate free lines. They are therefore
the least fragmented on average.

* bmalloc/List.h:
(bmalloc::List::popFront):
(bmalloc::List::insertAfter): New API to pop from front.

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

3 years agoMiniBrowser doesn't use accelerated drawing in WebKit2 windows if a WebKit1 window...
timothy_horton@apple.com [Wed, 23 Mar 2016 21:06:36 +0000 (21:06 +0000)]
MiniBrowser doesn't use accelerated drawing in WebKit2 windows if a WebKit1 window was opened first
https://bugs.webkit.org/show_bug.cgi?id=141576
<rdar://problem/25304548>

Reviewed by Simon Fraser.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences init]):
Make the NSUserDefaults key prefix for debug preferences (the only ones read
from NSUserDefaults) "WebKitDebug" instead of just "WebKit" so that they
don't conflict with the names that WebKit1 registers default values for.

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

3 years agoJavaScriptCore ArrayPrototype::join shouldn't cache butterfly when it makes effectful...
msaboff@apple.com [Wed, 23 Mar 2016 21:03:02 +0000 (21:03 +0000)]
JavaScriptCore ArrayPrototype::join shouldn't cache butterfly when it makes effectful calls
https://bugs.webkit.org/show_bug.cgi?id=155776

Reviewed by Saam Barati.

Source/JavaScriptCore:

Array.join ends up calling toString, possibly on some object.  Since these calls
could be effectful and could change the array itself, we can't hold the butterfly
pointer while making effectful calls.  Changed the code to fall back to the general
case when an effectful toString() call might be made.

* runtime/ArrayPrototype.cpp:
(JSC::join):
* runtime/JSStringJoiner.h:
(JSC::JSStringJoiner::appendWithoutSideEffects): New helper that doesn't make effectful
toString() calls.
(JSC::JSStringJoiner::append): Built upon appendWithoutSideEffects.

LayoutTests:

New test.

* js/regress-155776-expected.txt: Added.
* js/regress-155776.html: Added.
* js/script-tests/regress-155776.js: Added.
(fillBigArrayViaToString):
(Function.prototype.toString):

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

3 years agoCSP: Make violation console messages concise and consistent
dbates@webkit.org [Wed, 23 Mar 2016 20:58:40 +0000 (20:58 +0000)]
CSP: Make violation console messages concise and consistent
https://bugs.webkit.org/show_bug.cgi?id=155777
<rdar://problem/25304031>

Reviewed by Darin Adler.

Source/WebCore:

As a first step towards making the log messages that are emitted by the ContentSecurityPolicy object
concise and consistent with the language and formatting used in other WebKit console messages, including
other Content Security Policy messages, make the violation error messages concise and consistent.
Being concise and consistent will help make it straightforward for a person to understand the reason
for the violation by taking advantage of their familiarity with the language and formatting seen in
other WebKit console messages.

* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::consoleMessageForViolation): Added. Builds up a console message for violation.
(WebCore::ContentSecurityPolicyDirectiveList::allowJavaScriptURLs): Extract logic for logging a console message/reporting
a violation from ContentSecurityPolicyDirectiveList::checkInlineAndReportViolation() to here and make use of WebCore::consoleMessageForViolation()
to build the actual console message.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineEventHandlers): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineScript): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyle): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowEval): Extract logic for logging a console message/reporting
a violation from ContentSecurityPolicyDirectiveList::checkEvalAndReportViolation() to here and make use of WebCore::consoleMessageForViolation()
to build the actual console message.
(WebCore::ContentSecurityPolicyDirectiveList::allowPluginType): Extract logic for logging a console message/reporting
a violation from ContentSecurityPolicyDirectiveList::checkMediaTypeAndReportViolation() to here and make use of WebCore::consoleMessageForViolation()
to build the actual console message.
(WebCore::ContentSecurityPolicyDirectiveList::allowScriptFromSource): Extract logic for logging a console message/reporting
a violation from ContentSecurityPolicyDirectiveList::checkSourceAndReportViolation() to here and make use of WebCore::consoleMessageForViolation()
to build the actual console message.
(WebCore::ContentSecurityPolicyDirectiveList::allowObjectFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowChildContextFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowChildFrameFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowImageFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowStyleFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowFontFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowMediaFromSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowConnectToSource): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowFormAction): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowBaseURI): Ditto.
(WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Extract logic for logging a console message/reporting
a violation from ContentSecurityPolicyDirectiveList::checkFrameAncestorsAndReportViolation() to here and make use of WebCore::consoleMessageForViolation()
to build the actual console message.
(WebCore::ContentSecurityPolicyDirectiveList::addDirective): Add FIXME comment to log that the frame-src directive is
deprecated. See <https://bugs.webkit.org/show_bug.cgi?id=155773> for more details.
(WebCore::ContentSecurityPolicyDirectiveList::checkEvalAndReportViolation): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkMediaTypeAndReportViolation): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkInlineAndReportViolation): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkSourceAndReportViolation): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkFrameAncestorsAndReportViolation): Deleted.
* page/csp/ContentSecurityPolicyDirectiveList.h:

LayoutTests:

Update expected results to reflect new violation message text.

* fast/workers/worker-inherits-csp-blocks-xhr-expected.txt:
* http/tests/contentextensions/block-cookies-in-csp-report-expected.txt:
* http/tests/contentextensions/block-csp-report-expected.txt:
* http/tests/contentextensions/hide-on-csp-report-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/base-uri-deny-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/child-src/frame-blocked-expected.txt:
...
* http/tests/security/contentSecurityPolicy/xsl-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/xsl-img-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/xsl-redirect-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/xsl-unaffected-by-style-src-1-expected.txt:
* http/tests/security/isolatedWorld/bypass-main-world-csp-for-xhr-expected.txt:
* http/tests/security/isolatedWorld/image-load-should-not-bypass-main-world-csp-expected.txt:
* media/csp-blocks-video-expected.txt:

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

3 years agoWeb Inspector: Quick Open dialog has fuzzy icons at 1x
mattbaker@apple.com [Wed, 23 Mar 2016 20:08:47 +0000 (20:08 +0000)]
Web Inspector: Quick Open dialog has fuzzy icons at 1x
https://bugs.webkit.org/show_bug.cgi?id=155557
<rdar://problem/25200217>

Reviewed by Timothy Hatcher.

New resource icons (documents and clippings) for large  tree items,
for use in the Quick Open dialog's tree outline.

* UserInterface/Images/ClippingCSSLarge.png: Added.
* UserInterface/Images/ClippingCSSLarge@2x.png: Added.
* UserInterface/Images/ClippingGenericLarge.png: Added.
* UserInterface/Images/ClippingGenericLarge@2x.png: Added.
* UserInterface/Images/ClippingJSLarge.png: Added.
* UserInterface/Images/ClippingJSLarge@2x.png: Added.
* UserInterface/Images/DocumentCSSLarge.png: Added.
* UserInterface/Images/DocumentCSSLarge@2x.png: Added.
* UserInterface/Images/DocumentFontLarge.png: Added.
* UserInterface/Images/DocumentFontLarge@2x.png: Added.
* UserInterface/Images/DocumentGenericLarge.png: Added.
* UserInterface/Images/DocumentGenericLarge@2x.png: Added.
* UserInterface/Images/DocumentImageLarge.png: Added.
* UserInterface/Images/DocumentImageLarge@2x.png: Added.
* UserInterface/Images/DocumentJSLarge.png: Added.
* UserInterface/Images/DocumentJSLarge@2x.png: Added.
* UserInterface/Images/DocumentMarkupLarge.png: Added.
* UserInterface/Images/DocumentMarkupLarge@2x.png: Added.
32px icons at 1x and 2x.

* UserInterface/Views/ResourceIcons.css:
(.large .resource-icon .icon):
(.large .resource-icon.resource-type-document .icon):
(.large .resource-icon.resource-type-image .icon):
(.large .resource-icon.resource-type-font .icon):
(.large .resource-icon.resource-type-stylesheet .icon):
(.large .resource-icon.resource-type-script .icon):
(.large .anonymous-script-icon .icon):
(.large .source-map-resource.resource-icon .icon):
(.large .source-map-resource.resource-icon.resource-type-stylesheet .icon):
(.large .source-map-resource.resource-icon.resource-type-script .icon):
Large icon styles.

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

3 years agoArray.prototype native functions' species constructors should work with proxies
keith_miller@apple.com [Wed, 23 Mar 2016 19:42:32 +0000 (19:42 +0000)]
Array.prototype native functions' species constructors should work with proxies
https://bugs.webkit.org/show_bug.cgi?id=155798

Reviewed by Mark Lam.

Before native the species constructors were checking if the this value was a JSArray.
Instead they should look check that the this value returns true on Array.isArray.

* runtime/ArrayPrototype.cpp:
(JSC::speciesConstructArray):
* tests/es6.yaml:
* tests/stress/proxy-array-prototype-methods.js:

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

3 years ago[WebGL] Non-power-of-two texture optimization
bfulgham@apple.com [Wed, 23 Mar 2016 19:21:11 +0000 (19:21 +0000)]
[WebGL] Non-power-of-two texture optimization
https://bugs.webkit.org/show_bug.cgi?id=118409

Reviewed by Dean Jackson.

Source/WebCore:

Based on a patch by Przemyslaw Szymanski  <p.szymanski3@samsung.com>

This patch optimizes usage of handleNPOTTextures. We do not need to
iterate over each texture unit if no black textures were set. This
optimization provides a few more frames per seconds for certain
draw calls.

Tested by:
(1) Existing tests: webgl/resources/webgl_test_files/conformance/textures/texture-npot.html
(2) New test case: fast/canvas/webgl/texture-alternating-npot.html

* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::compressedTexImage2D): Use new helper method.
(WebCore::WebGLRenderingContextBase::validateNPOTTextureLevel): Added.
(WebCore::WebGLRenderingContextBase::drawArrays): Only check texture completeness
if a black texture was used.
(WebCore::WebGLRenderingContextBase::drawElements): Ditto.
(WebCore::WebGLRenderingContextBase::texImage2DBase): Use new helper method.
(WebCore::WebGLRenderingContextBase::validateTexFunc): Ditto.
(WebCore::WebGLRenderingContextBase::checkTextureCompleteness): Return flag to indicate
if a black fallbacktexture was used.
* html/canvas/WebGLRenderingContextBase.h:

LayoutTests:

* fast/canvas/webgl/texture-alternating-npot-expected.txt: Added.
* fast/canvas/webgl/texture-alternating-npot.html: Added.

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

3 years agoBuild fix for a new warning.
ap@apple.com [Wed, 23 Mar 2016 18:00:43 +0000 (18:00 +0000)]
Build fix for a new warning.

* editing/VisibleSelection.cpp: (WebCore::makeSearchRange): Don't move when returning,
as that prevents copy elision.

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

3 years agoUnreviewed: add Keith Rollin to the committers list.
krollin@apple.com [Wed, 23 Mar 2016 16:48:31 +0000 (16:48 +0000)]
Unreviewed: add Keith Rollin to the committers list.

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

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

3 years agoWeb Inspector: String double quoting in the console and elsewhere needs to escape...
timothy@apple.com [Wed, 23 Mar 2016 15:53:52 +0000 (15:53 +0000)]
Web Inspector: String double quoting in the console and elsewhere needs to escape backslash too

https://bugs.webkit.org/show_bug.cgi?id=155752
rdar://problem/25293141

Reviewed by Joseph Pecoraro.

* UserInterface/Base/Utilities.js:
(doubleQuotedString): Escape backslashes too.
* UserInterface/Views/FormattedValue.js:
(WebInspector.FormattedValue.createLinkifiedElementString): Ditto.

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

3 years agoShare style by sharing RenderStyle substructures not the object itself
antti@apple.com [Wed, 23 Mar 2016 14:16:17 +0000 (14:16 +0000)]
Share style by sharing RenderStyle substructures not the object itself
https://bugs.webkit.org/show_bug.cgi?id=155787

Reviewed by Anreas Kling.

The current approach where we share RenderStyle objects between elements leads to lot of awkward and bug-prone code.
Most of the RenderStyle consists of shareable substructures. It is better to just share those.

With this patch we create shared styles with RenderStyle::clone(). Sharing is traced as state in Style::SharingResolver
instead of relying on RenderStyle equality to locate potential sharing cousins.

* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::operator==):

    m_altText was missing from operator==
    This was exposed by TreeResolver::resolveElement change, tested by fast/css/alt-inherit-initial.html

* style/StyleSharingResolver.cpp:
(WebCore::Style::elementHasDirectionAuto):
(WebCore::Style::SharingResolver::resolve):

    Save share results to a map.

(WebCore::Style::SharingResolver::findSibling):
(WebCore::Style::SharingResolver::locateCousinList):

    Instead of traversing we can now just do a hash lookup to locate a candidate cousin list.
    There is no need for recursion anymore, the map covers sharing beyond immediate siblings too.
    Remove most tests here as they have been already covered when sharing occured.

(WebCore::Style::canShareStyleWithControl):
* style/StyleSharingResolver.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::styleForElement):
(WebCore::Style::TreeResolver::resolveElement):

    No need to do forced setting anymore just to support style sharing.

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

3 years agoReduce PassRefPtr uses in editing
gyuyoung.kim@webkit.org [Wed, 23 Mar 2016 14:05:54 +0000 (14:05 +0000)]
Reduce PassRefPtr uses in editing
https://bugs.webkit.org/show_bug.cgi?id=155743

Reviewed by Darin Adler.

Use RefPtr<>&&, raw pointer, or reference in arugments instead of PassRefPtr.
Besides RefPtr is used if function may be able to return nullptr.

* dom/Element.cpp:
(WebCore::Element::setOuterHTML):
(WebCore::Element::setInnerHTML):
* dom/Range.cpp:
(WebCore::Range::createContextualFragment):
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::setInnerHTML):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::wrapContentsInDummySpan):
* editing/CompositeEditCommand.h:
* editing/DictationCommand.cpp:
(WebCore::DictationCommand::insertText):
* editing/SplitTextNodeContainingElementCommand.cpp:
(WebCore::SplitTextNodeContainingElementCommand::doApply):
* editing/TextInsertionBaseCommand.cpp:
(WebCore::TextInsertionBaseCommand::applyTextInsertionCommand):
* editing/TextInsertionBaseCommand.h:
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::deleteSelection):
(WebCore::TypingCommand::deleteKeyPressed):
(WebCore::TypingCommand::forwardDeleteKeyPressed):
(WebCore::TypingCommand::insertText):
(WebCore::TypingCommand::insertLineBreak):
(WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
(WebCore::TypingCommand::insertParagraphSeparator):
(WebCore::TypingCommand::lastTypingCommandIfStillOpenForTyping):
(WebCore::TypingCommand::closeTyping):
(WebCore::TypingCommand::ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping):
* editing/TypingCommand.h:
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::firstRange):
(WebCore::makeSearchRange):
* editing/VisibleSelection.h:
* editing/WrapContentsInDummySpanCommand.cpp:
(WebCore::WrapContentsInDummySpanCommand::WrapContentsInDummySpanCommand):
* editing/WrapContentsInDummySpanCommand.h:
(WebCore::WrapContentsInDummySpanCommand::create):
* editing/atk/FrameSelectionAtk.cpp:
(WebCore::maybeEmitTextFocusChange):
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
* editing/htmlediting.cpp:
(WebCore::createOrderedListElement):
(WebCore::createUnorderedListElement):
(WebCore::createListItemElement):
(WebCore::createTabSpanElement):
* editing/htmlediting.h:
* editing/markup.cpp:
(WebCore::AttributeChange::AttributeChange):
(WebCore::ancestorToRetainStructureAndAppearanceForBlock):
(WebCore::styleFromMatchedRulesAndInlineDecl):
(WebCore::createFragmentForInnerOuterHTML):
(WebCore::createFragmentForTransformToFragment):
(WebCore::createContextualFragment):
* editing/markup.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::insertAdjacentHTML):
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::transformToFragment):

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

3 years agoWe should not disable inlining when the debugger is enabled
sbarati@apple.com [Wed, 23 Mar 2016 09:15:43 +0000 (09:15 +0000)]
We should not disable inlining when the debugger is enabled
https://bugs.webkit.org/show_bug.cgi?id=155741

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

We can enable inlining when the debugger is enabled as long
as we make sure we still jettison the proper CodeBlocks when
a breakpoint is set. This means that for any optimized CodeBlock,
we must ask if any of its inlinees contain the breakpoint that
is being set. If any inlinees do contain the breakpoint, we must
jettison the machine code block that they are a part of.

* debugger/Debugger.cpp:
(JSC::Debugger::toggleBreakpoint):
(JSC::Debugger::applyBreakpoints):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::ByteCodeParser):
(JSC::DFG::ByteCodeParser::setLocal):
(JSC::DFG::ByteCodeParser::flush):
(JSC::DFG::ByteCodeParser::flushForTerminal):
(JSC::DFG::ByteCodeParser::inliningCost):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::Graph):
(JSC::DFG::Graph::~Graph):
* dfg/DFGGraph.h:
(JSC::DFG::Graph::hasDebuggerEnabled): Deleted.
* dfg/DFGStackLayoutPhase.cpp:
(JSC::DFG::StackLayoutPhase::run):
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):

LayoutTests:

* inspector/debugger/breakpoint-with-inlining-expected.txt: Added.
* inspector/debugger/breakpoint-with-inlining.html: Added.

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

3 years ago[ES6] Allow undefined/null for Symbol.search and Symbol.match
utatane.tea@gmail.com [Wed, 23 Mar 2016 09:11:56 +0000 (09:11 +0000)]
[ES6] Allow undefined/null for Symbol.search and Symbol.match
https://bugs.webkit.org/show_bug.cgi?id=155785

Reviewed by Saam Barati.

Undefined and null for Symbol.search and Symbol.match properties of the given RegExp (like) object are allowed.
When they are specified, we go to the fallback path; creating the RegExp with the given object and matching.

* builtins/StringPrototype.js:
(match):
(search):
* tests/stress/string-symbol-customization.js: Added.
(shouldBe):
(shouldThrow):

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

3 years agoUse Region instead of IntRect in PageClient and WebPageProxy setViewNeedsDisplay...
carlosgc@webkit.org [Wed, 23 Mar 2016 08:51:59 +0000 (08:51 +0000)]
Use Region instead of IntRect in PageClient and WebPageProxy setViewNeedsDisplay method
https://bugs.webkit.org/show_bug.cgi?id=155747

Reviewed by Darin Adler.

Source/WebCore:

Add helper function to make cairo region out of a WebCore::Region.

* platform/graphics/cairo/CairoUtilities.cpp:
(WebCore::toCairoRegion):
* platform/graphics/cairo/CairoUtilities.h:

Source/WebKit2:

This way instead of calling setViewNeedsDisplay() for every
rectangle in the damage area, we can build a region and call
setViewNeedsDisplay() once. GTK+ has API to queue a redraw for a
given region, so we also avoid scheduling multiple redraws in GTK+
port.

* UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::setViewNeedsDisplay): Convert the Region
into a cairo_region_t and use gtk_widget_queue_draw_region()
instyead of gtk_widget_queue_draw_area().
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::incorporateUpdate): Build a Region
with the damage rectangles and call
WebPageProxy::setViewNeedsDisplay() once.
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setViewNeedsDisplay):
* UIProcess/WebPageProxy.h:
* UIProcess/efl/WebView.cpp:
(WebKit::WebView::setViewNeedsDisplay):
* UIProcess/efl/WebView.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::setViewNeedsDisplay):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setViewNeedsDisplay):

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

3 years agoSmallPtrSet leaks memory in its move assignment operator when !this->isSmall()
sbarati@apple.com [Wed, 23 Mar 2016 08:21:03 +0000 (08:21 +0000)]
SmallPtrSet leaks memory in its move assignment operator when !this->isSmall()
https://bugs.webkit.org/show_bug.cgi?id=155701

Reviewed by Darin Adler.

* wtf/SmallPtrSet.h:
(WTF::SmallPtrSet::SmallPtrSet):
(WTF::SmallPtrSet::operator=):

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

3 years agoInvoking a link preview on a complex link (e.g. an image) results in an empty TextInd...
timothy_horton@apple.com [Wed, 23 Mar 2016 05:46:00 +0000 (05:46 +0000)]
Invoking a link preview on a complex link (e.g. an image) results in an empty TextIndicator
https://bugs.webkit.org/show_bug.cgi?id=155779
<rdar://problem/22408793>

Reviewed by Simon Fraser.

* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRect):
(WebCore::snapshotFrameRectWithClip):
* page/FrameSnapshotting.h:
* page/TextIndicator.cpp:
(WebCore::takeSnapshot):
(WebCore::takeSnapshots):
(WebCore::initializeIndicator):
When snapshotting, clip to the indicated range's rects. This is important
to avoid painting into the margins in the non-selection-only painting case.
This didn't come up with normal selection-only painting because the text
didn't intersect the margin, and the background doesn't paint.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::dictionaryPopupInfoForRange):
(WebKit::WebPage::performImmediateActionHitTestAtLocation):
Use the TextIndicator mode where we give up on selection-only snapshotting
and just paint all content on Mac, similar to what we do for 3D Touch indicators.

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

3 years agoTiny tweak to test I just landed.
darin@apple.com [Wed, 23 Mar 2016 04:29:19 +0000 (04:29 +0000)]
Tiny tweak to test I just landed.

* http/tests/security/cross-origin-modal-dialog-base-expected.txt:
Fix expected result now that I fixed the less than sign.
* http/tests/security/cross-origin-modal-dialog-base.html:

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

3 years agostraighten quotes in ChangeLog
darin@apple.com [Wed, 23 Mar 2016 04:19:21 +0000 (04:19 +0000)]
straighten quotes in ChangeLog

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

3 years agoshowModalDialog code runs with “first window” set to wrong window
darin@apple.com [Wed, 23 Mar 2016 04:16:44 +0000 (04:16 +0000)]
showModalDialog code runs with “first window” set to wrong window
https://bugs.webkit.org/show_bug.cgi?id=155710

Source/WebCore:

Reviewed by Brent Fulgham.

Test: http/tests/security/cross-origin-modal-dialog-base.html

* page/Chrome.cpp:
(WebCore::Chrome::runModal): Null out entryScope so that the "first window"
checks inside the modal dialog won't run in the context of the original window
that presented the dialog.

LayoutTests:

Test by John Wilander.

Reviewed by Brent Fulgham.

* http/tests/security/cross-origin-modal-dialog-base-expected.txt: Added.
* http/tests/security/cross-origin-modal-dialog-base.html: Added.
* http/tests/security/resources/cross-origin-modal-dialog-base-1.html: Added.
* http/tests/security/resources/cross-origin-modal-dialog-base-2.html: Added.
* platform/wk2/TestExpectations: Skip test until we get better showModalDialog support.

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

3 years agouserSpaceOnUse patterns are not stroked for empty object bounding box elements
commit-queue@webkit.org [Wed, 23 Mar 2016 03:28:09 +0000 (03:28 +0000)]
userSpaceOnUse patterns are not stroked for empty object bounding box elements
https://bugs.webkit.org/show_bug.cgi?id=109758

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-03-22
Reviewed by Brent Fulgham.
Source/WebCore:

Checking whether the patternUnits is objectBoundingBox needs to be done
after calling collectPatternAttributes(). Otherwise the default value
will be always checked which is 'objectBoundingBox'.

Tests: svg/custom/pattern-units-fill-stroke.svg

* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::buildPattern):
(WebCore::RenderSVGResourcePattern::applyResource):

LayoutTests:

Ensure the SVG pattern is drawn correctly if it is used as a stroke for
empty objectBoundingBox elements.

* svg/custom/pattern-units-fill-stroke-expected.svg: Added.
* svg/custom/pattern-units-fill-stroke.svg: Added.

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

3 years agoFix a typo.
rniwa@webkit.org [Wed, 23 Mar 2016 02:30:57 +0000 (02:30 +0000)]
Fix a typo.

* config.json:

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