WebKit-https.git
4 years agoMarking inspector/heap/getPreview.html as flaky on mac-wk2
ryanhaddad@apple.com [Fri, 11 Mar 2016 19:37:17 +0000 (19:37 +0000)]
Marking inspector/heap/getPreview.html as flaky on mac-wk2
https://bugs.webkit.org/show_bug.cgi?id=155312

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

4 years agoWeb Audio becomes distorted after sample rate changes
jer.noble@apple.com [Fri, 11 Mar 2016 19:35:15 +0000 (19:35 +0000)]
Web Audio becomes distorted after sample rate changes
https://bugs.webkit.org/show_bug.cgi?id=154538
<rdar://problem/24771292>

Reviewed by Darin Adler.

When the underlying audio hardware sample rate changes, the AudioUnit render callback will begin asking
for fewer or more frames. For example, when the sample rate goes from 44.1kHz to 48kHz, it will ask for
118 samples instead of 128. (And vice-versa, 140 samples instead of 128.) But the Web Audio engine can only
really handle requests in multiples of 128 samples. In the case where there are requests for < 128 samples,
actually render 128, but save off the unrequested samples in a separate bus. Then fill that bus during the
next request.

* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::copyFromRange): Added utility method.
* platform/audio/AudioBus.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::AudioDestinationIOS): Create a "spare" bus.
(WebCore::assignAudioBuffersToBus): Moved from inside render.
(WebCore::AudioDestinationIOS::render): Save off extra samples to the "spare" bus.
* platform/audio/ios/AudioDestinationIOS.h:

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

4 years agoMarking css3/masking/mask-luminance-svg.html and css3/masking/mask-svg-script-none...
ryanhaddad@apple.com [Fri, 11 Mar 2016 19:30:55 +0000 (19:30 +0000)]
Marking css3/masking/mask-luminance-svg.html and css3/masking/mask-svg-script-none-to-png.html as flaky
https://bugs.webkit.org/show_bug.cgi?id=155372.

Unreviewed test gardening.

These two tests are flaky crashes on ios-simulator debug.

* platform/ios-simulator/TestExpectations:

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

4 years ago_WKPreviewAction should be in an internal header
bdakin@apple.com [Fri, 11 Mar 2016 19:29:08 +0000 (19:29 +0000)]
_WKPreviewAction should be in an internal header
https://bugs.webkit.org/show_bug.cgi?id=155370

Reviewed by Tim Horton.

Move _WKPreviewAction to an Internal header since only the protocol needs to
be SPI.
* UIProcess/API/Cocoa/_WKPreviewAction.h:
* UIProcess/API/Cocoa/_WKPreviewAction.mm:
* UIProcess/API/Cocoa/_WKPreviewActionInternal.h: Added.
* UIProcess/ios/WKContentViewInteraction.mm:
* WebKit2.xcodeproj/project.pbxproj:

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

4 years agoVersioning.
bshafiei@apple.com [Fri, 11 Mar 2016 19:03:55 +0000 (19:03 +0000)]
Versioning.

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

4 years ago[jhbuild] Disable LLVM OCaml bindings.
commit-queue@webkit.org [Fri, 11 Mar 2016 18:52:50 +0000 (18:52 +0000)]
[jhbuild] Disable LLVM OCaml bindings.
https://bugs.webkit.org/show_bug.cgi?id=153274

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-11
Reviewed by Michael Catanzaro.

* gtk/jhbuild.modules: disable all (actually only OCaml) bindings for LLVM.

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

4 years agoUnreviewed build fix after r198023.
utatane.tea@gmail.com [Fri, 11 Mar 2016 18:48:42 +0000 (18:48 +0000)]
Unreviewed build fix after r198023.
https://bugs.webkit.org/show_bug.cgi?id=155024

Reviewed by Geoffrey Garen.

Update binding test results.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjWithScriptExecutionContextAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):

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

4 years agoUnreviewed, rolling out r197984.
ryanhaddad@apple.com [Fri, 11 Mar 2016 18:36:27 +0000 (18:36 +0000)]
Unreviewed, rolling out r197984.

This change caused an existing LayoutTest to fail

Reverted changeset:

"WebKit should not be redirected to an invalid URL"
https://bugs.webkit.org/show_bug.cgi?id=155263
http://trac.webkit.org/changeset/197984

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

4 years agoWeb Inspector: Make it possible to disable TimelineRuler UI
mattbaker@apple.com [Fri, 11 Mar 2016 18:30:13 +0000 (18:30 +0000)]
Web Inspector: Make it possible to disable TimelineRuler UI
https://bugs.webkit.org/show_bug.cgi?id=155348
<rdar://problem/25103505>

Reviewed by Timothy Hatcher.

Adds an "enabled" property to TimelineRuler, allowing the selection UI
to be disabled without removing the current selection.

* UserInterface/Views/TimelineRuler.css:
(.timeline-ruler.allows-time-range-selection:not(.disabled)):
(.timeline-ruler > .selection-drag):
(.timeline-ruler:not(.disabled) > .selection-drag):
(.timeline-ruler:not(.disabled) > .selection-drag:active):
(.timeline-ruler.disabled > .selection-handle):
(.timeline-ruler.allows-time-range-selection): Deleted.
(.timeline-ruler > .selection-drag:active): Deleted.
Updated ruler styles for "disabled" state: pointer events are disabled,
selection handles hidden, and the default cursor is shown.

* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler):
(WebInspector.TimelineRuler.prototype.get enabled):
(WebInspector.TimelineRuler.prototype.set enabled):
New property.
(WebInspector.TimelineRuler.prototype._handleClick):
Corrected code which always reset the pointer events to "all", instead
of setting it back to the original value.

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

4 years agoUnreviewed, rolling out r197495.
commit-queue@webkit.org [Fri, 11 Mar 2016 18:02:27 +0000 (18:02 +0000)]
Unreviewed, rolling out r197495.
https://bugs.webkit.org/show_bug.cgi?id=155369

LLVM is needed to run update-webkitgtk-libs reliably
(Requested by mcatanzaro on #webkit).

Reverted changeset:

"[jhbuild] Remove LLVM dependency."
https://bugs.webkit.org/show_bug.cgi?id=153274
http://trac.webkit.org/changeset/197495

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

4 years agoUnreviewed, rolling out r197994.
commit-queue@webkit.org [Fri, 11 Mar 2016 17:51:00 +0000 (17:51 +0000)]
Unreviewed, rolling out r197994.
https://bugs.webkit.org/show_bug.cgi?id=155368

Broke several ARM tests (Requested by msaboff on #webkit).

Reverted changeset:

"[JSC] Add register reuse for ArithAdd of an Int32 and
constant in DFG"
https://bugs.webkit.org/show_bug.cgi?id=155164
http://trac.webkit.org/changeset/197994

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

4 years ago[ES6] Implement Reflect.set without receiver support
utatane.tea@gmail.com [Fri, 11 Mar 2016 17:28:46 +0000 (17:28 +0000)]
[ES6] Implement Reflect.set without receiver support
https://bugs.webkit.org/show_bug.cgi?id=155024

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

This patch implements Reflect.set.
The challenge in this patch is Reflect.set requires boolean result of [[Set]],
this is not propagated in the previous JSC put implementation.

This patch changes the put and putByIndex signature from `void put(...)` and `void putByIndex(...)` to `bool put(...)` and `bool putByIndex(...)`,
more consistent style to the ECMA262 spec's [[Set]].

This patch modifies so many part of WebKit. But almost all the changes are mechanical ones.

Currently, this patch does not support receiver modification support.
This will be supported in the subsequent patch[1].

[1]: https://bugs.webkit.org/show_bug.cgi?id=155294

* API/JSCallbackObject.h:
* API/JSCallbackObjectFunctions.h:
(JSC::JSCallbackObject<Parent>::put):
(JSC::JSCallbackObject<Parent>::putByIndex):
* debugger/DebuggerScope.cpp:
(JSC::DebuggerScope::put):
* debugger/DebuggerScope.h:
* jsc.cpp:
(WTF::RuntimeArray::put):
* runtime/ClassInfo.h:
* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::put):
* runtime/ClonedArguments.h:
* runtime/CustomGetterSetter.cpp:
(JSC::callCustomSetter):
* runtime/CustomGetterSetter.h:
* runtime/GenericArguments.h:
* runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::put):
(JSC::GenericArguments<Type>::putByIndex):
* runtime/GetterSetter.cpp:
(JSC::callSetter):
* runtime/GetterSetter.h:
* runtime/JSArray.cpp:
(JSC::JSArray::defineOwnProperty):
(JSC::JSArray::put):
(JSC::JSArray::push):
* runtime/JSArray.h:
* runtime/JSArrayBuffer.cpp:
(JSC::JSArrayBuffer::put):
* runtime/JSArrayBuffer.h:
* runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::put):
* runtime/JSArrayBufferView.h:
* runtime/JSCJSValue.cpp:
(JSC::JSValue::putToPrimitive):
(JSC::JSValue::putToPrimitiveByIndex):
* runtime/JSCJSValue.h:
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::put):
(JSC::JSValue::putInline):
(JSC::JSValue::putByIndex):
* runtime/JSCell.cpp:
(JSC::JSCell::put):
(JSC::JSCell::putByIndex):
* runtime/JSCell.h:
* runtime/JSDataView.cpp:
(JSC::JSDataView::put):
* runtime/JSDataView.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::put):
(JSC::JSFunction::defineOwnProperty):
* runtime/JSFunction.h:
* runtime/JSGenericTypedArrayView.h:
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::put):
(JSC::JSGenericTypedArrayView<Adaptor>::putByIndex):
* runtime/JSGlobalLexicalEnvironment.cpp:
(JSC::JSGlobalLexicalEnvironment::put):
* runtime/JSGlobalLexicalEnvironment.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::put):
* runtime/JSGlobalObject.h:
* runtime/JSLexicalEnvironment.cpp:
(JSC::JSLexicalEnvironment::put):
* runtime/JSLexicalEnvironment.h:
* runtime/JSModuleEnvironment.cpp:
(JSC::JSModuleEnvironment::put):
* runtime/JSModuleEnvironment.h:
* runtime/JSModuleNamespaceObject.cpp:
(JSC::JSModuleNamespaceObject::put):
(JSC::JSModuleNamespaceObject::putByIndex):
* runtime/JSModuleNamespaceObject.h:
* runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::instantiateDeclarations):
* runtime/JSObject.cpp:
(JSC::JSObject::put):
(JSC::JSObject::putInlineSlow):
(JSC::JSObject::putByIndex):
(JSC::JSObject::putGetter):
(JSC::JSObject::putSetter):
(JSC::JSObject::putDirectAccessor):
(JSC::JSObject::putDirectCustomAccessor):
(JSC::JSObject::putDirectNonIndexAccessor):
(JSC::JSObject::putIndexedDescriptor):
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype):
(JSC::JSObject::attemptToInterceptPutByIndexOnHole):
(JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putByIndexBeyondVectorLength):
(JSC::JSObject::putDirectNativeIntrinsicGetter):
(JSC::JSObject::putDirectNativeFunction):
(JSC::JSObject::putDirectMayBeIndex):
(JSC::validateAndApplyPropertyDescriptor):
* runtime/JSObject.h:
(JSC::JSObject::putByIndexInline):
(JSC::JSObject::putDirect):
* runtime/JSObjectInlines.h:
(JSC::JSObject::putInline):
* runtime/JSProxy.cpp:
(JSC::JSProxy::put):
(JSC::JSProxy::putByIndex):
* runtime/JSProxy.h:
* runtime/JSSymbolTableObject.h:
(JSC::symbolTablePut):
(JSC::symbolTablePutTouchWatchpointSet):
(JSC::symbolTablePutInvalidateWatchpointSet):
(JSC::symbolTablePutWithAttributesTouchWatchpointSet):
* runtime/Lookup.h:
(JSC::putEntry):
(JSC::lookupPut):
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::performPut):
(JSC::ProxyObject::put):
(JSC::ProxyObject::putByIndexCommon):
(JSC::ProxyObject::putByIndex):
* runtime/ProxyObject.h:
* runtime/PutPropertySlot.h:
* runtime/ReflectObject.cpp:
(JSC::reflectObjectSet):
* runtime/RegExpConstructor.cpp:
(JSC::setRegExpConstructorInput):
(JSC::setRegExpConstructorMultiline):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::defineOwnProperty):
(JSC::regExpObjectSetLastIndexStrict):
(JSC::regExpObjectSetLastIndexNonStrict):
(JSC::RegExpObject::put):
* runtime/RegExpObject.h:
* runtime/SparseArrayValueMap.cpp:
(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayEntry::put):
* runtime/SparseArrayValueMap.h:
* runtime/StringObject.cpp:
(JSC::StringObject::put):
(JSC::StringObject::putByIndex):
* runtime/StringObject.h:
* tests/es6.yaml:
* tests/modules/namespace.js:
* tests/stress/reflect-set.js: Added.
(shouldBe):
(shouldThrow):
(receiverCase.object2.set Cocoa):
(receiverCase):
(proxyCase):
(objectCase.set get shouldBe):
(objectCase.get shouldBe):
(arrayCase.set get shouldBe):
(arrayCase.get shouldBe):
(arrayBufferCase.set get shouldBe):
(arrayBufferCase.get shouldBe):
(set get shouldBe):
(get shouldBe):
(argumentCase.test1):
(argumentCase.test2):
(argumentCase.test3):
(argumentCase.test4.set get shouldBe):
(argumentCase.test5.get shouldBe):
(argumentStrictCase.test1):
(argumentStrictCase.test2):
(argumentStrictCase.test3):
(argumentStrictCase.test4.set get shouldBe):
(argumentStrictCase.test5.get shouldBe):
(stringObjectCase.set get shouldBe):
(stringObjectCase.get shouldBe):
(customSetter.test1):
(customSetter.test2):
(customSetter.test3):
(customSetter):
(regExpLastIndex):
(functionCase.func):

Source/WebCore:

CustomSetter returns boolean value that indicates the result of [[Set]].
According to this change, this patch modifies the CodeGeneratorJS and test results.

Currently, DOM elements' [[Set]] return true when the setter is found.
This is good for the first step.

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::putDelegate):
* bindings/js/JSDOMBinding.cpp:
(WebCore::throwSetterTypeError):
* bindings/js/JSDOMBinding.h:
* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::putDelegate):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::updateDocument):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
(WebCore::JSDOMWindow::putByIndex):
* bindings/js/JSHTMLAppletElementCustom.cpp:
(WebCore::JSHTMLAppletElement::putDelegate):
* bindings/js/JSHTMLEmbedElementCustom.cpp:
(WebCore::JSHTMLEmbedElement::putDelegate):
* bindings/js/JSHTMLObjectElementCustom.cpp:
(WebCore::JSHTMLObjectElement::putDelegate):
* bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::putDelegate):
(WebCore::JSLocationPrototype::putDelegate):
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginElementCustomPut):
* bindings/js/JSPluginElementFunctions.h:
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::putDelegate):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
(GeneratePrototypeDeclaration):
* bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::setJSTestActiveDOMObjectConstructor):
* bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
* bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
(WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
* bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::setJSTestCustomNamedGetterConstructor):
* bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::setJSTestEventConstructorConstructor):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::setJSTestEventTargetConstructor):
* bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::setJSTestExceptionConstructor):
* bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::setJSTestGenerateIsReachableConstructor):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::setJSTestInterfaceConstructor):
(WebCore::JSTestInterface::put):
(WebCore::JSTestInterface::putByIndex):
(WebCore::setJSTestInterfaceConstructorImplementsStaticAttr):
(WebCore::setJSTestInterfaceImplementsStr2):
(WebCore::setJSTestInterfaceImplementsStr3):
(WebCore::setJSTestInterfaceImplementsNode):
(WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
(WebCore::setJSTestInterfaceSupplementalStr2):
(WebCore::setJSTestInterfaceSupplementalStr3):
(WebCore::setJSTestInterfaceSupplementalNode):
* bindings/scripts/test/JS/JSTestInterface.h:
* bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::setJSTestJSBuiltinConstructorConstructor):
(WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::setJSTestMediaQueryListListenerConstructor):
* bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::setJSTestNamedConstructorConstructor):
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::setJSTestNodeConstructor):
(WebCore::setJSTestNodeName):
* bindings/scripts/test/JS/JSTestNondeterministic.cpp:
(WebCore::setJSTestNondeterministicConstructor):
(WebCore::setJSTestNondeterministicNondeterministicWriteableAttr):
(WebCore::setJSTestNondeterministicNondeterministicExceptionAttr):
(WebCore::setJSTestNondeterministicNondeterministicGetterExceptionAttr):
(WebCore::setJSTestNondeterministicNondeterministicSetterExceptionAttr):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjConstructor):
(WebCore::setJSTestObjConstructorStaticStringAttr):
(WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
(WebCore::setJSTestObjEnumAttr):
(WebCore::setJSTestObjByteAttr):
(WebCore::setJSTestObjOctetAttr):
(WebCore::setJSTestObjShortAttr):
(WebCore::setJSTestObjUnsignedShortAttr):
(WebCore::setJSTestObjLongAttr):
(WebCore::setJSTestObjLongLongAttr):
(WebCore::setJSTestObjUnsignedLongLongAttr):
(WebCore::setJSTestObjStringAttr):
(WebCore::setJSTestObjTestObjAttr):
(WebCore::setJSTestObjLenientTestObjAttr):
(WebCore::setJSTestObjStringAttrTreatingNullAsEmptyString):
(WebCore::setJSTestObjXMLObjAttr):
(WebCore::setJSTestObjCreate):
(WebCore::setJSTestObjReflectedStringAttr):
(WebCore::setJSTestObjReflectedIntegralAttr):
(WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
(WebCore::setJSTestObjReflectedBooleanAttr):
(WebCore::setJSTestObjReflectedURLAttr):
(WebCore::setJSTestObjReflectedCustomIntegralAttr):
(WebCore::setJSTestObjReflectedCustomBooleanAttr):
(WebCore::setJSTestObjReflectedCustomURLAttr):
(WebCore::setJSTestObjTypedArrayAttr):
(WebCore::setJSTestObjAttrWithGetterException):
(WebCore::setJSTestObjAttrWithGetterExceptionWithMessage):
(WebCore::setJSTestObjAttrWithSetterException):
(WebCore::setJSTestObjAttrWithSetterExceptionWithMessage):
(WebCore::setJSTestObjStringAttrWithGetterException):
(WebCore::setJSTestObjStringAttrWithSetterException):
(WebCore::setJSTestObjStrictTypeCheckingAttribute):
(WebCore::setJSTestObjCustomAttr):
(WebCore::setJSTestObjOnfoo):
(WebCore::setJSTestObjWithScriptStateAttribute):
(WebCore::setJSTestObjWithCallWithAndSetterCallWithAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttribute):
(WebCore::setJSTestObjWithScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::setJSTestObjConditionalAttr1):
(WebCore::setJSTestObjConditionalAttr2):
(WebCore::setJSTestObjConditionalAttr3):
(WebCore::setJSTestObjConditionalAttr4Constructor):
(WebCore::setJSTestObjConditionalAttr5Constructor):
(WebCore::setJSTestObjConditionalAttr6Constructor):
(WebCore::setJSTestObjAnyAttribute):
(WebCore::setJSTestObjMutablePoint):
(WebCore::setJSTestObjImmutablePoint):
(WebCore::setJSTestObjStrawberry):
(WebCore::setJSTestObjStrictFloat):
(WebCore::setJSTestObjId):
(WebCore::setJSTestObjReplaceableAttribute):
(WebCore::setJSTestObjNullableLongSettableAttribute):
(WebCore::setJSTestObjNullableStringSettableAttribute):
(WebCore::setJSTestObjNullableStringValue):
(WebCore::setJSTestObjAttributeWithReservedEnumType):
(WebCore::setJSTestObjPutForwardsAttribute):
(WebCore::setJSTestObjPutForwardsNullableAttribute):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::setJSTestOverloadedConstructorsConstructor):
* bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::setJSTestOverrideBuiltinsConstructor):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
(WebCore::setJSTestSerializedScriptValueInterfaceValue):
(WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::setJSTestTypedefsConstructor):
(WebCore::setJSTestTypedefsUnsignedLongLongAttr):
(WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
(WebCore::setJSTestTypedefsAttrWithGetterException):
(WebCore::setJSTestTypedefsAttrWithSetterException):
(WebCore::setJSTestTypedefsStringAttrWithGetterException):
(WebCore::setJSTestTypedefsStringAttrWithSetterException):
* bindings/scripts/test/JS/JSattribute.cpp:
(WebCore::setJSattributeConstructor):
* bindings/scripts/test/JS/JSreadonly.cpp:
(WebCore::setJSreadonlyConstructor):
* bridge/c/c_runtime.cpp:
(JSC::Bindings::CField::setValueToInstance):
* bridge/c/c_runtime.h:
* bridge/jsc/BridgeJSC.h:
(JSC::Bindings::Instance::put):
* bridge/objc/objc_runtime.h:
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcField::setValueToInstance):
(JSC::Bindings::ObjcArray::setValueAt):
(JSC::Bindings::ObjcFallbackObjectImp::put):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::put):
(JSC::RuntimeArray::putByIndex):
* bridge/runtime_array.h:
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::put):
* bridge/runtime_object.h:

Source/WebKit/mac:

As the same to NPJSObject, we just propagate the returned value of NetscapePluginInstanceProxy::setProperty.

* Plugins/Hosted/ProxyInstance.h:
* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyField::setValueToInstance):
(WebKit::ProxyInstance::setFieldValue):

Source/WebKit2:

NPJSObject::setProperty may call `methodTable()->put` operation, but we intentionally do not propagate it to the caller's ::put.
In the current implementation, we just use the result of ::setProperty call.
This is `true` when ::setProperty attempts to call `methodTable()->put`.
In ::setProperty, after calling `methodTable()->put`, ::setProperty function clears the exception state.
So this is not the same semantics to the simple data property store. Rather, this is like the accessor.
In ECMA262 [[Set]], it returns true if there is a setter. So we just use the returned value of ::setProperty.
This indicates that there is a setter for the given [[Set]] operation.

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::put):
* WebProcess/Plugins/Netscape/JSNPObject.h:

LayoutTests:

* js/dom/reflect-set-onto-dom-expected.txt: Added.
* js/dom/reflect-set-onto-dom.html: Added.
* js/dom/script-tests/reflect-set-onto-dom.js: Added.

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

4 years agoWeb Inspector: generated initWithPayload: protocol object initializers should recursi...
bburg@apple.com [Fri, 11 Mar 2016 16:57:20 +0000 (16:57 +0000)]
Web Inspector: generated initWithPayload: protocol object initializers should recursively decode array and object members
https://bugs.webkit.org/show_bug.cgi?id=155337
<rdar://problem/25098357>

Reviewed by Timothy Hatcher.

In cases where an object member is itself an object or array, we were
not calling initWithPayload: on the object member itself. So, this caused
a runtime error when constructing the outer object because the generated
code casted the NSDictionary/NSArray into the member's protocol object type.

* inspector/scripts/codegen/objc_generator.py:
(ObjCGenerator.payload_to_objc_expression_for_member):
Do a straightforward call to initWithPayload: for objects. For arrays,
call a templated helper function which does the same thing. The helper
is used to make this array decoding fit into a single generated expression.

Rebaseline relevant test results.

* inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
* inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:

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

4 years agoREGRESSION (r197956): WebContent process crashes on launch due to unrecognized selector
ddkilzer@apple.com [Fri, 11 Mar 2016 15:54:35 +0000 (15:54 +0000)]
REGRESSION (r197956): WebContent process crashes on launch due to unrecognized selector
<http://webkit.org/b/155356>

Reviewed by Alexey Proskuryakov.

* platform/mac/ScrollableAreaMac.mm:
(WebCore::ScrollableArea::systemLanguageIsRTL): Add
-respondsToSelector: check.

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

4 years agoWTF should have a similar function as equalLettersIgnoringASCIICase to match beginnin...
youenn.fablet@crf.canon.fr [Fri, 11 Mar 2016 15:10:18 +0000 (15:10 +0000)]
WTF should have a similar function as equalLettersIgnoringASCIICase to match beginning of strings
https://bugs.webkit.org/show_bug.cgi?id=153419

Reviewed by Darin Adler.

Source/WebCore:

Covered by added unint tests.

* Modules/fetch/FetchHeaders.cpp:
(WebCore::isForbiddenHeaderName): Using startsWithLettersIgnoringASCIICase.

Source/WTF:

Introducing startsWithLettersIgnoringASCIICase, to check the beginning of a string.
Moving some code from WTF::equalLettersIgnoringASCIICaseCommonWithoutLength in
WTF::hasPrefixWithLettersIgnoringASCIICaseCommon to enable reuse in
WTF::startsWithLettersIgnoringASCIICaseCommon.

* wtf/text/StringCommon.h:
(WTF::hasPrefixWithLettersIgnoringASCIICaseCommon):
(WTF::equalLettersIgnoringASCIICaseCommonWithoutLength):
(WTF::startsWithLettersIgnoringASCIICaseCommonWithoutLength):
(WTF::startsWithLettersIgnoringASCIICaseCommon):
* wtf/text/StringImpl.h:
(WTF::startsWithLettersIgnoringASCIICase):
* wtf/text/WTFString.h:
(WTF::startsWithLettersIgnoringASCIICase):

Tools:

* TestWebKitAPI/Tests/WTF/StringOperators.cpp:
(TestWebKitAPI::TEST): Adding test case for startsWithLettersIgnoringASCIICase.

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

4 years ago[Fetch API] Use DeferredWrapper directly in FetchBody promise handling
youenn.fablet@crf.canon.fr [Fri, 11 Mar 2016 12:08:22 +0000 (12:08 +0000)]
[Fetch API] Use DeferredWrapper directly in FetchBody promise handling
https://bugs.webkit.org/show_bug.cgi?id=155291

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/request/request-consume-empty-expected.txt: Added.
* web-platform-tests/fetch/api/request/request-consume-empty.html: Added.
* web-platform-tests/fetch/api/response/response-consume-empty-expected.txt: Added.
* web-platform-tests/fetch/api/response/response-consume-empty.html: Added.

Source/WebCore:

Moved from typed DOMPromise to DeferredWrapper as there can only be one promise resolved.
Started preparing the handling of blobs translation to other resolved types.

Fixed the case of empty body, in which case promises should resolve with empty objects (strings, buffers...) and not null.

Added Consumer structure to handle asynchronous resolution/rejection of promises.
Added preliminary API to resolve promises based on data stored as a Blob.
FetchBodyOwner will be responsible to do/stop blob loading.

Tests: imported/w3c/web-platform-tests/fetch/api/request/request-consume-empty.html
       imported/w3c/web-platform-tests/fetch/api/response/response-consume-empty.html

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::processIfEmptyOrDisturbed): Fixed empty body case.
(WebCore::FetchBody::arrayBuffer):
(WebCore::FetchBody::blob):
(WebCore::FetchBody::json):
(WebCore::FetchBody::text):
(WebCore::FetchBody::consume):
(WebCore::FetchBody::consumeText):
(WebCore::FetchBody::loadingType):
(WebCore::FetchBody::consumeBlob):
(WebCore::FetchBody::resolveAsJSON):
(WebCore::FetchBody::loadingFailed):
(WebCore::FetchBody::loadedAsBlob):
* Modules/fetch/FetchBody.h:
(WebCore::FetchBody::formData):
(WebCore::FetchBody::Consumer::Consumer):
* Modules/fetch/FetchBody.idl:
* Modules/fetch/FetchBodyOwner.h:
(WebCore::FetchBodyOwner::arrayBuffer):
(WebCore::FetchBodyOwner::blob):
(WebCore::FetchBodyOwner::formData):
(WebCore::FetchBodyOwner::json):
(WebCore::FetchBodyOwner::text):
(WebCore::FetchBodyOwner::loadBlob):

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

4 years agoAvoid applying link tags with an invalid media attribute
yoav@yoav.ws [Fri, 11 Mar 2016 11:13:25 +0000 (11:13 +0000)]
Avoid applying link tags with an invalid media attribute
https://bugs.webkit.org/show_bug.cgi?id=143262

Reviewed by Brent Fulgham.

Source/WebCore:

In current HTML spec, unlike HTML4, the UA must not apply <link> based resources
when the media attribute does not match:
https://html.spec.whatwg.org/multipage/semantics.html#attr-link-media

An invalid media attribute parsing creates a non-empty MediaQuerySet
containing a single query with no expressions and no media type.
(and with its m_ignored flag off)

In order to ignore such MediaQueries, I added an extra check that makes sure
that the queries handled by MediaQueryEvaluator::eval have either expressions
or a media type, and if not, they are ignored.

Test: fast/dom/HTMLLinkElement/link-stylesheet-invalid-media.html

* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::eval):

LayoutTests:

These tests make sure that when <link rel=stylesheet> is present with an invalid
media attribute, the styles are not being applied.

* fast/dom/HTMLLinkElement/link-stylesheet-invalid-media-expected.txt: Added.
* fast/dom/HTMLLinkElement/link-stylesheet-invalid-media.html: Added.
* fast/dom/HTMLLinkElement/link-stylesheet-media-type-expected.txt: Added.
* fast/dom/HTMLLinkElement/link-stylesheet-media-type.html: Added.

These tests test the old HTML4 behavior and are no longer relevant.
* fast/media/media-descriptor-syntax-05.html: Removed.
* fast/media/media-descriptor-syntax-05-expected.html: Removed.

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

4 years agoSkip content-editable-as-textarea.html on GTK as it uses AX API.
fred.wang@free.fr [Fri, 11 Mar 2016 10:04:35 +0000 (10:04 +0000)]
Skip content-editable-as-textarea.html on GTK as it uses AX API.

Unreviewed test gardening.

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-11

* platform/gtk/TestExpectations:

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

4 years ago[CallWith=ScriptExecutionContext] should pass ScriptExecutionContext to the implement...
youenn.fablet@crf.canon.fr [Fri, 11 Mar 2016 09:44:53 +0000 (09:44 +0000)]
[CallWith=ScriptExecutionContext] should pass ScriptExecutionContext to the implementation by reference
https://bugs.webkit.org/show_bug.cgi?id=155297

Reviewed by Darin Adler.

Changing the binding generator to pass ScriptExecutionContext by reference.
Updating DOM classes accordingly.

Covered by existing tests.

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::create):
(WebCore::MediaKeySession::MediaKeySession):
* Modules/encryptedmedia/MediaKeySession.h:
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::createSession):
* Modules/encryptedmedia/MediaKeys.h:
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::clone):
* Modules/fetch/FetchRequest.h:
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::error):
(WebCore::FetchResponse::redirect):
(WebCore::FetchResponse::clone):
* Modules/fetch/FetchResponse.h:
* Modules/indexeddb/IDBCursor.h:
(WebCore::IDBCursor::continueFunction):
* Modules/indexeddb/IDBFactory.h:
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBKeyRange.cpp:
(WebCore::IDBKeyRange::lowerValue):
(WebCore::IDBKeyRange::upperValue):
(WebCore::IDBKeyRange::only):
(WebCore::IDBKeyRange::lowerBound):
(WebCore::IDBKeyRange::upperBound):
(WebCore::IDBKeyRange::bound):
* Modules/indexeddb/IDBKeyRange.h:
(WebCore::IDBKeyRange::lowerBound):
(WebCore::IDBKeyRange::upperBound):
(WebCore::IDBKeyRange::bound):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::IDBOpenDBRequest):
* Modules/indexeddb/IDBOpenDBRequest.h:
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/client/IDBCursorImpl.cpp:
(WebCore::IDBClient::IDBCursor::continueFunction):
(WebCore::IDBClient::IDBCursor::deleteFunction):
* Modules/indexeddb/client/IDBCursorImpl.h:
* Modules/indexeddb/client/IDBFactoryImpl.cpp:
(WebCore::IDBClient::shouldThrowSecurityException):
(WebCore::IDBClient::IDBFactory::getDatabaseNames):
(WebCore::IDBClient::IDBFactory::open):
(WebCore::IDBClient::IDBFactory::openInternal):
(WebCore::IDBClient::IDBFactory::deleteDatabase):
(WebCore::IDBClient::IDBFactory::cmp):
* Modules/indexeddb/client/IDBFactoryImpl.h:
* Modules/indexeddb/client/IDBIndexImpl.cpp:
(WebCore::IDBClient::IDBIndex::IDBIndex):
(WebCore::IDBClient::IDBIndex::openCursor):
(WebCore::IDBClient::IDBIndex::count):
(WebCore::IDBClient::IDBIndex::openKeyCursor):
(WebCore::IDBClient::IDBIndex::get):
(WebCore::IDBClient::IDBIndex::getKey):
* Modules/indexeddb/client/IDBIndexImpl.h:
* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::create):
(WebCore::IDBClient::IDBObjectStore::IDBObjectStore):
(WebCore::IDBClient::IDBObjectStore::openCursor):
(WebCore::IDBClient::IDBObjectStore::get):
(WebCore::IDBClient::IDBObjectStore::deleteFunction):
(WebCore::IDBClient::IDBObjectStore::doDelete):
(WebCore::IDBClient::IDBObjectStore::modernDelete):
(WebCore::IDBClient::IDBObjectStore::clear):
(WebCore::IDBClient::IDBObjectStore::createIndex):
(WebCore::IDBClient::IDBObjectStore::index):
(WebCore::IDBClient::IDBObjectStore::count):
* Modules/indexeddb/client/IDBObjectStoreImpl.h:
* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::createDeleteRequest):
(WebCore::IDBClient::IDBOpenDBRequest::createOpenRequest):
(WebCore::IDBClient::IDBOpenDBRequest::IDBOpenDBRequest):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::IDBRequest):
* Modules/indexeddb/client/IDBRequestImpl.h:
* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::objectStore):
(WebCore::IDBClient::IDBTransaction::createObjectStore):
(WebCore::IDBClient::IDBTransaction::createIndex):
* Modules/mediasource/DOMURLMediaSource.cpp:
(WebCore::DOMURLMediaSource::createObjectURL):
* Modules/mediasource/DOMURLMediaSource.h:
* Modules/mediastream/DOMURLMediaStream.cpp:
(WebCore::DOMURLMediaStream::createObjectURL):
* Modules/mediastream/DOMURLMediaStream.h:
* Modules/mediastream/HTMLMediaElementMediaStream.cpp:
(WebCore::HTMLMediaElementMediaStream::setSrcObject):
* Modules/mediastream/HTMLMediaElementMediaStream.h:
* Modules/mediastream/HTMLMediaElementMediaStream.idl:
* Modules/notifications/Notification.cpp:
(WebCore::Notification::Notification):
(WebCore::Notification::create):
(WebCore::Notification::permission):
(WebCore::Notification::requestPermission):
* Modules/notifications/Notification.h:
* Modules/notifications/NotificationCenter.cpp:
(WebCore::NotificationCenter::createNotification):
* Modules/notifications/NotificationClient.h:
* Modules/quota/StorageInfo.cpp:
(WebCore::StorageInfo::queryUsageAndQuota):
(WebCore::StorageInfo::requestQuota):
* Modules/quota/StorageInfo.h:
* Modules/quota/StorageQuota.h:
* bindings/js/JSIDBObjectStoreCustom.cpp:
(WebCore::JSIDBObjectStore::createIndex):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateCallWith):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjWithScriptExecutionContextAttribute):
(WebCore::jsTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::jsTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
* fileapi/FileReaderSync.cpp:
(WebCore::FileReaderSync::readAsArrayBuffer):
(WebCore::FileReaderSync::readAsBinaryString):
(WebCore::FileReaderSync::readAsText):
(WebCore::FileReaderSync::readAsDataURL):
(WebCore::FileReaderSync::startLoading):
* fileapi/FileReaderSync.h:
(WebCore::FileReaderSync::readAsText):
* html/DOMURL.cpp:
(WebCore::DOMURL::createObjectURL):
(WebCore::DOMURL::createPublicURL):
(WebCore::DOMURL::revokeObjectURL):
* html/DOMURL.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setSrcObject):
* html/HTMLMediaElement.h:
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
* page/DOMWindow.h:
* page/History.h:
(WebCore::History::back):
(WebCore::History::forward):
(WebCore::History::go):

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

4 years agoUnreviewed, fix Changelog. git merged poorly.
keith_miller@apple.com [Fri, 11 Mar 2016 07:52:17 +0000 (07:52 +0000)]
Unreviewed, fix Changelog. git merged poorly.

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

4 years ago[ES6] Make RegExp.prototype.toString spec compliant
keith_miller@apple.com [Fri, 11 Mar 2016 07:13:10 +0000 (07:13 +0000)]
[ES6] Make RegExp.prototype.toString spec compliant
https://bugs.webkit.org/show_bug.cgi?id=155341

Patch by Saam barati <sbarati@apple.com> on 2016-03-10
Reviewed by Filip Pizlo.

Before we were directly calling into the flagsString
function. Instead, we must get the "flags" property
of the thisObject. This will usually call into the flags
getter, but not always. Specifically, you can you a Proxy
to observe this behavior.

* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncToString):
(JSC::regExpProtoGetterGlobal):
* tests/es6.yaml:
* tests/es6/Proxy_internal_get_calls_RegExp.prototype.toString.js: Added.
(test.get var):
(test.):
* tests/stress/regexp-prototype-tostring.js: Added.
(assert):
(test):
(test.get var):
(test.):
(let.handler.get switch):
(let.handler):
(get test):
(test.get RegExp):

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

4 years ago[ES6] Make RegExp.prototype.toString spec compliant
sbarati@apple.com [Fri, 11 Mar 2016 07:10:18 +0000 (07:10 +0000)]
[ES6] Make RegExp.prototype.toString spec compliant
https://bugs.webkit.org/show_bug.cgi?id=155341

Reviewed by Filip Pizlo.

Before we were directly calling into the flagsString
function. Instead, we must get the "flags" property
of the thisObject. This will usually call into the flags
getter, but not always. Specifically, you can you a Proxy
to observe this behavior.

* runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncToString):
(JSC::regExpProtoGetterGlobal):
* tests/es6.yaml:
* tests/es6/Proxy_internal_get_calls_RegExp.prototype.toString.js: Added.
(test.get var):
(test.):
* tests/stress/regexp-prototype-tostring.js: Added.
(assert):
(test):
(test.get var):
(test.):
(let.handler.get switch):
(let.handler):
(get test):
(test.get RegExp):

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

4 years ago[GTK] Fix rendering of slider input elements
carlosgc@webkit.org [Fri, 11 Mar 2016 07:05:01 +0000 (07:05 +0000)]
[GTK] Fix rendering of slider input elements
https://bugs.webkit.org/show_bug.cgi?id=155296

Reviewed by Michael Catanzaro.

Use the new gadgets for newer GTK+ and improve a bit the rendering
for previous versions to better match GTK+.

* rendering/RenderThemeGtk.cpp:
(WebCore::createStyleContext): Add ScaleContents and
ScaleHighlight parts that are only used with GTK+ 3.19.
(WebCore::RenderThemeGtk::paintSliderTrack): Use a smaller trough,
centered in the given rectangle to better match GTK+. Also render
the hightlight gadget with GTK+ 3.19.
(WebCore::RenderThemeGtk::paintSliderThumb): Also create the style
context for contents gadget.
(WebCore::RenderThemeGtk::adjustSliderThumbSize): Take into
account the slider border when calculating the slider thumb size.

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

4 years ago[GTK] Scrollbars are broken once again with current GTK+ master
carlosgc@webkit.org [Fri, 11 Mar 2016 06:59:57 +0000 (06:59 +0000)]
[GTK] Scrollbars are broken once again with current GTK+ master
https://bugs.webkit.org/show_bug.cgi?id=155292

Reviewed by Michael Catanzaro.

Most of the trough theming properties have been moved to the
scrollbar, and a new gadget "contents" has been added between the
scrollbar and its children.

* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::getOrCreateStyleContext): Add
left/bottom style classes to ensure the scrollbars border is taken
into account and rendered.
(WebCore::ScrollbarThemeGtk::paintTrackBackground): Also create
style context for contents gadget.
(WebCore::ScrollbarThemeGtk::paintThumb): Ditto.
(WebCore::ScrollbarThemeGtk::paintButton): Ditto.
(WebCore::ScrollbarThemeGtk::scrollbarThickness): Take the
scrollbar border into account.
(WebCore::ScrollbarThemeGtk::buttonSize): Also create style
context for contents gadget.
(WebCore::ScrollbarThemeGtk::getStepperSpacing): Ditto.
(WebCore::ScrollbarThemeGtk::minimumThumbLength): Ditto.
(WebCore::ScrollbarThemeGtk::thumbFatness): Ditto.
(WebCore::ScrollbarThemeGtk::getTroughBorder): Take the scrollbar
border into account.

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

4 years agoREGRESSION (r197986): Don't try to link to undefined $(WEBKIT_SYSTEM_INTERFACE_LIBRARY)
ddkilzer@apple.com [Fri, 11 Mar 2016 06:47:10 +0000 (06:47 +0000)]
REGRESSION (r197986): Don't try to link to undefined $(WEBKIT_SYSTEM_INTERFACE_LIBRARY)

Follow-up build fix for:
    AX: Force allow user zoom
    <https://bugs.webkit.org/show_bug.cgi?id=155056>

Fixes the following build failure:
    ld: library not found for -l-lAccessibility
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

* Configurations/WebKit.xcconfig: Remove
"-l$(WEBKIT_SYSTEM_INTERFACE_LIBRARY)" from OTHER_LDFLAGS since
that macro is not defined, and there is no need to link to
libWebKitSystemInterface.a.

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

4 years agoREGRESSION (r197983): Build fails due to missing inline method
ddkilzer@apple.com [Fri, 11 Mar 2016 06:12:52 +0000 (06:12 +0000)]
REGRESSION (r197983): Build fails due to missing inline method

Attempt to fix the following build failure:

    Undefined symbols for architecture arm64:
      "JSC::GenericTypedArrayView<JSC::Uint8ClampedAdaptor>::createUninitialized(unsigned int)", referenced from:
          WebCore::ImageBufferData::getData(WebCore::IntRect const&, WebCore::IntSize const&, bool, bool, float) const in ImageBufferDataCG.o

* platform/graphics/cg/ImageBufferDataCG.cpp: Include some
headers to match FEGaussianBlur.cpp and FilterEffect.cpp.

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

4 years ago[JSC] Add register reuse for ArithAdd of an Int32 and constant in DFG
commit-queue@webkit.org [Fri, 11 Mar 2016 06:04:49 +0000 (06:04 +0000)]
[JSC] Add register reuse for ArithAdd of an Int32 and constant in DFG
https://bugs.webkit.org/show_bug.cgi?id=155164

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-03-10
Reviewed by Geoffrey Garen.

Every "inc" in loop was looking like this:
    move rX, rY
    inc rY
    jo 0x230f4a200580

This patch add register Reuse to that case to remove
the extra "move".

* dfg/DFGOSRExit.h:
(JSC::DFG::SpeculationRecovery::SpeculationRecovery):
(JSC::DFG::SpeculationRecovery::immediate):
* dfg/DFGOSRExitCompiler32_64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGOSRExitCompiler64.cpp:
(JSC::DFG::OSRExitCompiler::compileExit):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileArithAdd):
* tests/stress/arith-add-with-constant-overflow.js: Added.
(opaqueAdd):

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

4 years agoTry to fix the iOS 9 build.
timothy_horton@apple.com [Fri, 11 Mar 2016 05:09:03 +0000 (05:09 +0000)]
Try to fix the iOS 9 build.

* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::detectContentInRange):
* platform/cocoa/DataDetectorsCoreSoftLink.h:
* platform/cocoa/DataDetectorsCoreSoftLink.mm:
* platform/spi/cocoa/DataDetectorsCoreSPI.h:

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

4 years agoREGRESSION (r197976): Build failure due to missing DDOptionalSource.h header
ddkilzer@apple.com [Fri, 11 Mar 2016 05:01:06 +0000 (05:01 +0000)]
REGRESSION (r197976): Build failure due to missing DDOptionalSource.h header

Follow-up fix for:
    Expose additional WKDataDetectorTypes.
    <https://bugs.webkit.org/show_bug.cgi?id=155331>

* platform/spi/cocoa/DataDetectorsCoreSPI.h: Protect
DDOptionalSource.h with version check.

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

4 years agoFix Windows build after r197986.
achristensen@apple.com [Fri, 11 Mar 2016 04:52:21 +0000 (04:52 +0000)]
Fix Windows build after r197986.

* accessibility/AccessibilityObject.h:

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

4 years agoSet AVURLAssetUsesNoPersistentCacheKey on AVAsset to match caching policy.
jer.noble@apple.com [Fri, 11 Mar 2016 04:50:10 +0000 (04:50 +0000)]
Set AVURLAssetUsesNoPersistentCacheKey on AVAsset to match caching policy.
https://bugs.webkit.org/show_bug.cgi?id=155117
rdar://problem/6802240

Patch by Jeremy Jones <jeremyj@apple.com> on 2016-03-10
Reviewed by Simon Fraser.

Source/WebCore:

No new tests because no new functionality was added.

This will prevent persistent media caches when webkit is using in memory caching.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerShouldUsePersistentCache): Added.
* html/HTMLMediaElement.h: Declare mediaPlayerShouldUsePersistentCache().
* page/ChromeClient.h: Declare mediaPlayerShouldUsePersistentCache().
* platform/graphics/MediaPlayer.h:
(WebCore::MediaPlayerClient::mediaPlayerShouldUsePersistentCache): Added.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Set property on AVAssetOptions.

Source/WebKit/mac:

Implement mediaShouldUsePersistentCache to disable media caching when NSURLCache is disabled.

* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::mediaShouldUsePersistentCache): Added.

Source/WebKit2:

Make AVAsset AVURLAssetUsesNoPersistentCacheKey match !m_websiteDataStore->isPersistent()
This will prevent persistent media caches when webkit is using in-memory caching.

* Shared/WebPageCreationParameters.cpp: Add mediaShouldUsePersistentCache.
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters): Add mediaShouldUsePersistentCache.
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::mediaShouldUsePersistentCache): Added.
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_mediaUsesPersistentCache): Added.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::mediaShouldUsePersistentCache): Added.

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

4 years agoCRASH at WebCore::RenderView::updateVisibleViewportRect
jer.noble@apple.com [Fri, 11 Mar 2016 04:25:51 +0000 (04:25 +0000)]
CRASH at WebCore::RenderView::updateVisibleViewportRect
https://bugs.webkit.org/show_bug.cgi?id=155209
<rdar://problem/23997530>

Reviewed by Simon Fraser.

Source/WebCore:

Test: media/video-crash-invisible-autoplay-display-none.html

Between the time when the video element's renderer is created and destroyed, we may have unset the
InvisibleAutoplayNotPermitted restriction. So rather than check for that restriction before
unregistering for the "visible in viewport" notification, unregister only if the renderer
was previously registered.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::willDetachRenderers):

LayoutTests:

(These files were mistakenly landed in a previous commit:)
* media/video-crash-invisible-autoplay-display-none-expected.txt: Added.
* media/video-crash-invisible-autoplay-display-none.html: Added.

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

4 years agoUnreviewed build fix after r197953; correct the settings added in r197953.
jer.noble@apple.com [Fri, 11 Mar 2016 04:16:55 +0000 (04:16 +0000)]
Unreviewed build fix after r197953; correct the settings added in r197953.

* WebView.cpp:
(WebView::notifyPreferencesChanged):

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

4 years agoSimple line layout: Add text-align: justify support.
zalan@apple.com [Fri, 11 Mar 2016 04:03:32 +0000 (04:03 +0000)]
Simple line layout: Add text-align: justify support.
https://bugs.webkit.org/show_bug.cgi?id=155006

Reviewed by Antti Koivisto.

Source/WebCore:

This patch enables text-align: justify; for simple line layout (only latin text for now).
It speeds up/reduced memory consumption for justified text.

PerformanceTests/Layout/line-layout-simple.html
before text-align: justify support -> mean: 86.20513022288704 runs/s
after -> mean: 96.73972475626084 runs/s

Covered by existing text-align: justify tests.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForFontAndText):
(WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
(WebCore::SimpleLineLayout::LineState::expansionOportunity):
(WebCore::SimpleLineLayout::expansionBehavior):
(WebCore::SimpleLineLayout::justifyRuns):
(WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
(WebCore::SimpleLineLayout::createTextRuns):
(WebCore::SimpleLineLayout::printReason):
(WebCore::SimpleLineLayout::canUseForStyle): Deleted.
* rendering/SimpleLineLayout.h:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/SimpleLineLayoutResolver.h:
(WebCore::SimpleLineLayout::RunResolver::Run::expansion):
(WebCore::SimpleLineLayout::RunResolver::Run::expansionBehavior):

LayoutTests:

Rebaseline based on simple line layout output.

* fast/text/whitespace/023-expected.txt:
* platform/mac/css2.1/t0905-c5525-fltwidth-00-c-g-expected.txt:

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

4 years agoAX: Force allow user zoom
n_wang@apple.com [Fri, 11 Mar 2016 03:57:52 +0000 (03:57 +0000)]
AX: Force allow user zoom
https://bugs.webkit.org/show_bug.cgi?id=155056

Reviewed by Simon Fraser.

Source/WebCore:

Override the maximum/minimum scale factor when forceAlwaysUserScalable is true.

Test: fast/viewport/ios/force-always-user-scalable.html

* Configurations/WebCoreTestSupport.xcconfig:
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::minimumScale):
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::maximumScale):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::Internals):
(WebCore::Internals::composedTreeAsText):
(WebCore::Internals::setViewportForceAlwaysUserScalable):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit2:

Linked libAccessibility library so that we can observe the accessibility
setting change for the force always user scalable feature.

* Configurations/WebKit.xcconfig:
* UIProcess/API/Cocoa/WKWebView.mm:
(shouldAllowPictureInPictureMediaPlayback):
(forceAlwaysUserScalableChangedCallback):
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView dealloc]):
(-[WKWebView _navigationGestureDidEnd]):
(-[WKWebView _updateForceAlwaysUserScalable]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::setViewportConfigurationMinimumLayoutSize):
(WebKit::WebPageProxy::updateForceAlwaysUserScalable):
(WebKit::WebPageProxy::setMaximumUnobscuredSize):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::disableInspectorNodeSearch):
(WebKit::WebPage::updateForceAlwaysUserScalable):
(WebKit::innerFrameQuad):

LayoutTests:

* fast/viewport/ios/force-always-user-scalable-expected.txt: Added.
* fast/viewport/ios/force-always-user-scalable.html: Added.
* platform/ios-simulator-wk2/TestExpectations:

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

4 years agoUnreviewed, build fix for r197983, hopefully.
keith_miller@apple.com [Fri, 11 Mar 2016 03:52:15 +0000 (03:52 +0000)]
Unreviewed, build fix for r197983, hopefully.

* API/WebKitAvailability.h:

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

4 years agoWebKit should not be redirected to an invalid URL
jiewen_tan@apple.com [Fri, 11 Mar 2016 02:58:47 +0000 (02:58 +0000)]
WebKit should not be redirected to an invalid URL
https://bugs.webkit.org/show_bug.cgi?id=155263
<rdar://problem/22820172>

Reviewed by Brent Fulgham.

Source/WebCore:

Test: http/tests/navigation/redirect-to-invalid-url.html

* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):

LayoutTests:

* http/tests/navigation/redirect-to-invalid-url-expected.txt: Added.
* http/tests/navigation/redirect-to-invalid-url.html: Added.
* http/tests/navigation/resources/redirect-to-invalid-url-frame.php: Added.

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

4 years agoTyped Arrays have no public facing API
keith_miller@apple.com [Fri, 11 Mar 2016 02:46:03 +0000 (02:46 +0000)]
Typed Arrays have no public facing API
https://bugs.webkit.org/show_bug.cgi?id=120112

Reviewed by Geoffrey Garen.

This patch adds a new C-API (an Obj-C API will follow in the future) for Typed Arrays. The API has two sets of
functions. One for Typed Arrays and another for Array Buffers. This API is intended to reflect the use of Typed
Array objects in JS code. There is a method for each of the core TypedArray and Array Buffer methods.
Originally, we were planning on using a separate non-JS object as the backing store instead of a JS Array Buffer
but we decide to defer that idea since there was no good CF/NS API that met all the constraints we needed
(Discussed further below). We also wanted to want until Shared Array Buffers had reached a more finished state
to see what impact they might have on an API.

The API has the following Typed Array construction methods:
1) Create with length (the backing buffer is zero initialized). -- JSObjectMakeTypedArray
2) Create with an existing pointer and a destructor. -- JSObjectMakeTypedArrayFromBytesNoCopy
3) Create with an Array Buffer object. -- JSObjectMakeTypedArrayFromArrayBuffer
4) Create with an Array Buffer object with a given offset and length. -- JSObjectMakeTypedArrayFromArrayBufferWithOffset

The API has the following functions on Typed Array JSObjectRefs:
5) Get access to a temporary void* of the backing store's data. -- JSObjectGetTypedArrayBytesPtr
6) Get the length of a Typed Array object (returns 0 if it is not a Typed Array object). -- JSObjectGetTypedArrayLength
7) Get the byte length of a Typed Array object (returns 0 if it is not a Typed Array object). -- JSObjectGetTypedArrayByteLength
8) Get the byte offset of a Typed Array object (returns 0 if it is not a Typed Array object). -- JSObjectGetTypedArrayByteOffset
9) Get a Typed Array object's Array Buffer  backing store. -- JSObjectGetTypedArrayBuffer

The API has the following Array Buffer construction method:
10) Create with an existing pointer and a destructor. -- JSObjectMakeArrayBufferWithBytesNoCopy

The API has the following functions on Array Buffer JSObjectRefs:
11) Get access to a temporary void* of the backing store's data. -- JSObjectGetArrayBufferBytesPtr
12) Get the byte length of an Array Buffer object (returns 0 if it is not an Array Buffer object). -- JSObjectGetArrayBufferByteLength

The API adds the following new typedefs and enumerations:
13) A typedef representing the function pointer type used to deallocate byte pointers provided to constructors. -- JSTypedArrayByesDeallocator
14) An enumeration indicating the Typed Array API type of a JSValueRef. -- JSTypedArrayType

Finally, The API has the following function to get Typed Array Types:
15)  Get the Typed Array type of a JS value. -- JSValueGetTypedArrayType

There are a couple of things to note about these functions. Calling JSObjectGetTypedArrayBytesPtr (5) or
JSObjectGetArrayBufferBytesPtr (12) will pin and lock the ArrayBuffer's data for the remaining lifetime of that
ArrayBuffer. This is because, currently, we do not have finalizers for our Array Buffers or Typed Arrays with a
backing ArrayBuffer and adding one would likely incur a non-trivial cost to GC. Also, we do not have a direct
way to make a Typed Array from a pointer with an offset as we do not expect using offsets to be a common use
case of the API.

While it would have been nice to integrate our backing store with CFData or one of its subclasses, it is not
possible to force a CFData/CFMutableData to be both writable and have a fixed size/backing store pointer.
NSData is not writable and CFMutableData can have a fixed pointer if it is allocated with a non-zero capacity
but there is no way for us to force an existing CFMutableData into this state.

* API/APIUtils.h: Copied from Source/JavaScriptCore/runtime/ArrayBuffer.cpp.
(handleExceptionIfNeeded):
(setException):
* API/JSBase.h:
* API/JSObjectRef.cpp:
(handleExceptionIfNeeded): Deleted.
* API/JSTypedArray.cpp: Added.
(toJSTypedArrayType):
(toTypedArrayType):
(createTypedArray):
(JSValueGetTypedArrayType):
(JSObjectMakeTypedArray):
(JSObjectMakeTypedArrayWithBytesNoCopy):
(JSObjectMakeTypedArrayWithArrayBuffer):
(JSObjectMakeTypedArrayWithArrayBufferAndOffset):
(JSObjectGetTypedArrayBytesPtr):
(JSObjectGetTypedArrayLength):
(JSObjectGetTypedArrayByteLength):
(JSObjectGetTypedArrayByteOffset):
(JSObjectGetTypedArrayBuffer):
(JSObjectMakeArrayBufferWithBytesNoCopy):
(JSObjectGetArrayBufferBytesPtr):
(JSObjectGetArrayBufferByteLength):
* API/JSTypedArray.h: Added.
* API/JSValueRef.cpp:
(handleExceptionIfNeeded): Deleted.
* API/JSValueRef.h:
* API/JavaScript.h:
* API/WebKitAvailability.h:
* API/tests/TypedArrayCTest.cpp: Added.
(id):
(freePtr):
(assertEqualsAsNumber):
(testAccess):
(testConstructors):
(forEachTypedArrayType):
(testTypedArrayCAPI):
* API/tests/TypedArrayCTest.h: Added.
* API/tests/testapi.c:
(main):
* CMakeLists.txt:
* ForwardingHeaders/JavaScriptCore/JSTypedArray.h: Added.
* JavaScriptCore.xcodeproj/project.pbxproj:
* PlatformEfl.cmake:
* PlatformGTK.cmake:
* runtime/ArrayBuffer.cpp:
(JSC::ArrayBuffer::transfer):
* runtime/ArrayBuffer.h:
(JSC::arrayBufferDestructorNull):
(JSC::arrayBufferDestructorDefault):
(JSC::ArrayBufferContents::ArrayBufferContents):
(JSC::ArrayBufferContents::transfer):
(JSC::ArrayBuffer::createAdopted):
(JSC::ArrayBuffer::createFromBytes):
(JSC::ArrayBuffer::ArrayBuffer):
(JSC::ArrayBuffer::pinAndLock):
(JSC::ArrayBufferContents::tryAllocate):
(JSC::ArrayBufferContents::~ArrayBufferContents):
* shell/PlatformWin.cmake:

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

4 years agoAX: Implement bounds/position and index related text marker functions using TextIterator
n_wang@apple.com [Fri, 11 Mar 2016 02:37:46 +0000 (02:37 +0000)]
AX: Implement bounds/position and index related text marker functions using TextIterator
https://bugs.webkit.org/show_bug.cgi?id=154976

Reviewed by Chris Fleizach.

Source/WebCore:

Implemented position and index related text marker calls with TextIterator. Also fixed some
VoiceOver navigation issues.

Test: accessibility/mac/text-marker-for-index.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::traverseToOffsetInRange):
(WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
(WebCore::AXObjectCache::textMarkerDataForCharacterOffset):
(WebCore::AXObjectCache::shouldSkipBoundary):
(WebCore::AXObjectCache::textMarkerDataForNextCharacterOffset):
(WebCore::AXObjectCache::startCharacterOffsetOfWord):
(WebCore::AXObjectCache::nextBoundary):
(WebCore::AXObjectCache::previousBoundary):
(WebCore::AXObjectCache::previousSentenceStartCharacterOffset):
(WebCore::AXObjectCache::localCaretRectForCharacterOffset):
(WebCore::AXObjectCache::absoluteCaretBoundsForCharacterOffset):
(WebCore::AXObjectCache::characterOffsetForPoint):
(WebCore::AXObjectCache::characterOffsetForBounds):
(WebCore::AXObjectCache::endCharacterOffsetOfLine):
(WebCore::AXObjectCache::startCharacterOffsetOfLine):
(WebCore::AXObjectCache::characterOffsetForIndex):
(WebCore::AXObjectCache::indexForCharacterOffset):
(WebCore::AXObjectCache::rootAXEditableElement):
* accessibility/AXObjectCache.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::visiblePositionRangeForRange):
(WebCore::AccessibilityObject::rangeForPlainTextRange):
(WebCore::AccessibilityObject::lineRangeForPosition):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::boundsForVisiblePositionRange):
(WebCore::AccessibilityObject::boundsForRange):
(WebCore::AccessibilityObject::setSelectedVisiblePositionRange):
(WebCore::AccessibilityObject::doAXStringForRange):
(WebCore::AccessibilityObject::doAXBoundsForRange):
(WebCore::AccessibilityObject::doAXBoundsForRangeUsingCharacterOffset):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::nodeIsTextControl):
(WebCore::AccessibilityRenderObject::boundsForRects):
(WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange):
(WebCore::AccessibilityRenderObject::boundsForRange):
(WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
(WebCore::AccessibilityRenderObject::doAXBoundsForRange):
(WebCore::AccessibilityRenderObject::doAXBoundsForRangeUsingCharacterOffset):
(WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest):
* accessibility/AccessibilityRenderObject.h:
* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper positionForTextMarker:]):
(-[WebAccessibilityObjectWrapper textMarkerRange]):
(-[WebAccessibilityObjectWrapper textMarkerRangeForSelection]):
(-[WebAccessibilityObjectWrapper textMarkerForPosition:]):
(-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
(-[WebAccessibilityObjectWrapper frameForTextMarkers:]):
(-[WebAccessibilityObjectWrapper textMarkerForPoint:]):
(-[WebAccessibilityObjectWrapper nextMarkerForCharacterOffset:]):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper doAXAttributedStringForRange:]):
(-[WebAccessibilityObjectWrapper _convertToNSRange:]):
(-[WebAccessibilityObjectWrapper _indexForTextMarker:]):
(-[WebAccessibilityObjectWrapper _textMarkerForIndex:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
* editing/htmlediting.cpp:
(WebCore::localCaretRectInRendererForCaretPainting):
(WebCore::localCaretRectInRendererForRect):
* editing/htmlediting.h:

LayoutTests:

* accessibility/mac/text-marker-for-index-expected.txt: Added.
* accessibility/mac/text-marker-for-index.html: Added.
* accessibility/mac/text-marker-word-nav-expected.txt:
* accessibility/mac/text-marker-word-nav.html:

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

4 years agoFont antialiasing (smoothing) changes when elements are rendered into compositing...
simon.fraser@apple.com [Fri, 11 Mar 2016 01:49:22 +0000 (01:49 +0000)]
Font antialiasing (smoothing) changes when elements are rendered into compositing layers
https://bugs.webkit.org/show_bug.cgi?id=23364

Reviewed by Tim Horton.

Source/WebCore:

Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
by opting in to a new CALayer backing store format.

GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
when the platform has support for the new feature. Ideally this would only be set when
we know a layer has smoothed text drawn into it, but, for now, enable this for all
layers. The right thing happens with opaque layers under the hood.

setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
is ultimately passed to setBackingStoreFormat().

We also need to propagate this flag to TileController tiles.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::supportsSmoothedLayerText):
(WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
(WebCore::GraphicsLayer::smoothedLayerTextEnabled):
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::supportsSmoothedFonts):
(WebCore::GraphicsLayer::setSupportsSmoothedFonts):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::supportsSmoothedLayerText):
(WebCore::GraphicsLayer::setSmoothedLayerTextEnabled):
(WebCore::GraphicsLayer::smoothedLayerTextEnabled):
(WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateContentsFormat):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
the contents format says we support smoothed fonts.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setTileContentsFormatFlags):
(WebCore::TileController::createTileLayer):
* platform/graphics/ca/TileController.h:
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::updateTileLayerProperties):
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::setBackingStoreFormat):
(PlatformCALayerCocoa::commonInit):
(PlatformCALayerCocoa::setContentsFormat):
(PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
non-opaque layers to improve text appearance. We no longer need to do that when
the contents format has "SmoothedFonts".
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::setContentsFormat):
(PlatformCALayerWin::contentsFormat):
* platform/graphics/ca/win/PlatformCALayerWin.h:
* platform/ios/LegacyTileGridTile.mm:
(WebCore::setBackingStoreFormat):
(WebCore::LegacyTileGridTile::LegacyTileGridTile):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):

Source/WebKit/mac:

Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
can disable it.

* WebView/WebView.mm:
(+[WebView _setSmoothedLayerTextEnabled:]):
(+[WebView _smoothedLayerTextEnabled]):
* WebView/WebViewPrivate.h:

Source/WebKit2:

Send the ContentsFormat to the UI process (but nothing happens to it there yet).

Allow internal clients to turn off smoothed layer text, so that WebKitTestRunner
can disable it.

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* UIProcess/API/C/WKContext.cpp:
(WKContextEnableSmoothedLayerText):
* UIProcess/API/C/WKContextPrivate.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::enableSmoothedLayerText):
(WebKit::WebProcessPool::WebProcessPool): Deleted.
* UIProcess/WebProcessPool.h:
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setContentsFormat):
(WebKit::PlatformCALayerRemote::contentsFormat):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::enableSmoothedLayerText):
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:

Tools:

Turn off smoothed layer text because it affects many layout test results.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

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

4 years agoUnreviewed, rolling out r197922.
ryanhaddad@apple.com [Fri, 11 Mar 2016 01:46:31 +0000 (01:46 +0000)]
Unreviewed, rolling out r197922.
https://bugs.webkit.org/show_bug.cgi?id=155340

This change broke storage/websql tests on ios-simulator.
(Requested by ryanhaddad on #webkit).

Reverted changeset:

"WebKit should adopt journal_mode=wal for all SQLite
databases."
https://bugs.webkit.org/show_bug.cgi?id=133496
http://trac.webkit.org/changeset/197922

Patch by Commit Queue <commit-queue@webkit.org> on 2016-03-10

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

4 years ago[Cocoa] Test gardening after r197933
mmaxfield@apple.com [Fri, 11 Mar 2016 01:41:12 +0000 (01:41 +0000)]
[Cocoa] Test gardening after r197933
<rdar://problem/25091368>

Unreviewed.

* fast/text/woff2-expected.html:
* fast/text/woff2.html:

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

4 years agoFix the build again.
timothy_horton@apple.com [Fri, 11 Mar 2016 01:34:11 +0000 (01:34 +0000)]
Fix the build again.

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

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

4 years agoFix the build.
timothy_horton@apple.com [Fri, 11 Mar 2016 01:32:12 +0000 (01:32 +0000)]
Fix the build.

* editing/cocoa/DataDetection.mm:

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

4 years agoExpose additional WKDataDetectorTypes.
enrica@apple.com [Fri, 11 Mar 2016 01:06:48 +0000 (01:06 +0000)]
Expose additional WKDataDetectorTypes.
https://bugs.webkit.org/show_bug.cgi?id=155331
rdar://problem/24175813

Reviewed by Tim Horton.

Source/WebCore:

Adding support for additional data detector types (tracking
numbers, flight information and spotlight suggestions).

* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::constructURLStringForResult):
(WebCore::DataDetection::detectContentInRange):
* platform/cocoa/DataDetectorsCoreSoftLink.h:
* platform/cocoa/DataDetectorsCoreSoftLink.mm:
* platform/spi/cocoa/DataDetectorsCoreSPI.h:

Source/WebKit2:

Adding API to enable data detection of tracking numbers,
flight number and spotlight suggestions.

* UIProcess/API/Cocoa/WKWebView.mm:
(fromWKDataDetectorTypes):
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:

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

4 years agoWeb Inspector: color swatch and border are misaligned in Visual Styles sidebar
commit-queue@webkit.org [Fri, 11 Mar 2016 01:03:38 +0000 (01:03 +0000)]
Web Inspector: color swatch and border are misaligned in Visual Styles sidebar
https://bugs.webkit.org/show_bug.cgi?id=154471

Patch by Daniel Strokis <dstrokis@icloud.com> on 2016-03-10
Reviewed by Timothy Hatcher.

Color swatches in the Visual Styles sidebar now have only their left corners rounded (thanks to Matt Baker for the idea).

* UserInterface/Views/InlineSwatch.css:
(.inline-swatch > span):
(.inline-swatch): Deleted.
* UserInterface/Views/VisualStyleColorPicker.css:
(.visual-style-property-container.input-color-picker > .visual-style-property-value-container > .inline-swatch.color):

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

4 years agoWeb Inspector: Timelines UI redesign: remove navigation sidebar
mattbaker@apple.com [Fri, 11 Mar 2016 00:49:16 +0000 (00:49 +0000)]
Web Inspector: Timelines UI redesign: remove navigation sidebar
https://bugs.webkit.org/show_bug.cgi?id=153036
<rdar://problem/24195627>

Reviewed by Timothy Hatcher.

Removed TimelineView methods used by the sidebar to setup the content tree
outline and handle tree element events, which are no longer used. Tree elements
are no longer created by TimelineViews as records are processed.

* UserInterface/Main.html:
Removed files.

* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView):
Removed tree outline event listeners and data grid parameter.
(WebInspector.LayoutTimelineView.prototype._processPendingRecords):
(WebInspector.LayoutTimelineView.prototype._dataGridFiltersDidChange):
(WebInspector.LayoutTimelineView.prototype._hoveredOrSelectedRecord):
Get record from data grid node instead of tree element.
(WebInspector.LayoutTimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
(WebInspector.LayoutTimelineView.prototype._mouseOverTreeOutline): Deleted.
(WebInspector.LayoutTimelineView.prototype._mouseLeaveTreeOutline): Deleted.
No longer needed, highlighting performed by data grid event handlers.

* UserInterface/Views/MemoryTimelineView.js:
(WebInspector.MemoryTimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
No longer needed.

* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype._updateFilter): Deleted.
Removed hack which was specific to TimelineSidebarPanel.

* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView):
Removed sidebar styles and tree outline data grid parameter.
(WebInspector.NetworkTimelineView.prototype._processPendingRecords):
(WebInspector.NetworkTimelineView.prototype._dataGridFiltersDidChange):
(WebInspector.NetworkTimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
(WebInspector.NetworkTimelineView.prototype.treeElementSelected): Deleted.
No longer needed.

* UserInterface/Views/OverviewTimelineView.js:
(WebInspector.OverviewTimelineView):
(WebInspector.OverviewTimelineView.prototype.get selectionPathComponents):
(WebInspector.OverviewTimelineView.prototype.dataGridNodePathComponentSelected):
Create path components from the grid selection. This should have been
included in https://webkit.org/b/154954.

(WebInspector.OverviewTimelineView.prototype._compareDataGridNodesByStartTime.getStartTime):
(WebInspector.OverviewTimelineView.prototype._compareDataGridNodesByStartTime):
(WebInspector.OverviewTimelineView.prototype._insertDataGridNode):
(WebInspector.OverviewTimelineView.prototype._addResourceToDataGridIfNeeded):
(WebInspector.OverviewTimelineView.prototype._addSourceCodeTimeline):
Refactored to accept grid nodes instead of tree elements.

(WebInspector.OverviewTimelineView.prototype._processPendingRepresentedObjects):
(WebInspector.OverviewTimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
(WebInspector.OverviewTimelineView.prototype.shown):
(WebInspector.OverviewTimelineView.prototype.treeElementPathComponentSelected): Deleted.
(WebInspector.OverviewTimelineView.prototype._compareTreeElementsByDetails): Deleted.
Not used anywhere.

(WebInspector.OverviewTimelineView.prototype._compareTreeElementsByStartTime.getStartTime): Deleted.
(WebInspector.OverviewTimelineView.prototype._compareTreeElementsByStartTime): Deleted.
(WebInspector.OverviewTimelineView.prototype._insertTreeElement): Deleted.
(WebInspector.OverviewTimelineView.prototype._addResourceToTreeIfNeeded): Deleted.
Reimplemented as _compareDataGridNodesByStartTime, _insertDataGridNode and _addResourceToDataGridIfNeeded.

* UserInterface/Views/RenderingFrameTimelineView.js:
(WebInspector.RenderingFrameTimelineView):
Removed sidebar styles and tree outline data grid parameter.

(WebInspector.RenderingFrameTimelineView.prototype.get selectionPathComponents):
(WebInspector.RenderingFrameTimelineView.prototype.dataGridNodePathComponentSelected):
Create path components from the grid selection. This should have been
included in https://webkit.org/b/154954.

(WebInspector.RenderingFrameTimelineView.prototype._processPendingRecords):
(WebInspector.RenderingFrameTimelineView.prototype._scopeBarSelectionDidChange):
(WebInspector.RenderingFrameTimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
(WebInspector.RenderingFrameTimelineView.prototype.treeElementDeselected): Deleted.
(WebInspector.RenderingFrameTimelineView.prototype.treeElementSelected): Deleted.
(WebInspector.RenderingFrameTimelineView.prototype.treeElementPathComponentSelected): Deleted.

* UserInterface/Views/ScriptClusterTimelineView.js:
(WebInspector.ScriptClusterTimelineView):
Don't hold reference to extraArguments, just pass to subviews.

* UserInterface/Views/ScriptDetailsTimelineView.js:
(WebInspector.ScriptDetailsTimelineView):
Removed sidebar styles and tree outline data grid parameter.
(WebInspector.ScriptDetailsTimelineView.prototype._processPendingRecords):
(WebInspector.ScriptDetailsTimelineView.prototype._dataGridFiltersDidChange):
(WebInspector.ScriptDetailsTimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
(WebInspector.ScriptDetailsTimelineView.prototype.treeElementSelected): Deleted.
(WebInspector.ScriptDetailsTimelineView.prototype.dataGridNodeForTreeElement): Deleted.
(WebInspector.ScriptDetailsTimelineView.prototype.populateProfileNodeTreeElement): Deleted.

* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype.addRowInSortOrder):
Fixed failure when treeElement and parentTreeElementOrDataGridNode are both null.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
Removed extraArguments and sidebar panel references.
(WebInspector.TimelineRecordingContentView.prototype.contentBrowserTreeElementForRepresentedObject):
Use icon style from the tab, instead of the sidebar.
(WebInspector.TimelineRecordingContentView.prototype._currentContentViewDidChange):
Removed updates to the sidebar.
(WebInspector.TimelineRecordingContentView.prototype._pathComponentSelected):
(WebInspector.TimelineRecordingContentView.prototype._updateTimes):
(WebInspector.TimelineRecordingContentView.prototype._instrumentAdded):
Removed sidebar reference when creating new TimelineViews.
(WebInspector.TimelineRecordingContentView.prototype._timeRangeSelectionChanged):

* UserInterface/Views/TimelineSidebarPanel.css: Removed.

* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView):
Removed hidden sidebar FIXME.
(WebInspector.TimelineTabContentView.prototype._addRecording):
New location for sidebar style class constant StopwatchIconStyleClass.

* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView):
(WebInspector.TimelineView.prototype.get navigationItems): Deleted.
(WebInspector.TimelineView.prototype.get navigationSidebarTreeOutline): Deleted.
(WebInspector.TimelineView.prototype.get navigationSidebarTreeOutlineLabel): Deleted.
(WebInspector.TimelineView.prototype.get timelineSidebarPanel): Deleted.
(WebInspector.TimelineView.prototype.treeElementPathComponentSelected): Deleted.
(WebInspector.TimelineView.prototype.treeElementDeselected): Deleted.
(WebInspector.TimelineView.prototype.treeElementSelected): Deleted.
(WebInspector.TimelineView.prototype._treeSelectionDidChange): Deleted.
Sidebar logic for panel and content tree outline removed.

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

4 years agodefaultActions in UIDelegate method
bdakin@apple.com [Fri, 11 Mar 2016 00:47:31 +0000 (00:47 +0000)]
defaultActions in UIDelegate method
_webView:previewingViewControllerForElement:defaultActions: need to be
use-able by a client
https://bugs.webkit.org/show_bug.cgi?id=155304
-and corresponding-
rdar://problem/24269296

Reviewed by Anders Carlsson.

This patch adds a new protocol, WKPreviewActionItem, which is a sub-protocol
of UIPreviewActionItem. The new protocol adds an identifier so that clients
can identify which of our default actions they want to use. In order for a
client to use our default action items, they need to return those actions in
their UIViewController's implementation of previewActionItems.

Change the defaultActions to NSArray <id <WKPreviewActionItem>> *
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:

This new file defines our sub-protocol and sub-class for WKPreviewActions.
* UIProcess/API/Cocoa/_WKPreviewAction.h: Added.
* UIProcess/API/Cocoa/_WKPreviewAction.mm: Added.
(+[_WKPreviewAction actionWithIdentifier:title:style:handler:]):

New BOOL _uiDelegateProvidedPreviewingViewController keeps track of whether
the client returned a view controller from
_webView:previewingViewControllerForElement:defaultActions:. If they did
return a view controller, then we should invoke
_webView:commitPreviewingViewController: at commit time. If they returned
nil, then they indicated that WebKit should continue with default previewing
behavior, so we will not invoke the UIDelegate’s commit method.
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _registerPreview]):
(-[WKContentView _unregisterPreview]):
(-[WKContentView _interactionShouldBeginFromPreviewItemController:forPosition:]):

In order for our default actions to be useful, we have to create
_WKPreviewActions.
(-[WKContentView _presentedViewControllerForPreviewItemController:]):

Only invoke _webView:commitPreviewedViewController: if
_uiDelegateProvidedPreviewingViewController is YES.
(-[WKContentView _previewItemController:commitPreview:]):
* WebKit2.xcodeproj/project.pbxproj:

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

4 years agoCSP: Implement frame-ancestors directive
dbates@webkit.org [Fri, 11 Mar 2016 00:45:13 +0000 (00:45 +0000)]
CSP: Implement frame-ancestors directive
https://bugs.webkit.org/show_bug.cgi?id=154345
<rdar://problem/24702161>

Reviewed by Brent Fulgham.

Source/WebCore:

Add support for the Content Security Policy directive frame-ancestors per the Content Security
Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.

Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-meta-element-ignored.html
       http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-report-only-ignored.html
       http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https.html
       http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin.html
       http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https.html
       http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin.html

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied): Extracted from DocumentLoader::responseReceived().
(WebCore::DocumentLoader::responseReceived): Extracted logic to cancel a load and dispatch a DOM Load
event at the frame owner into DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
Make use of this function when loading of the frame is blocked by either the Content Security Policy or
the X-Frame-Option policy. We explicitly instantiate a ContentSecurityPolicy object with a SecurityOrigin
and Frame instead of using ScriptExecutionContext m_frame->document() because m_frame->document() is not
in a stable state (for instance, Document::m_url has not been initialized) as we are in the process of
loading the underlying document data for it.
* loader/DocumentLoader.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument): Pass ContentSecurityPolicy::ReportParsingErrors::No to silence
errors raised when parsing the Content Security Policy headers to avoid duplicate error messages. Any
parsing errors would have been raised when we parsed the Content Security Policy in DocumentLoader.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Modified to take an optional pointer to a Frame (defaults
to nullptr). The specified Frame is used to support emitting console messages for violations/syntax errors and
send violation reports. We make use of this constructor variant in DocumentLoader to support emitting console
message and sending violation reports in the context of DocumentLoader where its associated Document is not in a
stable state and making use of a Frame seems less error prone.
(WebCore::ContentSecurityPolicy::didReceiveHeaders): Modified to take argument reportParsingErrors as
to whether to silence parsing errors when parsing the specified headers.
(WebCore::isAllowedByAllWithFrame): Helper function to query a ContentSecurityPolicyDirectiveList function
passing a Frame and URL for each Content Security Policy.
(WebCore::ContentSecurityPolicy::allowFrameAncestors): Calls WebCore::isAllowedByAllWithFrame().
(WebCore::ContentSecurityPolicy::reportViolation): Modified to support sending a violation report when
we have a Frame and no ScriptExecutionContext (such as when we are instantiated in DocumentLoader).
Additionally, we only will send a report if reporting is enabled (i.e. ContentSecurityPolicy::m_isReportingEnabled == true).
(WebCore::ContentSecurityPolicy::logToConsole): Modified to support logging a message to the console
we have a Frame and no ScriptExecutionContext. We also only allow logging if reporting is enabled.
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkFrameAncestors): Added.
(WebCore::ContentSecurityPolicyDirectiveList::checkFrameAncestorsAndReportViolation): Added.
(WebCore::ContentSecurityPolicyDirectiveList::allowFrameAncestors): Added.
(WebCore::ContentSecurityPolicyDirectiveList::parse): Ignore the directive frame-ancestors when defined
in a policy given in an HTML meta element and report such use as invalid.
(WebCore::ContentSecurityPolicyDirectiveList::addDirective): Parse the directive frame-ancestors.
* page/csp/ContentSecurityPolicyDirectiveList.h:
* page/csp/ContentSecurityPolicyResponseHeaders.h: Mark constructor "explicit".

LayoutTests:

Adds new tests to ensure we ignore directive frame-ancestors when defined a policy delivered
in an HTML meta element or in a report-only policy (i.e. delivered via HTTP header Content-
Security-Policy-Report-Only). Also adds new test to ensure that we send a violation report
when the directive frame-ancestors is violated.

Updated many existing tests and test results that unnecessarily depended on a DOM SecurityError
exception being thrown when accessing the content of a cross-origin frame. It is sufficient
and more direct to test directive frame-ancestors by dumping the contents of all children frames
on the page. We design the tests such that a child frame that was blocked by the frame-ancestors
directive is expected to have no content. A child frame that was allowed by the frame-ancestors
directive is expected to have content.

* TestExpectations: Mark frame-ancestors tests as PASS so that we run them.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-meta-element-ignored-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-meta-element-ignored.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-report-only-ignored-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-in-report-only-ignored.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-none-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-none-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-self-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-self-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-star-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-star-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-cross-url-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-none-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-none-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-self-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-self-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-star-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-star-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-url-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-url-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-url-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-same-url-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-none-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-none-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-self-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-self-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-star-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-star-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-url-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-url-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-url-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-cross-url-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-none-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-none-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-self-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-self-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-star-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-star-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-url-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-url-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-url-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-same-in-same-url-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-none-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-none-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-protocolless-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-protocolless-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-self-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-self-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-self-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-self-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-star-allow-crossorigin-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-star-allow-crossorigin.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-star-allow-sameorigin-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-star-allow-sameorigin.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-url-allow-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-url-allow.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-url-block-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-url-block.html:
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin-https.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-cross-origin.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin-https.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/report-frame-ancestors-same-origin.html: Added.
* http/tests/security/contentSecurityPolicy/resources/echo-intertag.pl: Added.
* http/tests/security/contentSecurityPolicy/resources/frame-ancestors-test.js:
(done): Added.
(injectIFrame): Modified to make use of handleFrameEvent().
(handleFrameEvent): Added.
(iframeLoaded): Deleted.
* http/tests/security/contentSecurityPolicy/resources/frame-in-frame.pl:

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

4 years agoWeb Inspector: Enable Memory Timelines by default if supported
joepeck@webkit.org [Fri, 11 Mar 2016 00:44:20 +0000 (00:44 +0000)]
Web Inspector: Enable Memory Timelines by default if supported
https://bugs.webkit.org/show_bug.cgi?id=155333
<rdar://problem/25097319>

Reviewed by Timothy Hatcher.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.defaultInstruments):

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

4 years ago[ES6] Instanceof isn't spec compliant when the RHS is a Proxy with a target that...
sbarati@apple.com [Fri, 11 Mar 2016 00:43:46 +0000 (00:43 +0000)]
[ES6] Instanceof isn't spec compliant when the RHS is a Proxy with a target that is a function
https://bugs.webkit.org/show_bug.cgi?id=155329

Reviewed by Mark Lam.

We use type info flags on the structure to dictate whether or not
the RHS of an instanceof is a valid RHS (i.e, a function). The solution
to make Proxy a valid RHS when the Proxy's target is callable is to have
two different structures for ProxyObject: one for a non-callable target
and one for a callable target.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildren):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::moduleRecordStructure):
(JSC::JSGlobalObject::moduleNamespaceObjectStructure):
(JSC::JSGlobalObject::proxyObjectStructure):
(JSC::JSGlobalObject::callableProxyObjectStructure):
(JSC::JSGlobalObject::proxyRevokeStructure):
(JSC::JSGlobalObject::wasmModuleStructure):
* runtime/ProxyConstructor.cpp:
(JSC::makeRevocableProxy):
(JSC::constructProxyObject):
(JSC::ProxyConstructor::getConstructData):
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::ProxyObject):
(JSC::ProxyObject::structureForTarget):
(JSC::ProxyObject::finishCreation):
* runtime/ProxyObject.h:
(JSC::ProxyObject::create):
(JSC::ProxyObject::createStructure):
* tests/es6.yaml:
* tests/stress/proxy-instanceof.js: Added.
(assert):
(test):
(C):
(test.let.handler.get if):
(test.let.handler):

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

4 years agoAdd shouldNotBe to standalone test harness
commit-queue@webkit.org [Fri, 11 Mar 2016 00:42:18 +0000 (00:42 +0000)]
Add shouldNotBe to standalone test harness
https://bugs.webkit.org/show_bug.cgi?id=155300

Patch by Andy VanWagoner <andy@instructure.com> on 2016-03-10
Reviewed by Saam Barati.

Copy over the shouldNotBe function from js-test-pre. This fixes errors
introduced be new Intl tests.

* resources/standalone-pre.js:
(shouldNotBe):

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

4 years agoAdd WebCore, WebKit, & WebKit2 preference/setting to enable Main Content heuristic.
jer.noble@apple.com [Fri, 11 Mar 2016 00:34:57 +0000 (00:34 +0000)]
Add WebCore, WebKit, & WebKit2 preference/setting to enable Main Content heuristic.
https://bugs.webkit.org/show_bug.cgi?id=155326
<rdar://problem/25095408>

Reviewed by Beth Dakin.

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Set the OverrideUserGestureRequirementForMainContent if the new setting is enabled.
* page/Settings.in:

Source/WebKit/mac:

Add SPI to get and set the new preference.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences overrideUserGestureRequirementForMainContent]):
(-[WebPreferences setOverrideUserGestureRequirementForMainContent:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Add SPI to get and set the new preference.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetMainContentUserGestureOverrideEnabled):
(WKPreferencesGetMainContentUserGestureOverrideEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration _mainContentUserGestureOverrideEnabled]):
(-[WKWebViewConfiguration _setMainContentUserGestureOverrideEnabled:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

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

4 years agoREGRESSION: GuardMallloc crash in SVGListPropertyTearOff<SVGPointList>::processIncomi...
said@apple.com [Fri, 11 Mar 2016 00:32:51 +0000 (00:32 +0000)]
REGRESSION: GuardMallloc crash in SVGListPropertyTearOff<SVGPointList>::processIncomingListItemWrapper
https://bugs.webkit.org/show_bug.cgi?id=154969

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

The life cycle of the SVGAnimatedPropertyTearOff::m_baseVal and m_animVal
was not correct. Like what was done in SVGAnimatedListPropertyTearOff,
m_baseVal and m_animVal have to be raw RefCounted pointers. When requested
through, SVGAnimatedPropertyTearOff::baseVal() and animVal() they are
encapsulated in a RefPtr to ensure they existence as long as they are
referenced. When the animated property object (which is stored in either
m_baseVal or m_animVal) is not referenced by anyone, it is going to be
deleted. In the destructor of their class, SVGAnimatedPropertyTearOff
will be notified of this deletion through propertyWillBeDeleted() to clean
its member m_baseVal or m_animVal.

* bindings/scripts/CodeGeneratorJS.pm:
(NativeToJSValue): Now all the SVG animated property return RefPtrs. In
addition to that, SVGViewSpec.transform also returns
RefPtr<SVGTransformListPropertyTearOff>.

* svg/properties/SVGAnimatedListPropertyTearOff.h:
(WebCore::SVGAnimatedListPropertyTearOff::animVal):
(WebCore::SVGAnimatedListPropertyTearOff::currentAnimatedValue):
(WebCore::SVGAnimatedListPropertyTearOff::animationStarted):
(WebCore::SVGAnimatedListPropertyTearOff::animationEnded):
(WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
(WebCore::SVGAnimatedListPropertyTearOff::isAnimating):
(WebCore::SVGAnimatedListPropertyTearOff::propertyWillBeDeleted):
Change propertyWillBeDeleted() to be virtual and make it takes an SVGProperty*.
Rename m_animatingAnimVal to be m_animatedProperty. Add isAnimating() which
returns true if m_animatedProperty is not null. Use isAnimating() instead of
m_isAnimating because it's deleted from the base class.

* svg/properties/SVGAnimatedProperty.cpp:
(WebCore::SVGAnimatedProperty::SVGAnimatedProperty):
(WebCore::SVGAnimatedProperty::~SVGAnimatedProperty):
* svg/properties/SVGAnimatedProperty.h:
(WebCore::SVGAnimatedProperty::isAnimating):
(WebCore::SVGAnimatedProperty::propertyWillBeDeleted):
Delete m_isAnimating since its value can be deduced from the value of
m_animatedProperty in the derived class. Add propertyWillBeDeleted() and
isAnimating() as virtual functions with the default behavior.

* svg/properties/SVGAnimatedPropertyTearOff.h:
(WebCore::SVGAnimatedPropertyTearOff::baseVal):
(WebCore::SVGAnimatedPropertyTearOff::animVal):
Like SVGAnimatedListPropertyTearOff::baseVal() and animVal() create the
value if it does not exist. Keep a raw RefCounted pointer but return a
RefPtr.

(WebCore::SVGAnimatedPropertyTearOff::isAnimating):
(WebCore::SVGAnimatedPropertyTearOff::propertyWillBeDeleted):
Override virtual functions.

(WebCore::SVGAnimatedPropertyTearOff::currentAnimatedValue):
(WebCore::SVGAnimatedPropertyTearOff::animationStarted):
(WebCore::SVGAnimatedPropertyTearOff::animationEnded):
(WebCore::SVGAnimatedPropertyTearOff::animValWillChange):
(WebCore::SVGAnimatedPropertyTearOff::animValDidChange):
Replace m_isAnimating with isAnimating(). Ensure that we get a new animated
property through animVal() and store it in a RefPtr to ensure it will not
go away while animating.

* svg/properties/SVGAnimatedStaticPropertyTearOff.h:
(WebCore::SVGAnimatedStaticPropertyTearOff::isAnimating):
(WebCore::SVGAnimatedStaticPropertyTearOff::currentAnimatedValue):
(WebCore::SVGAnimatedStaticPropertyTearOff::animationStarted):
(WebCore::SVGAnimatedStaticPropertyTearOff::animationEnded):
(WebCore::SVGAnimatedStaticPropertyTearOff::animValWillChange):
(WebCore::SVGAnimatedStaticPropertyTearOff::animValDidChange):
Add isAnimating() and replace all the instances of m_isAnimating with calls
to isAnimating().

* svg/properties/SVGPropertyTearOff.h:
(WebCore::SVGPropertyTearOff::animatedProperty):
(WebCore::SVGPropertyTearOff::setAnimatedProperty):
(WebCore::SVGPropertyTearOff::contextElement):
(WebCore::SVGPropertyTearOff::SVGPropertyTearOff):
(WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
SVGPropertyTearOff is what SVGAnimatedPropertyTearOff creates for its
baseVal() and animVal() values. These values can be null anytime once
they are not referenced. The SVGAnimatedPropertyTearOff holds only raw
RefCounted pointer for them. So (1) SVGPropertyTearOff needs to hold a
RefPtr for its SVGAnimatedProperty and (2) it needs to notify its
SVGAnimatedProperty when it's deleted by calling propertyWillBeDeleted()
from the destructor. Also there is no need to get the contextElement()
and save it in class member, m_contextElement since it can be always be
retrieved from SVGAnimatedProperty::contextElement().

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

4 years agoRebaseline two inspector tests after r197954 changed the results.
ryanhaddad@apple.com [Fri, 11 Mar 2016 00:05:58 +0000 (00:05 +0000)]
Rebaseline two inspector tests after r197954 changed the results.

Unreviewed test gardening.

* inspector/debugger/command-line-api-exception-expected.txt:
* platform/mac/inspector/model/remote-object-expected.txt:

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

4 years agoRemove firing assertion after r197865.
achristensen@apple.com [Thu, 10 Mar 2016 23:54:47 +0000 (23:54 +0000)]
Remove firing assertion after r197865.
https://bugs.webkit.org/show_bug.cgi?id=155137
rdar://problem/25096835

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveData:]):
This assertion was firing.  I'm looking into why.

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

4 years agoPartial roll-out of r197953; test fails because encode/decode support of those proper...
jer.noble@apple.com [Thu, 10 Mar 2016 23:50:20 +0000 (23:50 +0000)]
Partial roll-out of r197953; test fails because encode/decode support of those properties were never added.

* TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
(TEST): Deleted.

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

4 years ago[ES6] RegExp sticky flag should be ignored in String.match when global flag is given
msaboff@apple.com [Thu, 10 Mar 2016 23:48:58 +0000 (23:48 +0000)]
[ES6] RegExp sticky flag should be ignored in String.match when global flag is given
https://bugs.webkit.org/show_bug.cgi?id=155332

Reviewed by Saam Barati.

Removed logic from stringProtoFuncMatch that handles the case where both global and sticky flags are set.

* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncMatch):

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

4 years ago[ES6] Allow RegExp constructor to take pattern from an existing RegExp with new flags
msaboff@apple.com [Thu, 10 Mar 2016 23:38:15 +0000 (23:38 +0000)]
[ES6] Allow RegExp constructor to take pattern from an existing RegExp with new flags
https://bugs.webkit.org/show_bug.cgi?id=155315

Reviewed by Saam Barati.

Source/JavaScriptCore:

Changed to comply with section 21.2.3.1, step 5.  Eliminated syntax error.

In the process, change to get the VM at the top of the function.

Updated tests accordingly.

* runtime/RegExpConstructor.cpp:
(JSC::constructRegExp):
* tests/es6.yaml: Changed miscellaneous_RegExp_constructor_can_alter_flags.js to normal.
* tests/mozilla/mozilla-tests.yaml: Disabled ecma_3/RegExp/15.10.4.1-5-n.js as it checks
for the old behavior of throwing a syntax error.

LayoutTests:

New and updated test for change.

* fast/regex/constructor-expected.txt:
* fast/regex/script-tests/constructor.js:
Changed test for new behavior.`

* js/regexp-old-regexp-new-flags-expected.txt: Added.
* js/regexp-old-regexp-new-flags.html: Added.
* js/script-tests/regexp-old-regexp-new-flags.js: Added.
New test.

* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T1-expected.txt: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T1.html: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T2-expected.txt: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.3/S15.10.3.1_A2_T2.html: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T1-expected.txt: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T1.html: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T2-expected.txt: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A2_T2.html: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A8_T8-expected.txt: Removed.
* sputnik/Conformance/15_Native_Objects/15.10_RegExp/15.10.4/S15.10.4.1_A8_T8.html: Removed.
Removed obsolete tests.

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

4 years agoWeb Inspector: Add "Quick Open" dialog to debugger and resources tabs
mattbaker@apple.com [Thu, 10 Mar 2016 23:18:55 +0000 (23:18 +0000)]
Web Inspector: Add "Quick Open" dialog to debugger and resources tabs
https://bugs.webkit.org/show_bug.cgi?id=153028
<rdar://problem/24194239>

Reviewed by Timothy Hatcher.

* Localizations/en.lproj/localizedStrings.js:
New placeholder text for open resource dialog field.

* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
Keep a reference to the content element to use as global dialog parent,
and create keyboard shortcut for new dialog.

(WebInspector._showOpenResourceDialog):
Create dialog if needed, return if already visible.
(WebInspector.dialogWasDismissed):
Show represented object, if any, when dialog is dismissed.

* UserInterface/Main.html:
New files.

* UserInterface/Views/Dialog.js: Added.
Base class for modal dialog popovers. Implements basic setup and
teardown, and logic for validating and returning a represented object.

(WebInspector.Dialog):
(WebInspector.Dialog.prototype.get visible):
(WebInspector.Dialog.prototype.get delegate):
(WebInspector.Dialog.prototype.get representedObject):
(WebInspector.Dialog.prototype.present):
(WebInspector.Dialog.prototype.dismiss):
(WebInspector.Dialog.prototype.didPresetDialog):
(WebInspector.Dialog.prototype.representedObjectIsValid):

* UserInterface/Views/GoToLineDialog.js:
Subclass the Dialog base class.
(WebInspector.GoToLineDialog):
(WebInspector.GoToLineDialog.prototype.didPresentDialog):
Implement base class behavior hook. Replaces "present".
(WebInspector.GoToLineDialog.prototype._handleInputEvent):
(WebInspector.GoToLineDialog.prototype._handleKeydownEvent):
Line number validation handled by base class/delegate.
(WebInspector.GoToLineDialog.prototype._clear):
(WebInspector.GoToLineDialog.prototype.present): Deleted.
(WebInspector.GoToLineDialog.prototype.dismiss): Deleted.
No longer needed, handled by base class.

* UserInterface/Views/OpenResourceDialog.css: Added.
(.open-resource-dialog):
(.open-resource-dialog > .field):
(.open-resource-dialog > .field > input):
(.open-resource-dialog > .field > input::-webkit-input-placeholder):
(.open-resource-dialog > .field > img):
(.open-resource-dialog > .field > img:active):
(.open-resource-dialog.non-empty > .field > img):
(.open-resource-dialog > .tree-outline):
(.open-resource-dialog > .tree-outline .item):
(.open-resource-dialog > .tree-outline .item:first-child):
(.open-resource-dialog > .tree-outline .item.selected):
(.open-resource-dialog > .tree-outline .item.selected .subtitle):
Styles for "quick open" dialog.

* UserInterface/Views/OpenResourceDialog.js: Added.
New dialog type, based on the Quick Open dialog found in Xcode (and its
equivalent in most modern editors).

(WebInspector.OpenResourceDialog):
(WebInspector.OpenResourceDialog.prototype._populateResourceTreeOutline.createTreeElement):
(WebInspector.OpenResourceDialog.prototype._populateResourceTreeOutline):
Populate the auto-completion tree from the list of filtered resources.

(WebInspector.OpenResourceDialog.prototype.didPresentDialog):
Build resource list once, when the dialog is presented. Update the list
when resources are added/removed in a follow-up: https://webkit.org/b/155321.

(WebInspector.OpenResourceDialog.prototype._handleInputEvent):
(WebInspector.OpenResourceDialog.prototype._handleKeydownEvent):
Escape key: dismiss dialog if input is empty, otherwise clear input.
Enter key: dismiss dialog if object selected.
Key up/down: cycle through auto-completion tree items, if any.

(WebInspector.OpenResourceDialog.prototype._handleKeyupEvent):
(WebInspector.OpenResourceDialog.prototype._handleBlurEvent):
(WebInspector.OpenResourceDialog.prototype._handleMousedownEvent):
(WebInspector.OpenResourceDialog.prototype._handleClickEvent):
(WebInspector.OpenResourceDialog.prototype._clear):
(WebInspector.OpenResourceDialog.prototype._updateFilter):
Rebuild filter regular expressions and apply to all resources. Each
resource is given a weight based on the first matching filter. Filters
are ordered by relevancy, from most to least relevant. Filtered resources
are sorted based on weight. If no matches are found, the tree is hidden.

* UserInterface/Views/ResourceTreeElement.js:
(WebInspector.ResourceTreeElement.prototype.get filterableData):
make filterable resource data more fine-grained. Priority should be given
to the resource's name, before the complete URL.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.showGoToLineDialog):
(WebInspector.SourceCodeTextEditor.prototype.dialogWasDismissed):
(WebInspector.SourceCodeTextEditor.prototype.goToLineDialogValueWasValidated): Deleted.
(WebInspector.SourceCodeTextEditor.prototype.goToLineDialogWasDismissed): Deleted.
Updated for new Dialog delegate behavior.

* UserInterface/Views/TreeOutline.css:
(.tree-outline.large .item .titles):
(.tree-outline.large .item .titles.no-subtitle): Deleted.
Styles for tree elements in "quick open" dialog auto-completion tree.

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

4 years ago[ES6] Make ToPropertyDescriptor spec compliant
sbarati@apple.com [Thu, 10 Mar 2016 23:09:30 +0000 (23:09 +0000)]
[ES6] Make ToPropertyDescriptor spec compliant
https://bugs.webkit.org/show_bug.cgi?id=155313

Reviewed by Mark Lam.

We were performing HasProperty(.) and Get(.) in the same operation.
This isn't valid according to the spec and it's user observable
behavior with Proxy. This patch fixes ToPropertyDescriptor to use
two distinct operations for HasProperty(.) and Get(.).

* runtime/ObjectConstructor.cpp:
(JSC::ownEnumerablePropertyKeys):
(JSC::toPropertyDescriptor):
* tests/es6.yaml:
* tests/stress/to-property-key-correctness.js: Added.
(assert):
(test):
(test.let.handler.has):
(arrayEq):
(let.handler.has):
(let.target):
(set get let):

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

4 years agoWeb Inspector: report the underlying parser error message when JSON parsing fails
bburg@apple.com [Thu, 10 Mar 2016 23:02:58 +0000 (23:02 +0000)]
Web Inspector: report the underlying parser error message when JSON parsing fails
https://bugs.webkit.org/show_bug.cgi?id=155303
<rdar://problem/25088939>

Reviewed by Timothy Hatcher.

* inspector/scripts/generate-inspector-protocol-bindings.py:
(generate_from_specification.load_specification):
Stringize the underlying error so we can see what it says.

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

4 years agoWeb Inspector: TreeOutlineDataGridSynchronizer should be optional in TimelineDataGrid
mattbaker@apple.com [Thu, 10 Mar 2016 22:58:29 +0000 (22:58 +0000)]
Web Inspector: TreeOutlineDataGridSynchronizer should be optional in TimelineDataGrid
https://bugs.webkit.org/show_bug.cgi?id=155318
<rdar://problem/25091949>

Reviewed by Timothy Hatcher.

* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid):
TreeOutline is optional, and if non-null a tree outline synchronizer is created.

(WebInspector.TimelineDataGrid.prototype.shown):
(WebInspector.TimelineDataGrid.prototype.treeElementForDataGridNode):
(WebInspector.TimelineDataGrid.prototype.dataGridNodeForTreeElement):
(WebInspector.TimelineDataGrid.prototype.treeElementMatchesActiveScopeFilters):
Safety checks for the synchronizer.

(WebInspector.TimelineDataGrid.prototype.addRowInSortOrder):
treeElement is now an optional parameter. If non-null, a tree synchronizer
should exist. The third parameter has been overloaded, to allow passing
a parent tree element or data grid node.

(WebInspector.TimelineDataGrid.prototype._refreshDirtyDataGridNodes):
(WebInspector.TimelineDataGrid.prototype._sort):
Safety checks for the synchronizer.

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

4 years agoFixed broken link for "WebGL 2" on the Feature Status page
jond@apple.com [Thu, 10 Mar 2016 22:25:28 +0000 (22:25 +0000)]
Fixed broken link for "WebGL 2" on the Feature Status page
https://bugs.webkit.org/show_bug.cgi?id=155235

Reviewed by Alex Christensen.

* features.json:

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

4 years ago[OS X] Main frame scrollbars should appear on the left on RTL systems
mmaxfield@apple.com [Thu, 10 Mar 2016 22:05:30 +0000 (22:05 +0000)]
[OS X] Main frame scrollbars should appear on the left on RTL systems
https://bugs.webkit.org/show_bug.cgi?id=155149

Reviewed by Simon Fraser.

Source/WebCore:

A helper function, ScrollableArea::systemLanguageIsRTL() is used to determine
if we should be in this new mode. Once we have determined we should be in
this new mode, there are some scattered places where the geometry math
needed to be updated.

Tests: fast/scrolling/rtl-scrollbars-simple.html
       fast/scrolling/rtl-scrollbars.html

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
* platform/mac/ScrollableAreaMac.mm:
(WebCore::ScrollableArea::systemLanguageIsRTL):
* platform/ScrollableArea.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::scrollCornerRect):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimator::scrollbarsAreRTL):
* platform/spi/mac/NSScrollerImpSPI.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::positionForClipLayer):

Tools:

Setting the volatile default needs to be done early, so it is
plumbed through the injected bundle's initialization routine.

Control of RTL scrollbars is handled by putting the string
<!-- webkit-test-runner [ rtlScrollbars=true ] -->
on the first line of a test.

* WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:
(WTR::shouldUseRTLScrollbars):
(WTR::InjectedBundle::platformInitialize):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::generatePageConfiguration):
(WTR::updateTestOptionsFromTestHeader):
(WTR::TestController::getInjectedBundleInitializationUserData):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestOptions.h:
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::viewSupportsOptions):

LayoutTests:

* fast/scrolling/rtl-scrollbars-expected.html: Added.
* fast/scrolling/rtl-scrollbars-simple-expected-mismatch.html: Added.
* fast/scrolling/rtl-scrollbars-simple.html: Added.
* fast/scrolling/rtl-scrollbars.html: Added.
* platform/mac-wk1/TestExpectations:
* platform/mac/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/ios-simulator/TestExpectations:
* platform/win/TestExpectations:

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

4 years agobmalloc: Rename SmallPage to SmallRun
ggaren@apple.com [Thu, 10 Mar 2016 21:41:17 +0000 (21:41 +0000)]
bmalloc: Rename SmallPage to SmallRun
https://bugs.webkit.org/show_bug.cgi?id=155320

Reviewed by Alex Christensen.

A page is a fixed-size set of lines.

A run is an variable-sized set of lines.

We want to start using runs because:

    (a) we want to support varying the hardware page size by OS;

    (b) we want to support allocations larger than our current page size.

* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/Allocator.cpp:
(bmalloc::Allocator::reallocate):
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
(bmalloc::Heap::initializeSmallRunMetadata):
(bmalloc::Heap::scavenge):
(bmalloc::Heap::scavengeSmallRuns):
(bmalloc::Heap::allocateSmallBumpRanges):
(bmalloc::Heap::allocateSmallRun):
(bmalloc::Heap::deallocateSmallLine):
(bmalloc::Heap::initializeLineMetadata): Deleted.
(bmalloc::Heap::scavengeSmallPages): Deleted.
(bmalloc::Heap::allocateSmallPage): Deleted.
* bmalloc/Heap.h:
* bmalloc/LineMetadata.h:
* bmalloc/SmallChunk.h:
(bmalloc::SmallChunk::begin):
(bmalloc::SmallChunk::end):
(bmalloc::SmallChunk::lines):
(bmalloc::SmallChunk::runs):
(bmalloc::SmallChunk::SmallChunk):
(bmalloc::SmallLine::end):
(bmalloc::SmallRun::get):
(bmalloc::SmallRun::begin):
(bmalloc::SmallRun::end):
(bmalloc::SmallChunk::pages): Deleted.
(bmalloc::SmallPage::get): Deleted.
(bmalloc::SmallPage::begin): Deleted.
(bmalloc::SmallPage::end): Deleted.
* bmalloc/SmallPage.h: Removed.
* bmalloc/SmallRun.h: Copied from Source/bmalloc/bmalloc/SmallPage.h.
(bmalloc::SmallRun::SmallRun):
(bmalloc::SmallRun::ref):
(bmalloc::SmallRun::deref):
(bmalloc::SmallPage::SmallPage): Deleted.
(bmalloc::SmallPage::ref): Deleted.
(bmalloc::SmallPage::deref): Deleted.
* bmalloc/VMHeap.cpp:
(bmalloc::VMHeap::allocateSmallChunk):
(bmalloc::VMHeap::allocateLargeChunk):
* bmalloc/VMHeap.h:
(bmalloc::VMHeap::allocateSmallRun):
(bmalloc::VMHeap::allocateLargeObject):
(bmalloc::VMHeap::deallocateSmallRun):
(bmalloc::VMHeap::deallocateLargeObject):
(bmalloc::VMHeap::allocateSmallPage): Deleted.
(bmalloc::VMHeap::deallocateSmallPage): Deleted.

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

4 years agoWeb Inspector: JavaScript Heap Allocations Timeline
joepeck@webkit.org [Thu, 10 Mar 2016 21:37:56 +0000 (21:37 +0000)]
Web Inspector: JavaScript Heap Allocations Timeline
https://bugs.webkit.org/show_bug.cgi?id=155287
<rdar://problem/25078088>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype._describe):
(InjectedScript.prototype._nodeDescription):
Provide the nicer node preview more often.

Source/WebInspectorUI:

Initial JavaScript Heap Allocations Timeline includes:

    - Snapshot markers in the timeline
    - Initial/Periodic/End snapshots during recording
    - Ability to manually take a snapshot
    - View of all objects in a Snapshot and Diff between snapshots
      - Summary view - rough display of the size/count of large objects
      - Instances view - view each of the individual objects

* UserInterface/Main.html:
* UserInterface/Test.html:
* UserInterface/Images/Compare.svg: Added.
* UserInterface/Images/HeapSnapshot.svg: Added.
* UserInterface/Images/HeapSnapshotDiff.svg: Added.
* UserInterface/Images/HeapSnapshotInstances.svg: Added.
* UserInterface/Images/HeapSnapshotSummary.svg: Added.
* Localizations/en.lproj/localizedStrings.js:
New resources and strings.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.heapTrackingStarted):
(WebInspector.TimelineManager.prototype.heapTrackingCompleted):
(WebInspector.TimelineManager.prototype.heapSnapshotAdded):
* UserInterface/Protocol/HeapObserver.js:
(WebInspector.HeapObserver.prototype.trackingStart):
(WebInspector.HeapObserver.prototype.trackingComplete):
(WebInspector.HeapObserver):
Add snapshot records to the active recording's timeline.

* UserInterface/Models/HeapAllocationsInstrument.js: Added.
(WebInspector.HeapAllocationsInstrument):
(WebInspector.HeapAllocationsInstrument.supported):
(WebInspector.HeapAllocationsInstrument.prototype.get timelineRecordType):
(WebInspector.HeapAllocationsInstrument.prototype.startInstrumentation):
(WebInspector.HeapAllocationsInstrument.prototype.stopInstrumentation):
(WebInspector.HeapAllocationsInstrument.prototype._takeHeapSnapshot):
Start, stop, and periodic snapshots.

* UserInterface/Models/HeapAllocationsTimelineRecord.js:
(WebInspector.HeapAllocationsTimelineRecord):
(WebInspector.HeapAllocationsTimelineRecord.prototype.get timestamp):
(WebInspector.HeapAllocationsTimelineRecord.prototype.get heapSnapshot):
* UserInterface/Models/TimelineRecord.js:
* UserInterface/Models/TimelineRecording.js:
(WebInspector.TimelineRecording):
(WebInspector.TimelineRecording.prototype.addRecord):
* UserInterface/Views/TimelineOverviewGraph.js:
(WebInspector.TimelineOverviewGraph.createForTimeline):
* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView.displayNameForTimeline):
(WebInspector.TimelineTabContentView.iconClassNameForTimeline):
(WebInspector.TimelineTabContentView.genericClassNameForTimeline):
(WebInspector.TimelineTabContentView.iconClassNameForRecord):
(WebInspector.TimelineTabContentView.displayNameForRecord):
New timeline and record type.

* UserInterface/Models/HeapSnapshotDiff.js: Added.
(WebInspector.HeapSnapshotDiff):
(WebInspector.HeapSnapshotDiff.prototype.get snapshot1):
(WebInspector.HeapSnapshotDiff.prototype.get snapshot2):
(WebInspector.HeapSnapshotDiff.prototype.get addedInstances):
(WebInspector.HeapSnapshotDiff.prototype.get removedInstances):
(WebInspector.HeapSnapshotDiff.prototype.get sizeDifference):
(WebInspector.HeapSnapshotDiff.prototype.get growth):
(WebInspector.HeapSnapshotDiff.prototype.snapshotForDiff):
Compare two snapshots and create a "diff snapshot" which is just
the newly added objects.

* UserInterface/Views/ContentView.js:
(WebInspector.ContentView.createFromRepresentedObject):
(WebInspector.ContentView.isViewable):
A HeapSnapshot creates a HeapSnapshotClusterView.

* UserInterface/Views/HeapAllocationsTimelineDataGridNode.js: Added.
(WebInspector.HeapAllocationsTimelineDataGridNode):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.get record):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.get data):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.createCellContent):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.markAsBaseline):
(WebInspector.HeapAllocationsTimelineDataGridNode.prototype.clearBaseline):
* UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css: Copied from Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js.
(.timeline-overview-graph.heap-allocations):
(.timeline-overview-graph.heap-allocations > img.snapshot):
* UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js: Added.
(WebInspector.HeapAllocationsTimelineOverviewGraph):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.reset):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.layout.xScale):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.layout):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype._visibleRecords):
(WebInspector.HeapAllocationsTimelineOverviewGraph.prototype._heapAllocationTimelineRecordAdded):
* UserInterface/Views/HeapAllocationsTimelineView.css: Copied from Source/WebInspectorUI/UserInterface/Protocol/HeapObserver.js.
(.timeline-view.heap-allocations > .data-grid):
(.timeline-view.heap-allocations > .data-grid td .icon.heap-snapshot):
(.timeline-view.heap-allocations > .data-grid tr.baseline):
(.timeline-view.heap-allocations > .content-view-container):
(.timeline-view.heap-allocations > .content-view-container > .content-view):
* UserInterface/Views/HeapAllocationsTimelineView.js: Added.
(WebInspector.HeapAllocationsTimelineView):
(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotList):
(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotTimelineRecord):
(WebInspector.HeapAllocationsTimelineView.prototype.showHeapSnapshotDiff):
(WebInspector.HeapAllocationsTimelineView.prototype.get navigationItems):
(WebInspector.HeapAllocationsTimelineView.prototype.get selectionPathComponents):
(WebInspector.HeapAllocationsTimelineView.prototype.get navigationSidebarTreeOutlineLabel):
(WebInspector.HeapAllocationsTimelineView.prototype.treeElementPathComponentSelected):
(WebInspector.HeapAllocationsTimelineView.prototype.userSelectedRecordFromOverview):
(WebInspector.HeapAllocationsTimelineView.prototype.closed):
(WebInspector.HeapAllocationsTimelineView.prototype.layout):
(WebInspector.HeapAllocationsTimelineView.prototype.reset):
(WebInspector.HeapAllocationsTimelineView.prototype._heapAllocationsTimelineRecordAdded):
(WebInspector.HeapAllocationsTimelineView.prototype._snapshotListPathComponentClicked):
(WebInspector.HeapAllocationsTimelineView.prototype._snapshotPathComponentSelected):
(WebInspector.HeapAllocationsTimelineView.prototype._currentContentViewDidChange):
(WebInspector.HeapAllocationsTimelineView.prototype._contentViewSelectionPathComponentDidChange):
(WebInspector.HeapAllocationsTimelineView.prototype._updateCompareHeapSnapshotButton):
(WebInspector.HeapAllocationsTimelineView.prototype._takeHeapSnapshotClicked):
(WebInspector.HeapAllocationsTimelineView.prototype._cancelSelectComparisonHeapSnapshots):
(WebInspector.HeapAllocationsTimelineView.prototype._compareHeapSnapshotsClicked):
(WebInspector.HeapAllocationsTimelineView.prototype._dataGridNodeSelected):
* UserInterface/Views/HeapSnapshotClassDataGridNode.js: Added.
(WebInspector.HeapSnapshotClassDataGridNode):
(WebInspector.HeapSnapshotClassDataGridNode.prototype.get data):
(WebInspector.HeapSnapshotClassDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotClassDataGridNode.prototype.sort):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._populate):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._fetchBatch):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._updateBatchedSort):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._updateBatchedChildren):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._removeFetchMoreDataGridNode):
(WebInspector.HeapSnapshotClassDataGridNode.prototype._appendFetchMoreDataGridNode):
* UserInterface/Views/HeapSnapshotClusterContentView.js: Added.
(WebInspector.HeapSnapshotClusterContentView.createPathComponent):
(WebInspector.HeapSnapshotClusterContentView):
(WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName):
(WebInspector.HeapSnapshotClusterContentView.prototype.get heapSnapshot):
(WebInspector.HeapSnapshotClusterContentView.prototype.get summaryContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.get instancesContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype.get navigationItems):
(WebInspector.HeapSnapshotClusterContentView.prototype.get selectionPathComponents):
(WebInspector.HeapSnapshotClusterContentView.prototype.shown):
(WebInspector.HeapSnapshotClusterContentView.prototype.closed):
(WebInspector.HeapSnapshotClusterContentView.prototype.saveToCookie):
(WebInspector.HeapSnapshotClusterContentView.prototype.restoreFromCookie):
(WebInspector.HeapSnapshotClusterContentView.prototype.showSummary):
(WebInspector.HeapSnapshotClusterContentView.prototype.showInstances):
(WebInspector.HeapSnapshotClusterContentView.prototype._contentViewExtraArguments):
(WebInspector.HeapSnapshotClusterContentView.prototype._pathComponentForContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype._identifierForContentView):
(WebInspector.HeapSnapshotClusterContentView.prototype._showContentViewForIdentifier):
(WebInspector.HeapSnapshotClusterContentView.prototype._pathComponentSelected):
(WebInspector.HeapSnapshotClusterContentView.prototype._toggleShowInternalObjectsSetting):
(WebInspector.HeapSnapshotClusterContentView.prototype._updateViewsForShowInternalObjectsSettingValue):
(WebInspector.HeapSnapshotClusterContentView.prototype._updateShowInternalObjectsButtonNavigationItem):
* UserInterface/Views/HeapSnapshotInstanceDataGridNode.js: Added.
(WebInspector.HeapSnapshotInstanceDataGridNode):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.get data):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.get selectable):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCells):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype.sort):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._contextMenuHandler.):
(WebInspector.HeapSnapshotInstanceDataGridNode.prototype._contextMenuHandler):
* UserInterface/Views/HeapSnapshotInstanceFetchMoreDataGridNode.js: Added.
(WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode):
(WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode.prototype.createCellContent):
(WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode.prototype.sort):
* UserInterface/Views/HeapSnapshotInstancesContentView.css: Added.
* UserInterface/Views/HeapSnapshotInstancesContentView.js: Added.
(WebInspector.HeapSnapshotInstancesContentView):
(WebInspector.HeapSnapshotInstancesContentView.prototype.get showInternalObjects):
(WebInspector.HeapSnapshotInstancesContentView.prototype.set showInternalObjects):
(WebInspector.HeapSnapshotInstancesContentView.prototype._sortDataGrid):
* UserInterface/Views/HeapSnapshotInstancesDataGridTree.js: Added.
(WebInspector.HeapSnapshotInstancesDataGridTree):
(WebInspector.HeapSnapshotInstancesDataGridTree.buildSortComparator):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get heapSnapshot):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get includeInternalObjects):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.set includeInternalObjects):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.get children):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.appendChild):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.insertChild):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.removeChildren):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.set sortComparator):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype.sort):
(WebInspector.HeapSnapshotInstancesDataGridTree.prototype._populateTopLevel):
* UserInterface/Views/HeapSnapshotSummaryContentView.css: Added.
* UserInterface/Views/HeapSnapshotSummaryContentView.js: Added.
(WebInspector.HeapSnapshotSummaryContentView.createChartContainer):
(WebInspector.HeapSnapshotSummaryContentView.appendLegendRow):
(WebInspector.HeapSnapshotSummaryContentView.appendEmptyMessage):
(WebInspector.HeapSnapshotSummaryContentView):
(WebInspector.HeapSnapshotSummaryContentView.prototype.layout):
* UserInterface/Views/PathComponentIcons.css:
(.heap-snapshot-summary-icon .icon):
(.heap-snapshot-instances-icon .icon):
(.snapshot-list-icon .icon):
(.snapshot-diff-icon .icon):
(body:not(.mac-platform, .windows-platform) .snapshot-diff-icon .icon):
(body:not(.mac-platform, .windows-platform) .call-trees-icon .icon): Deleted.
* UserInterface/Views/TextNavigationItem.css:
(.navigation-bar .item.text):
* UserInterface/Views/TextNavigationItem.js:
(WebInspector.TextNavigationItem):
(WebInspector.TextNavigationItem.prototype.get text):
(WebInspector.TextNavigationItem.prototype.set text):
* UserInterface/Views/TimelineIcons.css:
(.heap-snapshot-record .icon):
* UserInterface/Views/Variables.css:
(:root):
New views.

* UserInterface/Views/FormattedValue.js:
(WebInspector.FormattedValue.createElementForNodePreview):
(WebInspector.FormattedValue.createElementForFunctionWithName):
(WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview):
Better display for a raw object preview.

* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview):
(WebInspector.TimelineOverview.prototype.userSelectedRecord):
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView):
(WebInspector.TimelineRecordingContentView.prototype.timelineOverviewUserSelectedRecord):
* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.set allowsTimeRangeSelection):
(WebInspector.TimelineRuler.prototype._handleClick):
(WebInspector.TimelineRuler.prototype._handleMouseDown):
(WebInspector.TimelineRuler.prototype._handleMouseMove):
* UserInterface/Views/TimelineView.js:
(WebInspector.TimelineView.prototype.userSelectedRecordFromOverview):
Hook up a way for clicking in the TimelineOverview / TimelineRuler
to redispatch to an OverviewGraph element, and provide a patch for
the Overview -> RecordingContentView -> TimelineView for records.

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

4 years agoAdd separate WK and WK2 preferences for requiring user gestures for video media,...
jer.noble@apple.com [Thu, 10 Mar 2016 21:35:10 +0000 (21:35 +0000)]
Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
https://bugs.webkit.org/show_bug.cgi?id=155141

Reviewed by Beth Dakin.

Source/WebCore:

Rename RequireUserGestureForRateChange -> RequireUserGestureForVideoRateChange.
Rename Settings::requiresUserGestureForMediaPlayback -> Settings::videoPlaybackRequiresUserGesture.

Fix longstanding FIXME unifying our behavior restrictions between iOS and Mac.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon): Rename.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Unify behavior restriction behavior.
(WebCore::HTMLMediaElement::removeBehaviorsRestrictionsAfterFirstUserGesture): Rename.
* html/MediaElementSession.cpp:
(WebCore::restrictionName): Rename.
(WebCore::MediaElementSession::playbackPermitted): Rename.
* html/MediaElementSession.h:
* page/Settings.cpp:
* page/Settings.in:
* testing/Internals.cpp:
(WebCore::Internals::setMediaElementRestrictions): Rename.

Source/WebKit/mac:

Deprecate WebPreferences.mediaPlaybackRequiresUserGesture property in favor of .videoPlaybackRequiresUserGesture.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences mediaPlaybackRequiresUserGesture]):
(-[WebPreferences setMediaPlaybackRequiresUserGesture:]):
(-[WebPreferences videoPlaybackRequiresUserGesture]):
(-[WebPreferences setVideoPlaybackRequiresUserGesture:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit/win:

* WebView.cpp:
(WebView::notifyPreferencesChanged):

Source/WebKit2:

Add a new preference, videoPlaybackRequiresUserGesture, distinct from mediaPlaybackRequiresUserGesture. Legacy clients of
mediaPlaybackRequiresUserGesture will still be able to use it normally, as setting that preference to true will effectively
set both audioPlaybackRequiresUserGesture and videoPlaybackRequiresUserGesture to true. Make these preferences all available
universally, rather than just on PLATFORM(IOS). This requires adding a definition for -setRequiresUserActionForMediaPlayback:
and -requiresUserActionForMediaPlayback on !PLATFORM(IOS).

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetVideoPlaybackRequiresUserGesture):
(WKPreferencesGetVideoPlaybackRequiresUserGesture):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _setObscuredInsets:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]):
(-[WKWebViewConfiguration encodeWithCoder:]):
(-[WKWebViewConfiguration initWithCoder:]):
(-[WKWebViewConfiguration copyWithZone:]):
(-[WKWebViewConfiguration requiresUserActionForMediaPlayback]):
(-[WKWebViewConfiguration setRequiresUserActionForMediaPlayback:]):
(-[WKWebViewConfiguration allowsInlineMediaPlayback]):
(-[WKWebViewConfiguration setAllowsInlineMediaPlayback:]):
(-[WKWebViewConfiguration _requiresUserActionForVideoPlayback]):
(-[WKWebViewConfiguration _setRequiresUserActionForVideoPlayback:]):
* UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

Set the default values for media preferences unconditionally, not just on PLATFORM(IOS). Set "video requires user gesture"
to sane defaults in addition to "audio requires user gesture" and (in the case of DumpREnderTree) instead of "media requires user gesture".

Add a new test of WK2 user gesture requirement preferences.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
* TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html:
* TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm: Added.
(-[RequiresUserActionForPlaybackNavigationDelegate webView:didFinishNavigation:]):
(-[RequiresUserActionForPlaybackMessageHandler userContentController:didReceiveScriptMessage:]):
(RequiresUserActionForPlaybackTest::SetUp):
(RequiresUserActionForPlaybackTest::createWebView):
(RequiresUserActionForPlaybackTest::testVideoWithAudio):
(RequiresUserActionForPlaybackTest::testVideoWithoutAudio):
(RequiresUserActionForPlaybackTest::testAudioOnly):
(TEST_F):
* TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
(TEST):

LayoutTests:

Update layout tests to reflect new restriction name.

* media/audio-playback-restriction-play-expected.txt:
* media/audio-playback-restriction-play.html:
* media/no-autoplay-with-user-gesture-requirement.html:
* media/video-load-require-user-gesture.html:
* media/video-play-require-user-gesture.html:
* media/video-crash-invisible-autoplay-display-none-expected.txt: Added.
* media/video-crash-invisible-autoplay-display-none.html: Added.
* media/video-main-content-allow-expected.txt:
* media/video-main-content-allow-then-deny-expected.txt:
* media/video-main-content-allow-then-deny.html:
* media/video-main-content-allow.html:
* media/video-main-content-deny-display-none-expected.txt:
* media/video-main-content-deny-display-none.html:
* media/video-main-content-deny-not-in-dom-expected.txt:
* media/video-main-content-deny-not-in-dom.html:
* media/video-main-content-deny-not-visible-expected.txt:
* media/video-main-content-deny-not-visible.html:
* media/video-main-content-deny-obscured-expected.txt:
* media/video-main-content-deny-obscured.html:
* media/video-main-content-deny-too-small-expected.txt:
* media/video-main-content-deny-too-small.html:

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

4 years agoAdd :defined support
rniwa@webkit.org [Thu, 10 Mar 2016 21:11:33 +0000 (21:11 +0000)]
Add :defined support
https://bugs.webkit.org/show_bug.cgi?id=155108

Reviewed by Antti Koivisto.

Source/WebCore:

Added :defined pseudo class which applies to a successfully instantiated custom element or a builtin element.
A new node flag, isUnresolvedCustomElement, which was added in r197917 tracks un-upgraded / unresolved custom
elements for which :defined should not apply.

Tests: fast/custom-elements/defined-pseudo-class.html
       fast/custom-elements/defined-rule.html

* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::constructElement): Unset isUnresolvedCustomElement now that HTMLElement's
constructor sets isUnresolvedCustomElement.
* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement): Set isUnresolvedCustomElement to true since :defined should never apply to
a custom element inside its constructor as HTMLElement constructor does not set the defined flag:
https://w3c.github.io/webcomponents/spec/custom/#htmlelement-constructor
* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText): Added the support for serializing :defined.
* css/CSSSelector.h:
(PseudoClassType): Added PseudoClassDefined for :defined.
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne): Added the support for :defined.
* css/SelectorCheckerTestFunctions.h:
(WebCore::isDefinedElement): Added. Returns true for any builtin element and a custom element after a successful
construction / upgrades.
* css/SelectorPseudoClassAndCompatibilityElementMap.in: Added :defined.
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType): Added the support for :defined.

LayoutTests:

Added W3C style testharness.js tests and ref tests for :defined pseudo class.

* fast/custom-elements/defined-pseudo-class-expected.txt: Added.
* fast/custom-elements/defined-pseudo-class.html: Added.
* fast/custom-elements/defined-rule-expected.html: Added.
* fast/custom-elements/defined-rule.html: Added.

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

4 years agoBuild fix for deprecated constant names.
ap@apple.com [Thu, 10 Mar 2016 20:52:19 +0000 (20:52 +0000)]
Build fix for deprecated constant names.

* Carbon/CarbonWindowAdapter.mm:
(-[CarbonWindowAdapter initWithCarbonWindowRef:takingOwnership:disableOrdering:carbon:]):
(-[CarbonWindowAdapter sendSuperEvent:]):

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

4 years agoUnreviewed, rolling out r197943.
commit-queue@webkit.org [Thu, 10 Mar 2016 20:46:57 +0000 (20:46 +0000)]
Unreviewed, rolling out r197943.
https://bugs.webkit.org/show_bug.cgi?id=155317

This change broke Windows, WinCairo, GTK and EFL builds
(Requested by ryanhaddad on #webkit).

Reverted changeset:

"Add a baseURL parameter to _WKUserStyleSheet"
https://bugs.webkit.org/show_bug.cgi?id=155219
http://trac.webkit.org/changeset/197943

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

4 years agoWeb Inspector: should be able to run protocol and input generator scripts from any...
bburg@apple.com [Thu, 10 Mar 2016 20:06:50 +0000 (20:06 +0000)]
Web Inspector: should be able to run protocol and input generator scripts from any directory
https://bugs.webkit.org/show_bug.cgi?id=155307

Reviewed by Joseph Pecoraro.

* Scripts/webkitpy/inspector/main.py:
(InspectorGeneratorTests.main):
* Scripts/webkitpy/replay/main.py:
(InputGeneratorTests.main):
Compute the current SCM based on the location of the script being executed, not
the $CWD which could be anything. There's rarely a good reason to use $CWD.

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

4 years agoAssignment to new.target should be an early error
sbarati@apple.com [Thu, 10 Mar 2016 19:41:37 +0000 (19:41 +0000)]
Assignment to new.target should be an early error
https://bugs.webkit.org/show_bug.cgi?id=151148

Reviewed by Mark Lam.

This patch makes it so that any form of assignment to new.target
is an early syntax error.

* parser/ASTBuilder.h:
(JSC::ASTBuilder::createNewTargetExpr):
(JSC::ASTBuilder::isNewTarget):
(JSC::ASTBuilder::createResolve):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAssignmentExpression):
(JSC::Parser<LexerType>::parseUnaryExpression):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createThisExpr):
(JSC::SyntaxChecker::createSuperExpr):
(JSC::SyntaxChecker::createNewTargetExpr):
(JSC::SyntaxChecker::isNewTarget):
(JSC::SyntaxChecker::createResolve):
(JSC::SyntaxChecker::createObjectLiteral):
* tests/es6.yaml:
* tests/stress/new-target-syntax-errors.js: Added.
(shouldBeSyntaxError):
(shouldNotBeSyntaxError):
* tests/stress/new-target.js:
(Constructor):
(doWeirdThings):
(noAssign): Deleted.
(catch): Deleted.

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

4 years ago[MediaStream] push media stream state to the UI process
eric.carlson@apple.com [Thu, 10 Mar 2016 18:39:46 +0000 (18:39 +0000)]
[MediaStream] push media stream state to the UI process
https://bugs.webkit.org/show_bug.cgi?id=155281

Reviewed by Dean Jackson.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame): Don't clear m_mediaState, it is done in
  WebPageProxy::resetState. This reverts a change added in r197929.

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

4 years agoCSP: Implement support for script and style nonces
dbates@webkit.org [Thu, 10 Mar 2016 18:30:38 +0000 (18:30 +0000)]
CSP: Implement support for script and style nonces
https://bugs.webkit.org/show_bug.cgi?id=116508
<rdar://problem/24963980>

Reviewed by Brent Fulgham.

Source/WebCore:

Add support for script-src and style-src nonces as per sections Nonce usage for script elements
and Nonce usage for style elements of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.

* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet): Check if the nonce for an HTML style element matches a known nonce.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestScript): Check if the nonce for an HTML script element for an external JavaScript
script matches a known nonce. If it does then skip subsequent checks of the Content Security Policy when loading
the script.
(WebCore::ScriptElement::executeScript): Check if the nonce for an HTML script element for an inline JavaScript
script matches a known nonce.
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process): Check if the nonce for an HTML link element matches a known nonce. If it does
then skip subsequent checks of the Content Security Policy when loading the stylesheet.
* html/HTMLScriptElement.idl: Unconditionally expose attribute nonce.
* html/HTMLStyleElement.idl: Ditto.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::isAllowedByAllWithNonce):
(WebCore::ContentSecurityPolicy::allowScriptWithNonce): Check if the nonce attribute value of a script element
matches a known nonce. This function delegates the check to ContentSecurityPolicyDirectiveList::allowScriptWithNonce().
(WebCore::ContentSecurityPolicy::allowStyleWithNonce): Check if the nonce attribute value of a style/link element
matches a known nonce. This function delegates the check to ContentSecurityPolicyDirectiveList::allowStyleWithNonce().
* page/csp/ContentSecurityPolicy.h:
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkNonce): Checks if the directive allows the specified nonce.
(WebCore::ContentSecurityPolicyDirectiveList::allowScriptWithNonce): Check if the specified nonce is in
the source list of the script-src directive (if specified) or the source list of the default-src directive (if specified).
(WebCore::ContentSecurityPolicyDirectiveList::allowStyleWithNonce): Check if the specified nonce is in
the source list of the style-src directive (if specified) or the source list of the default-src directive (if specified).
* page/csp/ContentSecurityPolicyDirectiveList.h:
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::matches): Returns whether the specified nonce is in the HashSet of
nonces for the directive.
(WebCore::ContentSecurityPolicySourceList::parse): Modified to call ContentSecurityPolicySourceList::parseNonceSource()
to parse a nonce source expression.
(WebCore::isBase64Character): Moved function to be above function ContentSecurityPolicySourceList::parseNonceSource()
so that it can referenced from both ContentSecurityPolicySourceList::parseNonceSource() and ContentSecurityPolicySourceList::parseHashSource().
(WebCore::isNonceCharacter): Added. Matches Blink's definition of a valid nonce character. This definition differs
from the definition in the Content Security Policy Level 3 spec., <https://w3c.github.io/webappsec-csp/> (29 February 2016).
(WebCore::ContentSecurityPolicySourceList::parseNonceSource): Parses a source expression for a nonce value.
* page/csp/ContentSecurityPolicySourceList.h:
(WebCore::ContentSecurityPolicySourceList::allowInline): We only allow inline scripts/stylesheets if
'unsafe-inline' was specified in the source list and the source list does not contain any hash sources
or nonce sources.
* page/csp/ContentSecurityPolicySourceListDirective.cpp:
(WebCore::ContentSecurityPolicySourceListDirective::allows): Checks if the specified nonce is in the source list.
* page/csp/ContentSecurityPolicySourceListDirective.h:

LayoutTests:

Update expected results due to differences between Blink and WebKit violation message formats.

Additionally mark script- and style- nonce tests as PASS in LayoutTests/TestExpectations so
that we run them.

* TestExpectations:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-and-scripthash-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-and-scripthash.html:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-basic-blocked-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-ignore-unsafeinline-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scriptnonce-invalidnonce-expected.txt: Also update result
to reflect that we consider "'n-" an invalid source expression (as expected).
* http/tests/security/contentSecurityPolicy/1.1/stylenonce-allowed-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/stylenonce-blocked-expected.txt:

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

4 years agoAdd a baseURL parameter to _WKUserStyleSheet
weinig@apple.com [Thu, 10 Mar 2016 18:24:50 +0000 (18:24 +0000)]
Add a baseURL parameter to _WKUserStyleSheet
https://bugs.webkit.org/show_bug.cgi?id=155219

Reviewed by Tim Horton.

Source/WebCore:

- Moves to a model for user content where instead of each page having a WebCore::UserContentController
  object, we have an abstract WebCore::UserContentProvider interface that can be implemented at the WebKit
  level. For now, legacy WebKit continues to use the old UserContentController, which implements
  WebCore::UserContentProvider, and WebKit2 implements its own implementation so it can store additional
  state.

* WebCore.xcodeproj/project.pbxproj:
Add new files.

* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache):
Switch to using forEachUserStyleSheet on the UserContentProvider.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::loadResource):
Remove null check now that we always have a UserContentProvider.

* loader/EmptyClients.cpp:
(WebCore::fillWithEmptyClients):
* loader/EmptyClients.h:
Add new EmptyClients.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadResourceSynchronously):
Remove null check now that we always have a UserContentProvider.

* loader/PingLoader.cpp:
(WebCore::processContentExtensionRulesForLoad):
Remove null check now that we always have a UserContentProvider.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::willSendRequestInternal):
Remove null check now that we always have a UserContentProvider.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestResource):
Remove null check now that we always have a UserContentProvider.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::shouldHaveWebKitNamespaceForWorld):
Remove null checks now that we always have a UserContentProvider, and userMessageHandlerDescriptors
returns a reference.

(WebCore::DOMWindow::open):
Remove null check now that we always have a UserContentProvider.

* page/Frame.cpp:
(WebCore::Frame::injectUserScripts):
Simplify by lifting document check out of the main loop and using forEachUserScript.

* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
(WebCore::Page::userContentProvider):
(WebCore::Page::setUserContentProvider):
(WebCore::Page::setUserContentController): Deleted.
* page/Page.h:
(WebCore::Page::userContentController): Deleted.
* page/PageConfiguration.h:
Store the UserContentProvider in a Ref, and require PageConfigurations to provide one. This
removes a bunch of null checks and simplifies the code.

* page/UserContentController.cpp:
(WebCore::UserContentController::~UserContentController):
(WebCore::UserContentController::forEachUserScript):
(WebCore::UserContentController::forEachUserStyleSheet):
(WebCore::UserContentController::addUserScript):
(WebCore::UserContentController::removeUserScript):
(WebCore::UserContentController::removeUserScripts):
(WebCore::UserContentController::addUserStyleSheet):
(WebCore::UserContentController::removeUserStyleSheet):
(WebCore::UserContentController::removeUserStyleSheets):
(WebCore::UserContentController::addUserMessageHandlerDescriptor):
(WebCore::UserContentController::removeUserMessageHandlerDescriptor):
(WebCore::UserContentController::addUserContentExtension):
(WebCore::UserContentController::removeUserContentExtension):
(WebCore::UserContentController::removeAllUserContentExtensions):
(WebCore::UserContentController::removeAllUserContent):
(WebCore::UserContentController::addPage): Deleted.
(WebCore::UserContentController::removePage): Deleted.
(WebCore::contentExtensionsEnabled): Deleted.
(WebCore::UserContentController::processContentExtensionRulesForLoad): Deleted.
(WebCore::UserContentController::actionsForResourceLoad): Deleted.
* page/UserContentController.h:
(WebCore::UserContentController::userScripts): Deleted.
(WebCore::UserContentController::userStyleSheets): Deleted.
(WebCore::UserContentController::userMessageHandlerDescriptors): Deleted.
Add inheritance from UserContentProvider and simplify things by removing unique_ptrs
that were holding the member variables. There is usually only one UserContentController
so having these in unique_ptrs doesn't make much sense.

* page/UserContentProvider.cpp: Added.
(WebCore::UserContentProvider::UserContentProvider):
(WebCore::UserContentProvider::~UserContentProvider):
(WebCore::UserContentProvider::addPage):
(WebCore::UserContentProvider::removePage):
(WebCore::UserContentProvider::invalidateInjectedStyleSheetCacheInAllFramesInAllPages):
(WebCore::contentExtensionsEnabled):
(WebCore::UserContentProvider::processContentExtensionRulesForLoad):
(WebCore::UserContentProvider::actionsForResourceLoad):
* page/UserContentProvider.h: Added.
Add abstract class for providing user content and add some helpers on it.

* page/UserMessageHandlerDescriptor.h:
(WebCore::UserMessageHandlerDescriptor::create):
(WebCore::UserMessageHandlerDescriptor::client):
(WebCore::UserMessageHandlerDescriptor::invalidateClient):
* page/UserMessageHandlersNamespace.cpp:
(WebCore::UserMessageHandlersNamespace::handler):
Simplify now that userContentProvider() and userMessageHandlerDescriptors() are references.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]):
(-[WebView setGroupName:]):
Update to account for the name change from UserContentController -> UserContentProvider.

Source/WebKit2:

- Moves to a model for user content where instead of using a WebCore::UserContentController
  object, we implement the new WebCore::UserContentProvider interface (on the existing
  WebUserContentController object).
- Uses this to maintain maps of UserStylesSheets and UserScripts along with their identifiers,
  freeing up the URL, which had been acting as the identifier, to be used as the baseURL which
  was what it was intended for.
- Adds a baseURL property to _WKUserStyleSheet.

* WebKit2.xcodeproj/project.pbxproj:
Add new files.

* Scripts/webkit/messages.py:
(headers_for_type):
Add support for sending WebUserContentControllerDataTypes.

* Shared/WebUserContentControllerDataTypes.cpp: Added.
(WebKit::WebUserScriptData::encode):
(WebKit::WebUserScriptData::decode):
(WebKit::WebUserStyleSheetData::encode):
(WebKit::WebUserStyleSheetData::decode):
* Shared/WebUserContentControllerDataTypes.h: Added.
Add helper types for sending user content over IPC.

* UIProcess/API/APIUserScript.cpp:
(API::UserScript::generateUniqueURL):
(API::UserScript::UserScript):
* UIProcess/API/APIUserScript.h:
* UIProcess/API/APIUserStyleSheet.cpp:
(API::UserStyleSheet::generateUniqueURL):
(API::UserStyleSheet::UserStyleSheet):
* UIProcess/API/APIUserStyleSheet.h:
Add identifiers for tracking across processes.

* UIProcess/API/Cocoa/_WKUserStyleSheet.h:
* UIProcess/API/Cocoa/_WKUserStyleSheet.mm:
(-[_WKUserStyleSheet initWithSource:forMainFrameOnly:legacyWhitelist:legacyBlacklist:baseURL:userContentWorld:]):
(-[_WKUserStyleSheet baseURL]):
Add new initializer which takes a baseURL as well as an accessor for the baseURL.

* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addProcess):
(WebKit::WebUserContentControllerProxy::addUserScript):
(WebKit::WebUserContentControllerProxy::removeUserScript):
(WebKit::WebUserContentControllerProxy::addUserStyleSheet):
(WebKit::WebUserContentControllerProxy::removeUserStyleSheet):
Pass identifiers as well as user content.

* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::addUserScript):
(WebKit::InjectedBundle::addUserStyleSheet):
Move user content in via move semantics rather than using a unique_ptr.

(WebKit::InjectedBundle::removeUserScript):
(WebKit::InjectedBundle::removeUserStyleSheet):
(WebKit::InjectedBundle::removeUserScripts):
(WebKit::InjectedBundle::removeUserStyleSheets):
(WebKit::InjectedBundle::removeAllUserContent):
Update for new function signatures.

* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::WebUserContentController):
(WebKit::WebUserContentController::~WebUserContentController):
(WebKit::WebUserContentController::addUserContentWorlds):
(WebKit::WebUserContentController::removeUserContentWorlds):
(WebKit::WebUserContentController::addUserScripts):
(WebKit::WebUserContentController::removeUserScript):
(WebKit::WebUserContentController::removeAllUserScripts):
(WebKit::WebUserContentController::addUserStyleSheets):
(WebKit::WebUserContentController::removeUserStyleSheet):
(WebKit::WebUserContentController::removeAllUserStyleSheets):
(WebKit::WebUserContentController::addUserScriptMessageHandlers):
(WebKit::WebUserContentController::removeUserScriptMessageHandler):
(WebKit::WebUserContentController::addUserContentExtensions):
(WebKit::WebUserContentController::removeUserContentExtension):
(WebKit::WebUserContentController::removeAllUserContentExtensions):
(WebKit::WebUserContentController::addUserScriptInternal):
(WebKit::WebUserContentController::addUserScript):
(WebKit::WebUserContentController::removeUserScriptWithURL):
(WebKit::WebUserContentController::removeUserScriptInternal):
(WebKit::WebUserContentController::removeUserScripts):
(WebKit::WebUserContentController::addUserStyleSheetInternal):
(WebKit::WebUserContentController::addUserStyleSheet):
(WebKit::WebUserContentController::removeUserStyleSheetWithURL):
(WebKit::WebUserContentController::removeUserStyleSheetInternal):
(WebKit::WebUserContentController::removeUserStyleSheets):
(WebKit::WebUserContentController::removeAllUserContent):
(WebKit::WebUserContentController::forEachUserScript):
(WebKit::WebUserContentController::forEachUserStyleSheet):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:
Convert to inheriting from UserContentProvider, rather than containing a UserContentController.
This means adding the storage for the user content, which has been simplified to avoid using
unique_ptrs.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addUserScript):
(WebKit::WebPage::addUserStyleSheet):
(WebKit::WebPage::removeAllUserContent):
Update to call the WebUserContentController, rather than going to the UserContentController, which
no longer exists.

* WebProcess/WebPage/WebPageGroupProxy.cpp:
(WebKit::WebPageGroupProxy::userContentController):
* WebProcess/WebPage/WebPageGroupProxy.h:
Return the WebUserContentController rather than old UserContentController.

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

4 years ago[iOS] DumpRenderTree crashes when accessing window.testRunner.inspectorTestStubURL
ddkilzer@apple.com [Thu, 10 Mar 2016 18:23:52 +0000 (18:23 +0000)]
[iOS] DumpRenderTree crashes when accessing window.testRunner.inspectorTestStubURL
<http://webkit.org/b/155295>

Reviewed by Brent Fulgham.

Tools:

* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::inspectorTestStubURL): Always return nullptr for
PLATFORM(IOS).  This matches what we did in r192604 for
WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm.

LayoutTests:

* platform/ios-simulator-wk1/TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
- Remove all "inspector/" tests.  They are already skipped in
  platform/ios-simulator/TestExpectations, so no need to
  resurrect them here.

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

4 years agoUnreviewed, rolling out r197923.
ryanhaddad@apple.com [Thu, 10 Mar 2016 17:55:19 +0000 (17:55 +0000)]
Unreviewed, rolling out r197923.
https://bugs.webkit.org/show_bug.cgi?id=155301

Rolling out this change due to breaking the build and
LayoutTests. (Requested by ryanhaddad on #webkit).

Reverted changeset:

"Font antialiasing (smoothing) changes when elements are
rendered into compositing layers"
https://bugs.webkit.org/show_bug.cgi?id=23364
http://trac.webkit.org/changeset/197923

Patch by Commit Queue <commit-queue@webkit.org> on 2016-03-10

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

4 years agoCSP: Implement support for inline script and inline style hashes
dbates@webkit.org [Thu, 10 Mar 2016 17:46:06 +0000 (17:46 +0000)]
CSP: Implement support for inline script and inline style hashes
https://bugs.webkit.org/show_bug.cgi?id=155007
<rdar://problem/24964098>

Reviewed by Brent Fulgham.

Source/WebCore:

Inspiration taken from the analogous implementation in Blink.

Add support for script-src and style-src hashes as per sections Hash usage for script elements
and Hash usage for style elements of the Content Security Policy 2.0 spec., <https://www.w3.org/TR/2015/CR-CSP2-20150721/>.

Test: http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html

* WebCore.xcodeproj/project.pbxproj: Add file ContentSecurityPolicyHash.h. Also sort the list of files
in the group WebCore/page/csp.
* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet): Pass the content of the stylesheet when querying whether
the stylesheet is allowed by the Content Security Policy.
* dom/ScriptElement.cpp:
(WebCore::ScriptElement::executeScript): Pass the content of the inline JavaScript script when querying
whether the script is allowed by the Content Security Policy.
* dom/StyledElement.cpp:
(WebCore::StyledElement::styleAttributeChanged): The Content Security Policy style-src hashes do not apply
to inline styles defined in the HTML style attribute. So, pass a null string (to indicate the absence of
content) when querying whether the inline style is allowed by the Content Security Policy.
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::toCryptoDigestAlgorithm): Convenience function that maps a ContentSecurityPolicyHashAlgorithm
enumerator to a CryptoDigest::Algorithm enumerator.
(WebCore::isAllowedByAllWithHashFromContent): Computes the digest of the specified content for each
hash algorithm and checks if digest matches a hash that was specified in a policy.
(WebCore::ContentSecurityPolicy::documentEncoding): Added.
(WebCore::ContentSecurityPolicy::allowInlineScript): Check if the hash of the script matches a known
hash if applicable. Otherwise, fall back to checking the URL of the script.
(WebCore::ContentSecurityPolicy::allowInlineStyle): Check if the hash of the stylesheet matches a
known hash if applicable. Otherwise, fall back to checking the URL of the stylesheet.
* page/csp/ContentSecurityPolicy.h:
(WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineScripts): Adds the specified set of
hash algorithms to the existing set of hash algorithms we know are used for inline scripts.
(WebCore::ContentSecurityPolicy::addHashAlgorithmsForInlineStylesheets): Adds the specified set of
hash algorithms to the existing set of hash algorithms we know are used for inline stylesheets.
* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::checkEval): Make this a static, non-member function because it does not depend on any
instance or class variables. Mark this function as inline to give a hint to the compiler that it
should consider inlining the implementation of this function into the caller.
(WebCore::checkInline): Ditto.
(WebCore::checkSource): Ditto.
(WebCore::checkHash): Checks if the directive allows content with the specified hash.
(WebCore::checkMediaType): Make this a static, non-member function because it does not depend on
any instance or class variables. Mark this function as inline to give a hint to the compiler that
it should consider inlining the implementation of this function into the caller.
(WebCore::ContentSecurityPolicyDirectiveList::create): Modified as needed now that WebCore::checkEval()
is a static, non-member function.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineScriptWithHash): Added.
(WebCore::ContentSecurityPolicyDirectiveList::allowInlineStyleWithHash): Added.
(WebCore::ContentSecurityPolicyDirectiveList::addDirective): Modified to pass the hash algorithms seen
from parsing the directives script-src, style-src, and default-src to the ContentSecurityPolicy object.
(WebCore::ContentSecurityPolicyDirectiveList::checkEval): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkInline): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkSource): Deleted.
(WebCore::ContentSecurityPolicyDirectiveList::checkMediaType): Deleted.
* page/csp/ContentSecurityPolicyDirectiveList.h:
* page/csp/ContentSecurityPolicyHash.h: Added.
(WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::hash): Compute the hash of a digest as
we would compute the hash of a string.
(WTF::DefaultHash<WebCore::ContentSecurityPolicyDigest>::Hash::equal): Compare digests for equality
by making use of Vector's equality operator.
* page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::matches): Checks if the hash is in the set of known hashes.
(WebCore::ContentSecurityPolicySourceList::parse): Modified to call ContentSecurityPolicySourceList::parseHashSource()
to try to parse the source list expression as a hash source. If this fails then we try to parse the
source expression as a scheme/host/port expression.
(WebCore::parseHashAlgorithmAdvancingPosition): Parses the hash algorithm from a hash source expression.
(WebCore::isBase64Character): Returns whether the specified character is a valid Base64/Base64url character,
excluding the padding character '='. Disregarding the omission of the padding character '=', this function
conforms to the ABNF grammar defined in section Source Lists of the Content Security Policy Level 3 spec.,
<https://w3c.github.io/webappsec-csp> (Editor’s Draft, 29 February 2016). We take the padding character '='
into account in ContentSecurityPolicySourceList::parseHashSource().
(WebCore::ContentSecurityPolicySourceList::parseHashSource): Parses a hash source expression per the ABNF
grammar described in section Source Lists of the Content Security Policy Level 3 spec.
* page/csp/ContentSecurityPolicySourceList.h:
(WebCore::ContentSecurityPolicySourceList::hashAlgorithmsUsed): Returns the set of hash algorithms seen from
parsing the source list.
(WebCore::ContentSecurityPolicySourceList::allowInline): We only allow inline scripts/stylesheets if
'unsafe-inline' was specified in the source list and the source list does not contain any hash sources.
* page/csp/ContentSecurityPolicySourceListDirective.cpp:
(WebCore::ContentSecurityPolicySourceListDirective::allows): Checks if the specified hash is in the source list.
* page/csp/ContentSecurityPolicySourceListDirective.h:
(WebCore::ContentSecurityPolicySourceListDirective::hashAlgorithmsUsed): Turns around and calls ContentSecurityPolicySourceList::hashAlgorithmsUsed().

LayoutTests:

Add new test http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html to ensure that
script hashes are interpreted correctly. Update many existing tests that had a hash source with
a SHA-1 hash to use a SHA-256 hash. The valid hash algorithms are SHA-256, SHA-384, and SHA-512
per the Content Security Policy Level 3 spec. At the time of writing, Blink also supports SHA-1.

* TestExpectations: Mark many CSP 1.1 tests as PASS so that we run them. Remove entries for tests
http/tests/security/contentSecurityPolicy/1.1/{script, style}hash-default-src.html as these tests
now pass.
* http/tests/security/contentSecurityPolicy/1.1/resources/didRunInlineScriptEpilogue.js: Added.
* http/tests/security/contentSecurityPolicy/1.1/resources/didRunInlineScriptPrologue.js: Added.
* http/tests/security/contentSecurityPolicy/1.1/resources/testScriptHash.php: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-allowed.html: Update test as SHA-1 is not
a supported hash algorithm per the Content Security Policy Level 3 spec.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-basic-blocked.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-default-src-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-ignore-unsafeinline-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-ignore-unsafeinline.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-malformed-expected.txt:
* http/tests/security/contentSecurityPolicy/1.1/scripthash-tests-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-tests.html: Added.
* http/tests/security/contentSecurityPolicy/1.1/scripthash-unicode-normalization.html: Update test
as SHA-1 is not a supported hash algorithm per the Content Security Policy Level 3 spec.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-allowed-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-allowed.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-error-event.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked-expected.txt: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-basic-blocked.html: Ditto.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-default-src-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/1.1/stylehash-svg-style-basic-blocked-error-event.html: Update test
as SHA-1 is not a supported hash algorithm per the Content Security Policy Level 3 spec.

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

4 years agoSpeculative revalidation requests do not have their 'first party for cookies' URL set
cdumez@apple.com [Thu, 10 Mar 2016 16:57:11 +0000 (16:57 +0000)]
Speculative revalidation requests do not have their 'first party for cookies' URL set
https://bugs.webkit.org/show_bug.cgi?id=155284
<rdar://problem/25053203>

Reviewed by Antti Koivisto.

Source/WebCore:

Export a few more symbols so they can be used in WebKit2.

* platform/URL.h:
* platform/network/ResourceRequestBase.h:

Source/WebKit2:

Speculative revalidation requests did not have their 'first party for cookies'
URL set. This means the underlying NSURLRequest has a nil mainDocumentURL.
Without a way to determine whether the cookie is in a third-party context,
CFNetwork defaults to accepting all cookies for these resources.

* NetworkProcess/cache/NetworkCacheCoders.cpp:
(WebKit::NetworkCache::Coder<WebCore::URL>::encode):
(WebKit::NetworkCache::Coder<WebCore::URL>::decode):
* NetworkProcess/cache/NetworkCacheCoders.h:
Add template specialization to support encoding / decoding WebCore::URL.

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
Set the "first party for cookies" URL on the revalidation request.

(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::registerSubresourceLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::PendingFrameLoad::saveToDiskIfReady):
Now keep the subresources' ResourceRequests, in addition to their key, so we can later
extract the 'first party for cookies' URL from the request and save it to disk.

(WebKit::NetworkCache::SpeculativeLoadManager::registerLoad):
Pass the ResourceRequest in addition to the key to
PendingFrameLoad::registerSubresourceLoad().

(WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
Add an extra SubresourceInfo parameter, in addition to the Entry, so we
have access to the first party for cookies URL. Pass this URL to
constructRevalidationRequest().

(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
Add an extra SubresourceInfo parameter, in addition to the Entry, so we
have access to the first party for cookies URL.

(WebKit::NetworkCache::SpeculativeLoadManager::startSpeculativeRevalidation):
Pass the SubresourceInfo to preloadEntry().

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h:

* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::encode):
(WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::decode):
Encode / Decode new firstPartyForCookies member.

(WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
(WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
Take SubresourceLoad objects in, instead of simple Key objects so we have
access to the ResourceRequest. We extract the first party for cookies URL
from the request and pass it to the SubresourceInfo constructor.

* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourcesEntry::SubresourceInfo::SubresourceInfo):
(WebKit::NetworkCache::SubresourcesEntry::SubresourceLoad::SubresourceLoad):

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

4 years agoEnable AVFoundationNSURLSessionEnabled by default
jer.noble@apple.com [Thu, 10 Mar 2016 16:28:52 +0000 (16:28 +0000)]
Enable AVFoundationNSURLSessionEnabled by default
https://bugs.webkit.org/show_bug.cgi?id=154469

Reviewed by Sam Weinig.

Source/WebCore:

* page/Settings.cpp:

Source/WebKit/mac:

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:

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

4 years ago[GTK] Add support for WOFF2
fred.wang@free.fr [Thu, 10 Mar 2016 15:30:42 +0000 (15:30 +0000)]
[GTK] Add support for WOFF2
https://bugs.webkit.org/show_bug.cgi?id=152616

.:

Patch by Frederic Wang <fwang@igalia.org> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* Source/CMakeLists.txt: Build brotli and woff2 third-party libraries if WOFF2 is enabled.
* Source/cmake/OptionsGTK.cmake: Always enable WOFF2 on GTK.

Source/ThirdParty:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

We import the source of the third-party brotli and woff2 libraries because release packages do not exist yet.
The script to update source from upstream as well as the makefile to compile relevant files are based on similar code from Mozilla.

* brotli/CMakeLists.txt: Added. We force BROTLI_BUILD_PORTABLE by default, see https://github.com/google/brotli/issues/307.
* brotli/LICENSE: Added.
* brotli/README.webkit: Added.
* brotli/dec/Makefile: Added.
* brotli/dec/bit_reader.c: Added.
* brotli/dec/bit_reader.h: Added.
* brotli/dec/context.h: Added.
* brotli/dec/decode.c: Added.
* brotli/dec/decode.h: Added.
* brotli/dec/dictionary.c: Added.
* brotli/dec/dictionary.h: Added.
* brotli/dec/huffman.c: Added.
* brotli/dec/huffman.h: Added.
* brotli/dec/port.h: Added.
(BrotliRBit):
* brotli/dec/prefix.h: Added.
* brotli/dec/state.c: Added.
* brotli/dec/state.h: Added.
* brotli/dec/transform.h: Added.
* brotli/dec/types.h: Added.
* brotli/update.sh: Added. This script helps to get the latest version of the decoder source code.
* woff2/CMakeLists.txt: Added. We only compile the decoder files.
* woff2/LICENSE: Added.
* woff2/README.webkit: Added.
* woff2/src/buffer.h: Added.
(woff2::Failure):
(woff2::Buffer::Buffer):
(woff2::Buffer::Skip):
(woff2::Buffer::Read):
(woff2::Buffer::ReadU8):
(woff2::Buffer::ReadU16):
(woff2::Buffer::ReadS16):
(woff2::Buffer::ReadU24):
(woff2::Buffer::ReadU32):
(woff2::Buffer::ReadS32):
(woff2::Buffer::ReadTag):
(woff2::Buffer::ReadR64):
(woff2::Buffer::buffer):
(woff2::Buffer::offset):
(woff2::Buffer::length):
(woff2::Buffer::set_offset):
* woff2/src/file.h: Added.
(woff2::GetFileContent):
(woff2::SetFileContents):
* woff2/src/font.cc: Added.
* woff2/src/font.h: Added.
* woff2/src/glyph.cc: Added.
* woff2/src/glyph.h: Added.
(woff2::Glyph::Glyph):
* woff2/src/normalize.cc: Added.
* woff2/src/normalize.h: Added.
* woff2/src/port.h: Added.
(woff2::Log2Floor):
* woff2/src/round.h: Added.
(woff2::Round4):
* woff2/src/store_bytes.h: Added.
(woff2::StoreU32):
(woff2::Store16):
(woff2::StoreBytes):
* woff2/src/table_tags.cc: Added.
* woff2/src/table_tags.h: Added.
* woff2/src/transform.cc: Added.
* woff2/src/transform.h: Added.
* woff2/src/variable_length.cc: Added.
* woff2/src/variable_length.h: Added.
* woff2/src/woff2_common.cc: Added.
* woff2/src/woff2_common.h: Added.
(woff2::Table::operator<):
* woff2/src/woff2_compress.cc: Added.
* woff2/src/woff2_dec.cc: Added.
* woff2/src/woff2_dec.h: Added.
* woff2/src/woff2_decompress.cc: Added.
* woff2/src/woff2_enc.cc: Added.
* woff2/src/woff2_enc.h: Added.
(woff2::WOFF2Params::WOFF2Params):
* woff2/update.sh: Added. This script helps to get the latest upstream version.

Source/WebCore:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

No new tests (Covered by existing tests).

* CMakeLists.txt: Add woff2 source to the include directory and link WebCore against brotli and woff2.
* platform/graphics/WOFFFileFormat.cpp:
(WebCore::isWOFF): Recognize the signature of WOFF2 font.
(WebCore::convertWOFFToSfnt): If the font has the WOFF2 signature, then try and decompress it using the woff2 library.
* platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
(WebCore::FontCustomPlatformData::supportsFormat): Add woff2 to the list of supported formats.

Source/WTF:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* wtf/FeatureDefines.h: Enable USE_WOFF2 flag on GTK.

Tools:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* Scripts/webkitpy/style/checker.py: Only verify basic style for third party modules brotli and woff2.

LayoutTests:

Patch by Frederic Wang <fwang@igalia.com> on 2016-03-10
Reviewed by Carlos Garcia Campos.

* fast/text/woff2-expected.html: Adjust font-size to work around anti-aliasing effects.
* fast/text/woff2.html: Ditto.
* platform/gtk/TestExpectations: Update test expectation of woff2 test for GTK.

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

4 years agoUnreviewed, revert changes accidentally committed with previous patch.
eric.carlson@apple.com [Thu, 10 Mar 2016 12:26:21 +0000 (12:26 +0000)]
Unreviewed, revert changes accidentally committed with previous patch.

* WebProcess/com.apple.WebProcess.sb.in:

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

4 years ago[css-grid] Fix placement for unknown named grid lines
rego@igalia.com [Thu, 10 Mar 2016 12:15:34 +0000 (12:15 +0000)]
[css-grid] Fix placement for unknown named grid lines
https://bugs.webkit.org/show_bug.cgi?id=155230

Reviewed by Sergio Villar Senin.

Source/WebCore:

The spec has changed and now all the implicit lines should be considered
when we're resolving named grid lines with an unknown name.

The relevant part of the spec is
(http://dev.w3.org/csswg/css-grid/#line-placement):
"If a name is given as a <custom-ident>, only lines with that name
 are counted. If not enough lines with that name exist,
 all implicit grid lines are assumed to have that name
 for the purpose of finding this position."

Modified the code to resolve named grid lines in GridResolvedPosition.
We need to keep the old behavior of considering "auto" unknown named
grid lines for the case of positioned grid items.

Test: fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution.html

* rendering/style/GridResolvedPosition.cpp:
(WebCore::adjustGridPositionsFromStyle):
(WebCore::lookAheadForNamedGridLine):
(WebCore::lookBackForNamedGridLine):
(WebCore::resolveNamedGridLinePositionFromStyle):
(WebCore::definiteGridSpanWithNamedLineSpanAgainstOpposite):
(WebCore::resolveNamedGridLinePositionAgainstOppositePosition):
(WebCore::resolveGridPositionAgainstOppositePosition):
(WebCore::resolveGridPositionFromStyle):

LayoutTests:

Updated current tests to the new expected behavior and created a new
test checking different cases explicitly.

* fast/css-grid-layout/grid-container-change-named-grid-lines-recompute-child.html:
* fast/css-grid-layout/grid-item-bad-named-area-auto-placement-expected.txt:
* fast/css-grid-layout/grid-item-bad-named-area-auto-placement.html:
* fast/css-grid-layout/grid-item-named-grid-area-resolution.html:
* fast/css-grid-layout/grid-item-named-grid-line-resolution-expected.txt:
* fast/css-grid-layout/grid-item-named-grid-line-resolution.html:
* fast/css-grid-layout/grid-item-negative-position-resolution.html:
* fast/css-grid-layout/grid-item-position-changed-dynamic.html:
* fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution-expected.txt: Added.
* fast/css-grid-layout/grid-item-unknown-named-grid-line-resolution.html: Added.
* fast/css-grid-layout/named-grid-lines-with-named-grid-areas-resolution.html:

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

4 years ago[MediaStream] push media stream state to the UI process
eric.carlson@apple.com [Thu, 10 Mar 2016 12:05:59 +0000 (12:05 +0000)]
[MediaStream] push media stream state to the UI process
https://bugs.webkit.org/show_bug.cgi?id=155281

Reviewed by Darin Adler.

Source/WebCore:

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream): Register with the document as an audio producer.
(WebCore::MediaStream::~MediaStream): Unregister.
(WebCore::MediaStream::setIsActive): Update document status.
(WebCore::MediaStream::pageMutedStateDidChange): Mute/unmute according to the page mute setting.
(WebCore::MediaStream::mediaState): Return state.
(WebCore::MediaStream::statusDidChange): Call document.updateIsPlayingMedia.
(WebCore::MediaStream::characteristicsChanged): Track stream mute state.
(WebCore::MediaStream::scheduleActiveStateChange): m_isActive -> m_active.
* Modules/mediastream/MediaStream.h:

* page/MediaProducer.h: Add HasActiveMediaCaptureDevice.

* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::hasVideo): Make const.
(WebCore::MediaStreamPrivate::hasAudio): Ditto.
(WebCore::MediaStreamPrivate::muted): New.
* platform/mediastream/MediaStreamPrivate.h:

* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::AVMediaCaptureSource): Initialize muted to true.
(WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange): Set muted.

Source/WebKit2:

* UIProcess/API/C/WKPage.cpp:
(WKPageGetMediaState): New.
* UIProcess/API/C/WKPagePrivate.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame): Clear m_mediaState.
(WebKit::WebPageProxy::isPlayingMediaDidChange): Call m_pageClient.isPlayingMediaDidChange when
  audio or video state changes, call m_uiClient->isPlayingAudioDidChange when audio, vidoe,
  or media stream state changes.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::mediaStateFlags): New.

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

4 years agoHow we load new.target in arrow functions is broken
gskachkov@gmail.com [Thu, 10 Mar 2016 08:19:42 +0000 (08:19 +0000)]
How we load new.target in arrow functions is broken
https://bugs.webkit.org/show_bug.cgi?id=155153

Reviewed by Saam Barati.

Fixed not correct approach of caching new.target. In current patch was added code feature
flag that shows that current function is using new.target, when generating byte code an arrow
function we are loading new.target value to its register from arrow function lexical environment.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitLoadNewTargetFromArrowFunctionLexicalEnvironment):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::newTarget):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createNewTargetExpr):
(JSC::ASTBuilder::usesNewTarget):
* parser/Nodes.h:
(JSC::ScopeNode::usesNewTarget):
* parser/ParserModes.h:
* tests/stress/arrowfunction-lexical-bind-newtarget.js:

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

4 years ago[GTK] Artifacts when using web view background color
carlosgc@webkit.org [Thu, 10 Mar 2016 07:13:48 +0000 (07:13 +0000)]
[GTK] Artifacts when using web view background color
https://bugs.webkit.org/show_bug.cgi?id=155229

Reviewed by Mario Sanchez Prada.

This is because when using a web view color, we fill with the
color every rectangle updated by the web process, but we should
always fill the entire backing store before rendering the actual
contents on top.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display): Ensure the web process always
renders the whole visible rectangle when background is rendered by
the UI process.

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

4 years agoWeb Inspector: Get a RemoteObject or ObjectPreview from HeapSnapshot Object Identifier
commit-queue@webkit.org [Thu, 10 Mar 2016 06:15:25 +0000 (06:15 +0000)]
Web Inspector: Get a RemoteObject or ObjectPreview from HeapSnapshot Object Identifier
https://bugs.webkit.org/show_bug.cgi?id=155264
<rdar://problem/25070716>

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

Source/JavaScriptCore:

* inspector/InjectedScript.h:
* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::functionDetails):
(Inspector::InjectedScript::previewValue):
New InjectedScript methods for building Debugger.FunctionDetails
or Runtime.ObjectPreview protocol objects from a JSValue.

* inspector/InjectedScriptSource.js:
(InjectedScript.prototype.previewValue):
(InjectedScript.prototype.functionDetails):
(InjectedScript.prototype.getFunctionDetails):
(InjectedScript.RemoteObject.prototype._isPreviewableObjectInternal):
(InjectedScript.RemoteObject.prototype._createObjectPreviewForValue): Deleted.
(InjectedScript.RemoteObject.prototype._appendEntryPreviews): Deleted.
Share code around creating function details or object preview objects.

* inspector/agents/InspectorHeapAgent.cpp:
(Inspector::InspectorHeapAgent::InspectorHeapAgent):
(Inspector::InspectorHeapAgent::nodeForHeapObjectIdentifier):
(Inspector::InspectorHeapAgent::getPreview):
(Inspector::InspectorHeapAgent::getRemoteObject):
* inspector/agents/InspectorHeapAgent.h:
* inspector/protocol/Heap.json:
New protocol methods that go from heap object identifier to a
remote object or some kind of preview.

* inspector/scripts/codegen/generator.py:
Allow runtime casts for ObjectPreview.

LayoutTests:

* inspector/heap/getPreview-expected.txt: Added.
* inspector/heap/getPreview.html: Added.
* inspector/heap/getRemoteObject-expected.txt: Added.
* inspector/heap/getRemoteObject.html: Added.
Test the new protocol methods in different scenarios.

* inspector/heap/snapshot-expected.txt:
* inspector/heap/snapshot.html:
Fix typo.

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

4 years ago[INTL] Intl Constructors not web compatible with Object.create usage
commit-queue@webkit.org [Thu, 10 Mar 2016 05:28:34 +0000 (05:28 +0000)]
[INTL] Intl Constructors not web compatible with Object.create usage
https://bugs.webkit.org/show_bug.cgi?id=153679

Patch by Andy VanWagoner <thetalecrafter@gmail.com> on 2016-03-09
Reviewed by Darin Adler.

Source/JavaScriptCore:

Add workaround for initializing NumberFormat and DateTimeFormat objects
using Object.create followed by constructor.call. This is necessary for
backwards compatibility with libraries relying on v1 behavior of Intl
constructors.

Collator does not get the workaround, since polyfills do not include it,
and there are not any known instances of v2 incompatible libraries.

The workaround involves checking for an object that inherits from the
*Format constructor, but was not actually initialized with that type. A
substitute instance is created and attached to the object using a private
name. The prototype functions then check for the private property to use
in place of the original object.

Since this behavior is not part of the v2 spec, it should be removed as
soon as the incompatible behavior is no longer in common use.

* runtime/CommonIdentifiers.h:
* runtime/IntlDateTimeFormatConstructor.cpp:
(JSC::callIntlDateTimeFormat):
* runtime/IntlDateTimeFormatPrototype.cpp:
(JSC::IntlDateTimeFormatPrototypeGetterFormat):
(JSC::IntlDateTimeFormatPrototypeFuncResolvedOptions):
* runtime/IntlNumberFormatConstructor.cpp:
(JSC::callIntlNumberFormat):
* runtime/IntlNumberFormatPrototype.cpp:
(JSC::IntlNumberFormatPrototypeGetterFormat):
(JSC::IntlNumberFormatPrototypeFuncResolvedOptions):

LayoutTests:

Add tests for Object.create + contructor.call initialization of NumberFormat
and DateTimeFormat objects.

* js/intl-datetimeformat-expected.txt:
* js/intl-numberformat-expected.txt:
* js/script-tests/intl-datetimeformat.js:
* js/script-tests/intl-numberformat.js:

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

4 years agoExtract EventPath.h/cpp out of EventDispatcher.cpp
rniwa@webkit.org [Thu, 10 Mar 2016 05:27:07 +0000 (05:27 +0000)]
Extract EventPath.h/cpp out of EventDispatcher.cpp
https://bugs.webkit.org/show_bug.cgi?id=155285

Reviewed by Chris Dumez.

Extracted EventPath.h/cpp out of EventDispatcher.cpp to add the support for Event.deepPath()
in webkit.org/b/153538. The new file defines member functions of EventPath and RelatedNodeRetargeter.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/DOMAllInOne.cpp:
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchScopedEvent):
(WebCore::EventDispatcher::dispatchEvent):
(WebCore::EventPath): Moved to EventPath.cpp.
(WebCore::eventTargetRespectingTargetRules): Moved to EventPath.h.
(WebCore::shouldEventCrossShadowBoundary): Moved to EventPath.cpp.
(WebCore::nodeOrHostIfPseudoElement): Ditto.
(WebCore::RelatedNodeRetargeter): Moved to EventPath.cpp.
* dom/EventPath.cpp: Added.
(WebCore::shouldEventCrossShadowBoundary): Moved from EventDispatcher.cpp.
(WebCore::nodeOrHostIfPseudoElement): Ditto.
(WebCore::EventPath::EventPath): Ditto.
(WebCore::RelatedNodeRetargeter): Ditto.
* dom/EventPath.h: Added.
(WebCore::EventPath::isEmpty):
(WebCore::EventPath::size):
(WebCore::EventPath::contextAt):
(WebCore::EventPath::lastContextIfExists):
(WebCore::EventPath::eventTargetRespectingTargetRules): Moved from EventDispatcher.cpp.

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

4 years agoFont antialiasing (smoothing) changes when elements are rendered into compositing...
simon.fraser@apple.com [Thu, 10 Mar 2016 05:26:25 +0000 (05:26 +0000)]
Font antialiasing (smoothing) changes when elements are rendered into compositing layers
https://bugs.webkit.org/show_bug.cgi?id=23364
rdar://problem/7288429

Reviewed by Tim Horton.
Source/WebCore:

Improve the appearance of subpixel-antialiased ("smoothed") text in non-opaque layers
by opting in to a new CALayer backing store format.

GraphicsLayer now has setSupportsSmoothedFonts(), which is called by RenderLayerBacking
when the platform has support for the new feature. Ideally this would only be set when
we know a layer has smoothed text drawn into it, but, for now, enable this for all
layers. The right thing happens with opaque layers under the hood.

setSupportsSmoothedFonts() is turned into a PlatformCALayer contentsFormat flag, which
is ultimately passed to setBackingStoreFormat().

We also need to propagate this flag to TileController tiles.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::supportsSmoothedFonts):
(WebCore::GraphicsLayer::setSupportsSmoothedFonts):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::supportsSmoothedFontsInNonOpaqueLayers):
(WebCore::GraphicsLayerCA::setSupportsSmoothedFonts):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateContentsFormat):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator): Give the number a "shadow" when
the contents format says we support smoothed fonts.
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setTileContentsFormatFlags):
(WebCore::TileController::createTileLayer):
* platform/graphics/ca/TileController.h:
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::updateTileLayerProperties):
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::setBackingStoreFormat):
(PlatformCALayerCocoa::commonInit):
(PlatformCALayerCocoa::setContentsFormat):
(PlatformCALayer::drawLayerContents): Previously, we turned off font smoothing in
non-opaque layers to improve text appearance. We no longer need to do that when
the contents format has "SmoothedFonts".
* platform/ios/LegacyTileGridTile.mm:
(WebCore::setBackingStoreFormat):
(WebCore::LegacyTileGridTile::LegacyTileGridTile):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer):

Source/WebKit2:

Send the ContentsFormat to the UI process (but nothing happens to it there yet).

* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::setContentsFormat):
(WebKit::PlatformCALayerRemote::contentsFormat):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

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

4 years agoWebKit should adopt journal_mode=wal for all SQLite databases.
barraclough@apple.com [Thu, 10 Mar 2016 05:17:58 +0000 (05:17 +0000)]
WebKit should adopt journal_mode=wal for all SQLite databases.
https://bugs.webkit.org/show_bug.cgi?id=133496

Reviewed by Brady Eidson & Darin Adler.

The statement intended to enable WAL mode is always failing because it is missing a
prepare(). Fix this. We were also previously permitting SQLITE_OK results - this
was in error (we were only getting these because stepping the unprepared statement
returned SQLITE_OK). Also set the SQLITE_OPEN_AUTOPROXY flag when opening the
database - this will improve perfomance when the database is accessed via an AFP
mount.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open):
    - call prepareAndStep(), only check for SQLITE_ROW result.
* platform/sql/SQLiteFileSystem.cpp:
(WebCore::SQLiteFileSystem::openDatabase):
    - should set SQLITE_OPEN_AUTOPROXY flag when opening database.

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

4 years agoAdd runtime flags for shadow DOM and custom elements
rniwa@webkit.org [Thu, 10 Mar 2016 04:43:14 +0000 (04:43 +0000)]
Add runtime flags for shadow DOM and custom elements
https://bugs.webkit.org/show_bug.cgi?id=155213

Reviewed by Dean Jackson.

Source/WebCore:

Added new runtime flags for shadow DOM and custom elements.

* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setShadowDOMEnabled): Added.
(WebCore::RuntimeEnabledFeatures::shadowDOMEnabled): Added.
(WebCore::RuntimeEnabledFeatures::setCustomElementsEnabled): Added.
(WebCore::RuntimeEnabledFeatures::customElementsEnabled): Added.
* dom/Document.idl:
* dom/Element.idl:
* dom/Node.idl:
* dom/NonDocumentTypeChildNode.idl:
* dom/ShadowRoot.idl:
* html/HTMLSlotElement.idl:

Source/WebKit/mac:

Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences shadowDOMEnabled]):
(-[WebPreferences setShadowDOMEnabled:]):
(-[WebPreferences customElementsEnabled]):
(-[WebPreferences setCustomElementsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShadowDOMEnabled):
(WKPreferencesGetShadowDOMEnabled):
(WKPreferencesSetCustomElementsEnabled):
(WKPreferencesGetCustomElementsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WTF:

Removed the manual overrides of ENABLE_SHADOW_DOM and ENABLE_CUSTOM_ELEMENTS as they were
making --no-shadow-dom and --no-custom-elements flags on build-webkit useless.

* wtf/FeatureDefines.h:

Tools:

Always enable shadow DOM and custom elements during testing.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShadowDOMEnabled): Added.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

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

4 years agoHandling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test...
bfulgham@apple.com [Thu, 10 Mar 2016 04:06:51 +0000 (04:06 +0000)]
Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage
https://bugs.webkit.org/show_bug.cgi?id=155265
<rdar://problem/11101440>

Reviewed by Andy Estes.

Source/WebKit2:

We require "AllowUniversalAccessFromFileURLs" to permit file URLs from accessing
localStorage. However, this setting is not available on the Cocoa WKPreference (by design).
Instead, you need to set this value on the WKWebViewConfiguration.

Back out the work-around landed in r197889,

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration init]): Remove test workaround.
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage): Set the correct flag on
the WKWebViewConfiguration.

Tools:

WK2 localStorage tests need the 'AllowUniversalAccessFromFileURLs' preference set by default.
Tests that confirm blocking localStorage manually set the flag to "False" in the test.

* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::initializeWebViewConfiguration): Set the default state to the correct value.

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

4 years agoWeb Inspector: LayoutTimelineView path components should reflect grid row nesting
mattbaker@apple.com [Thu, 10 Mar 2016 03:16:44 +0000 (03:16 +0000)]
Web Inspector: LayoutTimelineView path components should reflect grid row nesting
https://bugs.webkit.org/show_bug.cgi?id=155279
<rdar://problem/25075355>

Reviewed by Timothy Hatcher.

* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype.get selectionPathComponents):
Walk grid nodes to build path component array.

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

4 years agoAdd proper JSON.stringify support for Proxy when the target is an array
sbarati@apple.com [Thu, 10 Mar 2016 02:41:34 +0000 (02:41 +0000)]
Add proper JSON.stringify support for Proxy when the target is an array
https://bugs.webkit.org/show_bug.cgi?id=155180

Reviewed by Darin Adler.

This patch makes the following type of program true:
`JSON.stringify(new Proxy([25], {})) === "[25]"`

We need to change the JSON stringifier to use the IsArray test
in section 7.2.2 of ES6 spec instead of the JSC inherits(JSArray::info())
test.

This patch also adds tests for general JSON.stringify support
of Proxy.

* runtime/ArrayConstructor.cpp:
(JSC::arrayConstructorIsArray):
(JSC::arrayConstructorPrivateFuncIsArrayConstructor):
* runtime/ArrayConstructor.h:
(JSC::isArray):
* runtime/JSONObject.cpp:
(JSC::Stringifier::Holder::object):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Stringifier::startNewLine):
(JSC::Stringifier::Holder::Holder):
* tests/es6.yaml:
* tests/stress/proxy-json.js: Added.
(assert):
(test):

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

4 years agodefineElement should upgrade existing unresolved custom elements
rniwa@webkit.org [Thu, 10 Mar 2016 02:33:12 +0000 (02:33 +0000)]
defineElement should upgrade existing unresolved custom elements
https://bugs.webkit.org/show_bug.cgi?id=155107

Reviewed by Darin Adler.

Source/WebCore:

Added the support for upgrading existing unresolved custom elements when defineElement is called.

The current implementation upgrades elements in the order they were created and has the issue that
it keeps accumulating all elements with a hyphen in its name until defineElement is called as
documented in https://github.com/w3c/webcomponents/issues/419

This patch re-purposes IsEditingTextFlag to indicate that the node is an unresolved custom element.
Since isEditingText() is only called in textRendererIsNeeded only on Text nodes, it's mutually
exclusive with isUnresolvedCustomElement().

The list of unresolved custom elements is kept in m_upgradeCandidatesMap, a hash map of element names
to the list of unresolved elements with that name.

In addition, added the logic to use HTMLElement as the interface for unresolved custom element instead
of HTMLUnknownElement.

Test: fast/custom-elements/upgrading/upgrading-parser-created-element.html

* bindings/js/JSCustomElementInterface.cpp:
(WebCore::JSCustomElementInterface::upgradeElement): Clear the flag.
* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::defineElement): Set the unique private name to keep the interface alive before
calling addElementDefinition as the call can now invoke author scripts.
* dom/CustomElementDefinitions.cpp:
(WebCore::CustomElementDefinitions::addElementDefinition): Upgrade existing unresolved elements kept
in m_upgradeCandidatesMap.
(WebCore::CustomElementDefinitions::addUpgradeCandidate): Added.
* dom/CustomElementDefinitions.h:
* dom/Document.cpp:
(WebCore::createHTMLElementWithNameValidation): Added the code to add the unresolved custom elements
to the upgrade candidates map. Also instantiate it as HTMLElement instead of HTMLUnknownElement.
(WebCore::createFallbackHTMLElement): Ditto.
* dom/Node.h:
(WebCore::Node::setIsCustomElement):
(WebCore::Node::isUnresolvedCustomElement): Added.
(WebCore::Node::setIsUnresolvedCustomElement): Added.
(WebCore::Node::setCustomElementIsResolved): Added. Clears IsEditingTextOrUnresolvedCustomElementFlag
and sets IsCustomElement.
(WebCore::Node::isEditingText): Check both IsEditingTextOrUnresolvedCustomElementFlag and IsTextFlag
for safety even though it's currently only used in textRendererIsNeeded which takes Text&.
* dom/make_names.pl:
(defaultParametersHash): Added customElementInterfaceName as a parameter.
(printWrapperFactoryCppFile): Generate the code to use customElementInterfaceName when the element
for which the wrapper is created has isUnresolvedCustomElement flag set.
* html/HTMLTagNames.in: Use HTMLElement for unresolved custom elements.
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Added the code to add
the unresolved custom elements to the upgrade candidates map. Also instantiate it as HTMLElement instead
of HTMLUnknownElement.

LayoutTests:

Added W3C style testharness.js tests for asynchronously defining custom elements.

* fast/custom-elements/upgrading/Node-cloneNode.html:
* fast/custom-elements/upgrading/upgrading-parser-created-element-expected.txt: Added.
* fast/custom-elements/upgrading/upgrading-parser-created-element.html: Added.

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

4 years agoRetrieve additional context for some data detector link for preview and action menu.
enrica@apple.com [Thu, 10 Mar 2016 02:05:49 +0000 (02:05 +0000)]
Retrieve additional context for some data detector link for preview and action menu.
https://bugs.webkit.org/show_bug.cgi?id=155278
rdar://problem/24884951

Reviewed by Tim Horton.

Source/WebCore:

Adding helper function to compute a range by moving by a number of characters
from a given position and direction.
Adding function to check if the given data detector link element requires
an extended context.

* editing/VisibleUnits.cpp:
(WebCore::rangeExpandedByCharactersInDirectionAtWordBoundary):
* editing/VisibleUnits.h:
* editing/cocoa/DataDetection.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::requiresExtendedContext):

Source/WebKit2:

Data detector results for items like calendar events, can be augmented
retrieving the text surrounding the link.

* Platform/spi/ios/DataDetectorsUISPI.h:
* Shared/ios/InteractionInformationAtPosition.h:
* Shared/ios/InteractionInformationAtPosition.mm:
(WebKit::InteractionInformationAtPosition::encode):
(WebKit::InteractionInformationAtPosition::decode):
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant showDataDetectorsSheet]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _dataForPreviewItemController:atPosition:type:]):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::getPositionInformation):

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

4 years agoES6: Implement lexical scoping for function definitions in strict mode
sbarati@apple.com [Thu, 10 Mar 2016 02:04:20 +0000 (02:04 +0000)]
ES6: Implement lexical scoping for function definitions in strict mode
https://bugs.webkit.org/show_bug.cgi?id=152844

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

This patch implements block scoping for function definitions
in strict mode. The implementation works as follows:

- If we're in sloppy mode, function declarations work exactly
  as they did before this patch. I.e, function declarations are hoisted
  and declared like "var" variables.

- If you're in strict mode and at the top of a function scope or program
  scope, function declarations still work like they used to. They are defined
  like "var" variables. This is necessary for backwards compatibility
  because ES5 strict mode allowed duplicate function declarations at the
  top-most scope of a program/function.

- If you're in strict mode and inside a block statement or a switch statement,
  function declarations are now block scoped. All function declarations within
  a block are hoisted to the beginning of the block. They are not hoisted out of the
  block like they are in sloppy mode. This allows for the following types of
  programs:
  ```
  function foo() {
      function bar() { return 20; }
      {
          function bar() { return 30; }
          bar(); // 30
      }
      bar(); // 20
  }
  ```

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::instantiateLexicalVariables):
(JSC::BytecodeGenerator::emitPrefillStackTDZVariables):
(JSC::BytecodeGenerator::pushLexicalScope):
(JSC::BytecodeGenerator::pushLexicalScopeInternal):
(JSC::BytecodeGenerator::initializeBlockScopedFunctions):
(JSC::BytecodeGenerator::popLexicalScope):
(JSC::BytecodeGenerator::liftTDZCheckIfPossible):
(JSC::BytecodeGenerator::pushTDZVariables):
(JSC::BytecodeGenerator::getVariablesUnderTDZ):
(JSC::BytecodeGenerator::emitNewRegExp):
(JSC::BytecodeGenerator::emitNewFunctionExpressionCommon):
(JSC::BytecodeGenerator::emitNewFunctionExpression):
(JSC::BytecodeGenerator::emitNewArrowFunctionExpression):
* bytecompiler/BytecodeGenerator.h:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createSourceElements):
(JSC::ASTBuilder::features):
(JSC::ASTBuilder::numConstants):
(JSC::ASTBuilder::createFuncDeclStatement):
(JSC::ASTBuilder::createClassDeclStatement):
(JSC::ASTBuilder::createBlockStatement):
(JSC::ASTBuilder::createTryStatement):
(JSC::ASTBuilder::createSwitchStatement):
(JSC::ASTBuilder::Scope::Scope):
(JSC::ASTBuilder::funcDeclarations): Deleted.
* parser/NodeConstructors.h:
(JSC::CaseBlockNode::CaseBlockNode):
(JSC::SwitchNode::SwitchNode):
(JSC::BlockNode::BlockNode):
* parser/Nodes.cpp:
(JSC::ScopeNode::ScopeNode):
(JSC::ScopeNode::singleStatement):
(JSC::ProgramNode::ProgramNode):
(JSC::ModuleProgramNode::ModuleProgramNode):
(JSC::EvalNode::EvalNode):
(JSC::FunctionNode::FunctionNode):
(JSC::VariableEnvironmentNode::VariableEnvironmentNode):
* parser/Nodes.h:
(JSC::VariableEnvironmentNode::VariableEnvironmentNode):
(JSC::VariableEnvironmentNode::lexicalVariables):
(JSC::VariableEnvironmentNode::functionStack):
(JSC::ScopeNode::captures):
(JSC::ScopeNode::varDeclarations):
(JSC::ScopeNode::neededConstants):
(JSC::ProgramNode::startColumn):
(JSC::ProgramNode::endColumn):
(JSC::EvalNode::startColumn):
(JSC::EvalNode::endColumn):
(JSC::ModuleProgramNode::startColumn):
(JSC::ModuleProgramNode::endColumn):
(JSC::ScopeNode::functionStack): Deleted.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::didFinishParsing):
(JSC::Parser<LexerType>::parseStatementListItem):
(JSC::Parser<LexerType>::parseSwitchStatement):
(JSC::Parser<LexerType>::parseBlockStatement):
(JSC::Parser<LexerType>::parseStatement):
(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::getMetadata):
(JSC::Parser<LexerType>::parseFunctionDeclaration):
(JSC::Parser<LexerType>::parseExportDeclaration):
* parser/Parser.h:
(JSC::Scope::declareVariable):
(JSC::Scope::declareFunction):
(JSC::Scope::appendFunction):
(JSC::Scope::takeFunctionDeclarations):
(JSC::Scope::declareLexicalVariable):
(JSC::Parser::currentVariableScope):
(JSC::Parser::currentLexicalDeclarationScope):
(JSC::Parser::currentFunctionScope):
(JSC::Parser::pushScope):
(JSC::Parser::popScopeInternal):
(JSC::Parser::declareVariable):
(JSC::Parser::declareFunction):
(JSC::Parser::hasDeclaredVariable):
(JSC::Parser::isFunctionMetadataNode):
(JSC::Parser<LexerType>::parse):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createFuncDeclStatement):
(JSC::SyntaxChecker::createClassDeclStatement):
(JSC::SyntaxChecker::createBlockStatement):
(JSC::SyntaxChecker::createExprStatement):
(JSC::SyntaxChecker::createIfStatement):
(JSC::SyntaxChecker::createContinueStatement):
(JSC::SyntaxChecker::createTryStatement):
(JSC::SyntaxChecker::createSwitchStatement):
(JSC::SyntaxChecker::createWhileStatement):
(JSC::SyntaxChecker::createWithStatement):
(JSC::SyntaxChecker::createDoWhileStatement):
* parser/VariableEnvironment.h:
(JSC::VariableEnvironmentEntry::isExported):
(JSC::VariableEnvironmentEntry::isImported):
(JSC::VariableEnvironmentEntry::isImportedNamespace):
(JSC::VariableEnvironmentEntry::isFunction):
(JSC::VariableEnvironmentEntry::setIsCaptured):
(JSC::VariableEnvironmentEntry::setIsConst):
(JSC::VariableEnvironmentEntry::setIsExported):
(JSC::VariableEnvironmentEntry::setIsImported):
(JSC::VariableEnvironmentEntry::setIsImportedNamespace):
(JSC::VariableEnvironmentEntry::setIsFunction):
(JSC::VariableEnvironmentEntry::clearIsVar):
(JSC::VariableEnvironment::VariableEnvironment):
(JSC::VariableEnvironment::begin):
(JSC::VariableEnvironment::end):
* tests/es6.yaml:
* tests/stress/block-scoped-function-declarations.js: Added.
(assert):
(test):
(f.foo.bar):
(f.foo.):
(f.foo):
(f):
(assert.foo.):
(assert.foo):
(assert.foo.foo):
(assert.foo.bar):
(assert.foo.switch.case.1):
(assert.foo.switch.case.2):
(assert.foo.switch.foo):
(assert.foo.switch.bar):

LayoutTests:

* js/let-syntax-expected.txt:
* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:
(testFailed):
(runTest):

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

4 years agoLast opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
barraclough@apple.com [Thu, 10 Mar 2016 01:55:34 +0000 (01:55 +0000)]
Last opened tab does not receive SetHiddenPageTimerThrottlingIncreaseLimit message
https://bugs.webkit.org/show_bug.cgi?id=155126

Reviewed by Anders Carlson.

WebPageProxy will increment the hidden page throttling counter from within its constructor,
which currently causes the WebProcessPool to try to synchronously message all processes.
The web page triggering the increment then fails to receive the message, since it was
still being constructed. Make the update of the limit async, such that the page is fully
constructed before the WebProcessPool processes the update.

* UIProcess/WebProcessPool.cpp:
(WebKit::m_hiddenPageThrottlingAutoIncreasesCounter):
    - This now schedules a zero-delay timer to handle the update.
(WebKit::m_hiddenPageThrottlingTimer):
    - This is now responsible for calling updateHiddenPageThrottlingAutoIncreaseLimit.
* UIProcess/WebProcessPool.h:
    - Added m_hiddenPageThrottlingTimer.

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