WebKit-https.git
2 years agoAdd isolated text tests for MotionMark
jonlee@apple.com [Mon, 13 Nov 2017 06:54:44 +0000 (06:54 +0000)]
Add isolated text tests for MotionMark
https://bugs.webkit.org/show_bug.cgi?id=179226

Reviewed by Darin Adler.

Add a private suite that simplifies the design test.

* MotionMark/resources/debug-runner/tests.js:
* MotionMark/resources/runner/tests.js:
* MotionMark/tests/master/design.html: Copied from PerformanceTests/MotionMark/tests/master/text.html.
Rename the html file to the title of the test.
* MotionMark/tests/master/resources/design.js: Renamed from PerformanceTests/MotionMark/tests/master/resources/text.js.
* MotionMark/tests/text/design-6.html: Copied from PerformanceTests/MotionMark/tests/master/text.html.
Six active cells
* MotionMark/tests/text/design-6.js: Added.
* MotionMark/tests/text/design.html: Renamed from PerformanceTests/MotionMark/tests/master/text.html.
Replace the text with empty table cells that are populated with desired text.
* MotionMark/tests/text/design.js: Added.

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

2 years ago[Service Workers] Activate algorithm says terminate the active worker if it exists
cdumez@apple.com [Mon, 13 Nov 2017 06:39:14 +0000 (06:39 +0000)]
[Service Workers] Activate algorithm says terminate the active worker if it exists
https://bugs.webkit.org/show_bug.cgi?id=179559

Reviewed by Darin Adler.

Activate algorithm says terminate the active worker if it exists:
- https://w3c.github.io/ServiceWorker/#activation-algorithm (Step 2.1)

No new tests, no-op for now as the terminate() function is not implemented
yet.

* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::activate):

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

2 years agoMore is<> and downcast<>, less static_cast<>
darin@apple.com [Mon, 13 Nov 2017 06:12:09 +0000 (06:12 +0000)]
More is<> and downcast<>, less static_cast<>
https://bugs.webkit.org/show_bug.cgi?id=179600

Reviewed by Chris Dumez.

Source/JavaScriptCore:

* runtime/JSString.h:
(JSC::jsSubstring): Removed unneeded static_cast; length already returns unsigned.
(JSC::jsSubstringOfResolved): Ditto.

Source/WebCore:

* Modules/fetch/FetchBody.cpp:
(WebCore::FetchBody::extract): Use downcast instead of static_cast.
(WebCore::FetchBody::bodyAsFormData const): Ditto.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::putOrAdd): Ditto.
* Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
(WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): Ditto.
* Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
(WebCore::libWebRTCProvider): Ditto.

* accessibility/AccessibilityMediaControls.cpp:
(WebCore::AccessibilityMediaTimeDisplay::stringValue const): Got rid of local
variable and used std::abs instead of fabsf. Did not use downcast here because
it doesn't exist for this class.

* bindings/js/JSEventTargetCustom.h:
(WebCore::IDLOperation<JSEventTarget>::call): Use downcast instead of toDOMWindow.
* dom/DocumentEventQueue.cpp:
(WebCore::DocumentEventQueue::dispatchEvent): Ditto.

* dom/Element.h: Added is/downcast for EventTarget.

* dom/EventContext.cpp:
(WebCore::TouchEventContext::checkReachability const): Use downcast instead
of toNode.
* dom/EventContext.h:
(WebCore::EventContext::isUnreachableNode const): Ditto.
* dom/EventPath.cpp:
(WebCore::shouldEventCrossShadowBoundary): Ditto.
(WebCore::EventPath::setRelatedTarget): Ditto.
(WebCore::EventPath::retargetTouch): Ditto.
(WebCore::EventPath::EventPath): Ditto.

* dom/EventTarget.cpp:
(WebCore::EventTarget::toNode): Deleted.
(WebCore::EventTarget::isNode const): Added.
(WebCore::EventTarget::toDOMWindow): Deleted.
(WebCore::EventTarget::isMessagePort const): Deleted. This was not used.
(WebCore::EventTarget::addEventListener): Use downcast instead of toDOMWindow
and toNode.
* dom/EventTarget.h: Updated for the above.

* dom/MessagePort.h: Deleted unused isMessagePort.

* dom/MouseEvent.cpp:
(WebCore::MouseEvent::toElement const): Use downcast instead of toNode.
Also refactored to make function a little smaller.
(WebCore::MouseEvent::fromElement const): Ditto.

* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::computeRelativePosition): Use downcast
instead of toNode.

* dom/Node.cpp:
(WebCore::Node::isNode const): Added.
(WebCore::Node::toNode): Deleted.
* dom/Node.h: Updated for the above. Also added SPECIALIZE_TYPE_TRAITS
so we can do is/downcast.

* dom/ScopedEventQueue.cpp:
(WebCore::ScopedEventQueue::enqueueEvent): Use is instead of toNode.
(WebCore::ScopedEventQueue::dispatchEvent const): Use downcast instead of toNode.

* dom/make_names.pl:
(printTypeHelpers): Added support for is/downcast from EventTarget.

* editing/Editor.cpp:
(WebCore::Editor::selectionForCommand): Use is/downcast instead of toNode.
* editing/EditorCommand.cpp:
(WebCore::targetFrame): Ditto.
* html/HTMLAnchorElement.cpp:
(WebCore::appendServerMapMousePosition): Ditto.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::createContextWebGL): Use downcast instead of
static_cast.
(WebCore::HTMLCanvasElement::getContextWebGL): Ditto.
(WebCore::HTMLCanvasElement::getImageData): Ditto.

* html/HTMLElement.h: Added support for is/downcast from EventTarget.

* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::handleLocalEvents): Use is instead of toNode.
(WebCore::submitElementFromEvent): Deleted. Was a duplicate of findSubmitButton.
(WebCore::HTMLFormElement::prepareForSubmission): Rewrote code that calls
submitElementFromEvent to call findSubmitButton instead. Also don't bother
finding the submit button unless we are going to validate, since all we do
after finding it is reconsider whether we should validate.
(WebCore::HTMLFormElement::findSubmitButton const): Rewrote to use is,
downcast, and lineageOfType rather than a handwritten loop and toNode.
Relies on the fact that the target is an element, never a text node.

* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::defaultEventHandler): Use is and downcast instead
of toNode.

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const): Changed argument
type to EventTarget so we can do the type checking and casting here instead of at
each of the callers.
* html/HTMLPlugInImageElement.h: Updated for the above.

* html/HTMLSummaryElement.cpp:
(WebCore::isClickableControl): Changed argument type to EventTarget so we can do
the type checking and casting here instead of at each of the callers.
(WebCore::HTMLSummaryElement::defaultEventHandler): Removed call to toNode.

* html/HTMLTextFormControlElement.h: Added support for is/downcast from EventTarget.

* html/MediaDocument.cpp:
(WebCore::MediaDocument::defaultEventHandler): Use is/downcast instead of toNode.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::handleMouseDownEvent): Ditto.
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler): Ditto.
(WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): Ditto.
Also use get instead of find/end.

* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::containsRelatedTarget): Use is/downcast instead of toNode.
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent): Ditto.
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::didAddEventListener): Ditto.
(WebCore::InspectorDOMAgent::willRemoveEventListener): Ditto.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::maybeCreateContextMenu): Ditto.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::toDOMWindow): Deleted.
* page/DOMWindow.h: Updated for the above. Also added SPECIALIZE_TYPE_TRAITS
so we can do is/downcast.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleTouchEvent): Use is/downcast instead of toNode.

* platform/graphics/WidthCache.h:
(WebCore::WidthCache::add): Removed unneeded static_cast; length already returns unsigned.

* rendering/RenderSnapshottedPlugIn.cpp:
(WebCore::RenderSnapshottedPlugIn::handleEvent): Removed unneeded toNode now that
partOfSnapshotOverlay takes an EventTarget.

Source/WebKit:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMPrivate.cpp:
(WebKit::wrap): Use is/downcast.
* WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:
(WebKit::WebEditorClient::handleKeyboardEvent): Ditto.
* WebProcess/WebCoreSupport/wpe/WebEditorClientWPE.cpp:
(WebKit::WebEditorClient::handleKeyboardEvent): Ditto.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::handleEditingKeyboardEvent): Ditto.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::frameForEvent): Ditto.

Source/WebKitLegacy/mac:

* DOM/DOM.mm:
(kit): Use is/downcast.
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::handleKeyboardEvent): Ditto.
(WebEditorClient::handleInputMethodKeydown): Ditto.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _interpretKeyEvent:savingCommands:]): Ditto.

Source/WebKitLegacy/win:

* WebView.cpp:
(WebView::handleEditingKeyboardEvent): Use downcast.

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

2 years agoVersioning.
matthew_hanson@apple.com [Mon, 13 Nov 2017 00:23:00 +0000 (00:23 +0000)]
Versioning.

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

2 years ago[GTK] Add functionality to handle font sizes in points
commit-queue@webkit.org [Sun, 12 Nov 2017 19:50:58 +0000 (19:50 +0000)]
[GTK] Add functionality to handle font sizes in points
https://bugs.webkit.org/show_bug.cgi?id=179285

Patch by Gabriel Ivascu <givascu@igalia.com> on 2017-11-12
Reviewed by Carlos Garcia Campos and Michael Catanzaro.

Source/WebCore:

* platform/PlatformScreen.h:
* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::screenDPI):
* platform/wpe/PlatformScreenWPE.cpp:
(WebCore::screenDPI):

Source/WebKit:

* UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_class_init):
(webkit_settings_font_size_to_points):
(webkit_settings_font_size_to_pixels):
* UIProcess/API/gtk/WebKitSettings.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:

Tools:

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp:
(testWebKitSettings):

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

2 years ago[WebCore] Implement import.meta.url
utatane.tea@gmail.com [Sun, 12 Nov 2017 17:52:36 +0000 (17:52 +0000)]
[WebCore] Implement import.meta.url
https://bugs.webkit.org/show_bug.cgi?id=178672

Reviewed by Darin Adler.

Source/WebCore:

This patch implements `import.meta.url` field, which holds a base url
of the currently executing module[1].

In the case of embedded modules, this field becomes the URL of the
embedding HTML file. In the case of imported modules, the URL becomes
the URL of the executed module script file.

[1]: https://github.com/whatwg/html/pull/3141

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties):
* bindings/js/JSDOMWindowBase.h:
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::moduleURL):
(WebCore::ScriptModuleLoader::evaluate):
(WebCore::ScriptModuleLoader::createImportMetaProperties):
* bindings/js/ScriptModuleLoader.h:

LayoutTests:

* js/dom/modules/import-meta-url-expected.txt: Added.
* js/dom/modules/import-meta-url.html: Added.
* js/dom/modules/script-tests/import-meta-url-second-level.js: Added.
* js/dom/modules/script-tests/import-meta-url-top-level.js: Added.
* js/dom/modules/script-tests/import-meta-url.js: Added.

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

2 years agoWe should ensure that operationStrCat2 and operationStrCat3 are never passed Symbols...
mark.lam@apple.com [Sun, 12 Nov 2017 15:34:23 +0000 (15:34 +0000)]
We should ensure that operationStrCat2 and operationStrCat3 are never passed Symbols as arguments.
https://bugs.webkit.org/show_bug.cgi?id=179562
<rdar://problem/35467022>

Reviewed by Saam Barati.

JSTests:

* regress-179562.js: Added.

Source/JavaScriptCore:

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGOperations.cpp:
* dfg/DFGSafeToExecute.h:
(JSC::DFG::SafeToExecuteEdge::operator()):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::speculateNotSymbol):
(JSC::DFG::SpeculativeJIT::speculate):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGUseKind.cpp:
(WTF::printInternal):
* dfg/DFGUseKind.h:
(JSC::DFG::typeFilterFor):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::speculate):
(JSC::FTL::DFG::LowerDFGToB3::speculateNotSymbol):

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

2 years agoFix a FIXMEs in WebFrameIOS
megan_gardner@apple.com [Sun, 12 Nov 2017 02:46:31 +0000 (02:46 +0000)]
Fix a FIXMEs in WebFrameIOS
https://bugs.webkit.org/show_bug.cgi?id=179510

Reviewed by Darin Adler.

Removed a function that does nothing and is not needed or used anywhere, linked to a radar that is in verify.
This is just some easy cleanup I found while investigating other things.

* WebCoreSupport/WebFrameIOS.h:
* WebCoreSupport/WebFrameIOS.mm:
(-[WebFrame imageForNode:allowDownsampling:drawContentBehindTransparentNodes:]): Deleted.

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

2 years agoWeb Inspector: Network detail views - Include a newline between sections when copying
commit-queue@webkit.org [Sat, 11 Nov 2017 23:45:07 +0000 (23:45 +0000)]
Web Inspector: Network detail views - Include a newline between sections when copying
https://bugs.webkit.org/show_bug.cgi?id=179577

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

* UserInterface/Views/NetworkResourceDetailView.css:
(.content-view.resource-details):
* UserInterface/Views/ResourceDetailsSection.css:
(.resource-details > section):
(.resource-details > section > .title):
Adjust styles now that there is a <br> taking up space between sections.
After all the changes, the top section moved up 1px from where it was originally.

* UserInterface/Views/ResourceDetailsSection.js:
(WI.ResourceDetailsSection):
Include a <br> to get newlines when copying.

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

2 years ago[Xcode] WebCore generates unified sources during installhdrs
mitz@apple.com [Sat, 11 Nov 2017 21:41:10 +0000 (21:41 +0000)]
[Xcode] WebCore generates unified sources during installhdrs
https://bugs.webkit.org/show_bug.cgi?id=179578

Reviewed by Anders Carlsson.

* WebCore.xcodeproj/project.pbxproj: Use GenerateUnifiedSources.xcconfig, which sets
  INSTALLHDRS_SCRIPT_PHASE to NO, for the Generate Unified Sources target.

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

2 years agoRemove redundant platform-specific implementations of Image::drawPattern()
simon.fraser@apple.com [Sat, 11 Nov 2017 20:26:13 +0000 (20:26 +0000)]
Remove redundant platform-specific implementations of Image::drawPattern()
https://bugs.webkit.org/show_bug.cgi?id=179580

Reviewed by Sam Weinig.

Platform-specific Image files had implementations of Image::drawPattern() but they
were all effectively identical, so put a single implementation into Image.cpp.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/SourcesCairo.txt:
* platform/graphics/Image.cpp:
(WebCore::Image::drawPattern):
* platform/graphics/cairo/ImageCairo.cpp: Removed.
* platform/graphics/cg/ImageCG.cpp: Removed.
* platform/graphics/win/ImageDirect2D.cpp:
(WebCore::Image::drawPattern): Deleted.

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

2 years agoRe-sync Service Workers web-platform-tests from upstream
cdumez@apple.com [Sat, 11 Nov 2017 18:54:11 +0000 (18:54 +0000)]
Re-sync Service Workers web-platform-tests from upstream
https://bugs.webkit.org/show_bug.cgi?id=179575

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Re-sync Service Workers web-platform-tests from upstream 04892735ed1.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https.html:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/registration-attribute-newer-worker.js: Added.
(record):
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/registration-attribute-worker.js:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/unregister-controlling-worker.html: Added.
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/unregister-worker.js:
(matchQuery):
(e.waitUntil.self.registration.unregister.then):
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/update-worker.js:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/resources/w3c-import.log:
* web-platform-tests/service-workers/service-worker/detached-context.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/detached-context.https.html: Added.
* web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-event.https.html:
* web-platform-tests/service-workers/service-worker/navigation-preload/empty-preload-response-body.https-expected.txt:
* web-platform-tests/service-workers/service-worker/navigation-preload/resources/empty-preload-response-body-scope.html: Added.
* web-platform-tests/service-workers/service-worker/request-body-blob.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/request-body-blob.https.html: Removed.
* web-platform-tests/service-workers/service-worker/resources/empty.js: Added.
* web-platform-tests/service-workers/service-worker/resources/fetch-event-test-worker.js:
(handleHeaders):
(handleRequestBody):
* web-platform-tests/service-workers/service-worker/resources/interfaces-idls.js:
* web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js:
(test):
* web-platform-tests/service-workers/service-worker/resources/request-body-blob-iframe.html: Removed.
* web-platform-tests/service-workers/service-worker/resources/request-body-blob-worker.js: Removed.
* web-platform-tests/service-workers/service-worker/resources/respond-with-body-accessed-response-iframe.html: Added.
* web-platform-tests/service-workers/service-worker/resources/respond-with-body-accessed-response-worker.js: Added.
(getQueryParams):
(createResponse):
(cloneResponseIfNeeded):
(passThroughCacheIfNeeded):
(event.request.url.indexOf):
(event.respondWith.createResponse.params.then):
(then):
* web-platform-tests/service-workers/service-worker/resources/respond-with-body-accessed-response.jsonp: Added.
* web-platform-tests/service-workers/service-worker/resources/test-helpers.sub.js:
* web-platform-tests/service-workers/service-worker/resources/w3c-import.log:
* web-platform-tests/service-workers/service-worker/resources/websocket-worker.js: Added.
(reportFailure):
(onmessage.event.ws.onopen):
(onmessage.event.ws.onclose):
(onmessage.event.ws.onerror):
* web-platform-tests/service-workers/service-worker/resources/xhr.js: Removed.
* web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/respond-with-body-accessed-response.https.html: Added.
* web-platform-tests/service-workers/service-worker/w3c-import.log:
* web-platform-tests/service-workers/service-worker/waiting.https-expected.txt:
* web-platform-tests/service-workers/service-worker/waiting.https.html:
* web-platform-tests/service-workers/service-worker/websocket-in-service-worker.https-expected.txt: Added.
* web-platform-tests/service-workers/service-worker/websocket-in-service-worker.https.html: Added.
* web-platform-tests/service-workers/service-worker/xhr.https-expected.txt: Removed.
* web-platform-tests/service-workers/service-worker/xhr.https.html: Removed.

LayoutTests:

Skip a few tests that are timing out.

* TestExpectations:

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

2 years agoIncrease the alignment requirement of WKObject's wrapped C++ object
timothy_horton@apple.com [Sat, 11 Nov 2017 09:42:06 +0000 (09:42 +0000)]
Increase the alignment requirement of WKObject's wrapped C++ object
https://bugs.webkit.org/show_bug.cgi?id=179518

Reviewed by Dan Bernstein.

* Shared/API/APIObject.h:
* Shared/Cocoa/APIObject.mm:
(API::allocateWKObject):
(API::Object::fromWKObjectExtraSpace):
(API::Object::newObject):
* Shared/Cocoa/WKObject.mm:
(-[WKObject dealloc]):
(-[WKObject _apiObject]):
* UIProcess/API/Cocoa/WKConnection.mm:
(-[WKConnection dealloc]):
(-[WKConnection _apiObject]):
(-[WKConnection _connection]):
Increase the alignment of the C++ object stored inside WKObject's extra space
to 8-bytes, for platforms where some types require greater-than-pointer alignment.
To achieve this, increase the size of the extra-space allocation by the difference
between 8 bytes and pointer-alignment, and then align within that.

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

2 years agoAvoid composing the message + recipient name for crash logs until a failure actually...
timothy_horton@apple.com [Sat, 11 Nov 2017 09:24:45 +0000 (09:24 +0000)]
Avoid composing the message + recipient name for crash logs until a failure actually occurs
https://bugs.webkit.org/show_bug.cgi?id=179576

Reviewed by Dan Bernstein.

* Platform/IPC/mac/ConnectionMac.mm:
(IPC::Connection::sendMessage):
(IPC::Connection::sendOutgoingMessage):
* Platform/IPC/mac/MachMessage.h:
(IPC::MachMessage::messageReceiverName const):
(IPC::MachMessage::setMessageReceiverName):
(IPC::MachMessage::messageName const):
(IPC::MachMessage::setMessageName):
Store the message name and receiver name separately on MachMessage,
only composing them into a string if the message is unhandled. This
makes the time spent composing the string in sendOutgoingMessage
completely disappear. In absolute terms, it wasn't huge, but if you
do enough IPC it starts to add up.

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

2 years agoWeb Inspector: Network waterfall graph - make connection part thinner
commit-queue@webkit.org [Sat, 11 Nov 2017 09:24:28 +0000 (09:24 +0000)]
Web Inspector: Network waterfall graph - make connection part thinner
https://bugs.webkit.org/show_bug.cgi?id=179561

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-11-11
Reviewed by Devin Rousso.

* UserInterface/Views/NetworkTableContentView.css:
(.waterfall .block):

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

2 years agoWeb Inspector: Canvas tab: show detailed status during canvas recording
webkit@devinrousso.com [Sat, 11 Nov 2017 09:22:08 +0000 (09:22 +0000)]
Web Inspector: Canvas tab: show detailed status during canvas recording
https://bugs.webkit.org/show_bug.cgi?id=178185
<rdar://problem/34939862>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Canvas.json:
Add a `recordingProgress` event that is sent to the frontend that contains all the frame
payloads since the last Canvas.recordingProgress event and the current buffer usage.

* inspector/protocol/Recording.json:
Remove the required `frames` parameter from the Recording protocol object, as they will be
sent in batches via the Canvas.recordingProgress event.

Source/WebCore:

Updated existing tests to assert that the correct number of progress events are fired.

* inspector/agents/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
After each recorded frame, fire a progress event with the recorded frames as data. This will
release the frames from the associated InspectorCanvas, meaning that the frames must be
aggregated in the frontend before a Recording can be created.

The protocol is designed with arrays so that if we decide to add throttling (e.g. one event
per second) we are able to do so without modifying the protocol.

* inspector/InspectorCanvas.h:
* inspector/InspectorCanvas.cpp:
(WebCore::InspectorCanvas::hasRecordingData const):
(WebCore::InspectorCanvas::currentFrameHasData const):
(WebCore::InspectorCanvas::recordAction):
(WebCore::InspectorCanvas::finalizeFrame):
(WebCore::InspectorCanvas::markCurrentFrameIncomplete):
Add additional checks that the list of recorded frames is not nullptr when finalizing or
marking as incomplete.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:

* UserInterface/Protocol/CanvasObserver.js:
(WI.CanvasObserver.prototype.recordingProgress):
* UserInterface/Controllers/CanvasManager.js:
(WI.CanvasManager):
(WI.CanvasManager.prototype.recordingProgress):
(WI.CanvasManager.prototype.recordingFinished):
Maintain arrays of recorded frames for each canvas and add new frames each time a progress
event is fired. When the recording is finished, use the array as part of the payload for
creating a WI.Recording object.

* UserInterface/Models/Recording.js:
(WI.Recording.fromPayload):

* UserInterface/Models/RecordingAction.js:
(WI.RecordingAction.prototype.apply.getContent):
(WI.RecordingAction.prototype.apply):
Drive-by fix: toDataURL is very slow, so add alternative ways of getting and comparing the
content of the canvas to determine if the action has a visible effect.

* UserInterface/Views/CanvasContentView.css:
(.content-view.canvas:not(.tab)):
(.content-view.canvas:not(.tab) > .progress):
(.content-view.canvas:not(.tab) > .progress > .frame-count):
* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView):
(WI.CanvasContentView.prototype.attached):
(WI.CanvasContentView.prototype._recordingStarted):
(WI.CanvasContentView.prototype._recordingProgress):
(WI.CanvasContentView.prototype._recordingStopped):
Steal some space from the preview area to display a count of the number of recorded frames
and the current buffer usage.

* UserInterface/Views/CanvasOverviewContentView.css:
(.content-view.canvas-overview .content-view.canvas > :matches(header, .progress, .preview, footer)):
(.content-view.canvas-overview .content-view.canvas.selected > :matches(.progress, .preview, footer),):
(.content-view.canvas-overview .content-view.canvas > :matches(.progress, .preview)):
(.content-view.canvas-overview .content-view.canvas > .preview):
(.content-view.canvas-overview .content-view.canvas > .progress ~ .preview):
(.content-view.canvas-overview .content-view.canvas > :matches(header, .preview, footer)): Deleted.
(.content-view.canvas-overview .content-view.canvas.selected > :matches(.preview, footer),): Deleted.

LayoutTests:

* inspector/canvas/resources/recording-utilities.js:
(TestPage.registerInitializer.window.startRecording.handleRecordingProgress):
(TestPage.registerInitializer.window.startRecording):

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

2 years ago[GTK] PlatformGTK.cmake: use the PKG_CONFIG_EXECUTABLE variable
berto@igalia.com [Sat, 11 Nov 2017 08:08:20 +0000 (08:08 +0000)]
[GTK] PlatformGTK.cmake: use the PKG_CONFIG_EXECUTABLE variable
https://bugs.webkit.org/show_bug.cgi?id=179547

Patch by Helmut Grohne <helmut@subdivi.de> on 2017-11-11
Reviewed by Michael Catanzaro.

* PlatformGTK.cmake: Use PKG_CONFIG_EXECUTABLE instead of
hardcoding the executable name.

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

2 years agoUnreviewed, unskip & rebaseline several service worker tests
cdumez@apple.com [Sat, 11 Nov 2017 06:15:56 +0000 (06:15 +0000)]
Unreviewed, unskip & rebaseline several service worker tests

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/unregister.https-expected.txt:
* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/update.https-expected.txt:
* web-platform-tests/service-workers/service-worker/import-scripts-updated-flag.https-expected.txt:
* web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-script.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-service-worker-attributes.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt:
* web-platform-tests/service-workers/service-worker/unregister-controller.https-expected.txt:
* web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt:
* web-platform-tests/service-workers/service-worker/update-bytecheck.https-expected.txt:

LayoutTests:

* TestExpectations:

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

2 years ago[Service Workers] Registration promise should be rejected when the service worker...
cdumez@apple.com [Sat, 11 Nov 2017 05:15:15 +0000 (05:15 +0000)]
[Service Workers] Registration promise should be rejected when the service worker fails to start
https://bugs.webkit.org/show_bug.cgi?id=179566

Reviewed by Brady Eidson.

LayoutTests/imported/w3c:

Rebaseline WPT tests now that we properly reject registration promises when the worker script
fails to evaluate.

* web-platform-tests/service-workers/service-worker/ServiceWorkerGlobalScope/registration-attribute.https-expected.txt:
* web-platform-tests/service-workers/service-worker/navigation-redirect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/redirected-response.https-expected.txt:
* web-platform-tests/service-workers/service-worker/update.https-expected.txt:

Source/WebCore:

Registration promise should be rejected when the service worker fails to start.

Though our code intended to do this, there were several issues:
- Our code failed to properly detect when the script failed to evaluate. This is
  because it relied on the exception message being non-null but it was always
  null when same origin due to a bug.
- Our scriptContextFailedToStart() handler failed to rejected the promise
  and finish the job as per:
  - https://w3c.github.io/ServiceWorker/#update-algorithm (step 9.7)

Test: http/tests/workers/service/worker-fails-to-start.html

* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::evaluate):
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptContextFailedToStart):

LayoutTests:

Add layout test coverage.

* TestExpectations: Mark test as flaky as the console lines sometimes change order.
* http/tests/workers/service/resources/worker-fails-to-start-worker.js: Added.
* http/tests/workers/service/worker-fails-to-start-expected.txt: Added.
* http/tests/workers/service/worker-fails-to-start.html: Added.

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

2 years agocheck-webkit-style: AttributeError: 'NoneType' object has no attribute 'major'
commit-queue@webkit.org [Sat, 11 Nov 2017 04:32:42 +0000 (04:32 +0000)]
check-webkit-style: AttributeError: 'NoneType' object has no attribute 'major'
https://bugs.webkit.org/show_bug.cgi?id=179522

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-11-10
Reviewed by Aakash Jain.

IOSSimulatorPort.ios_version should return a Version object.

* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.ios_version): Return a Version object.

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

2 years agoUnreviewed Win Debug build fix; add FourCC.cpp to the cmake source list for Windows.
jer.noble@apple.com [Sat, 11 Nov 2017 02:45:11 +0000 (02:45 +0000)]
Unreviewed Win Debug build fix; add FourCC.cpp to the cmake source list for Windows.

* PlatformWin.cmake:

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

2 years ago[Win] The way to detect Windows 10 is wrong
commit-queue@webkit.org [Sat, 11 Nov 2017 02:35:53 +0000 (02:35 +0000)]
[Win] The way to detect Windows 10 is wrong
https://bugs.webkit.org/show_bug.cgi?id=179344

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2017-11-10
Reviewed by Alex Christensen.

* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo._determine_win_version):

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

2 years ago[CG] PDF document cached image is regenerated every time the destination rectangle...
commit-queue@webkit.org [Sat, 11 Nov 2017 01:43:36 +0000 (01:43 +0000)]
[CG] PDF document cached image is regenerated every time the destination rectangle changes
https://bugs.webkit.org/show_bug.cgi?id=179516

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-11-10
Reviewed by Tim Horton.

The PDF document cached image was regenerated if m_cachedImageRect didn't
contain the dirty rectangle. When moving the image, its new rectangle is
invalidated. This will set a new dirty rectangle outside m_cachedImageRect
which may not be fully inside m_cachedImageRect.

The PDF document cached image should be reused if we still draw the same
part of the image (srcRet did not change) and we use the same zooming factor
(dstSize did not change).

* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::cacheParametersMatch const): Remove a check
that was added mainly to force recalculating m_cachedImageRect when the
dirty rectangle changes.

(WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Recalculate
m_cachedImageRect every time this function is called regardless the cached
image will be regenerated or not.

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

2 years agoUpdate TestExpectations for imported/w3c/web-platform-tests/html/browsers/origin...
ryanhaddad@apple.com [Sat, 11 Nov 2017 01:22:37 +0000 (01:22 +0000)]
Update TestExpectations for imported/w3c/web-platform-tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_null.tentative.html.
https://bugs.webkit.org/show_bug.cgi?id=177440

Unreviewed test gardening.

* TestExpectations:
* platform/wk2/TestExpectations:

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

2 years agoMark http/tests/websocket/tests/hybi/contentextensions/upgrade-worker.html as flaky.
ryanhaddad@apple.com [Sat, 11 Nov 2017 01:16:10 +0000 (01:16 +0000)]
Mark http/tests/websocket/tests/hybi/contentextensions/upgrade-worker.html as flaky.
https://bugs.webkit.org/show_bug.cgi?id=179557

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoCompositing layers in UIWebView are often missing content after scrolling
simon.fraser@apple.com [Sat, 11 Nov 2017 01:07:47 +0000 (01:07 +0000)]
Compositing layers in UIWebView are often missing content after scrolling
https://bugs.webkit.org/show_bug.cgi?id=179564
rdar://problem/33885639

Reviewed by Tim Horton.

When dropping backing store for layers outside the viewport, we rely on a compositing
layer flush to compute layer visibility and bring the backing store back when necessary.

In UIWebView, we have a mechanism to trigger flushing on user scrolling but it only triggers
when there are tiled layers. Remove that condition so it triggers always, now that
backing store availability also depends on this.

* page/ios/FrameIOS.mm:
(WebCore::Frame::viewportOffsetChanged):
(WebCore::anyFrameHasTiledLayers): Deleted.

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

2 years agoContents of composited overflow-scroll are missing when newly added
simon.fraser@apple.com [Sat, 11 Nov 2017 01:07:44 +0000 (01:07 +0000)]
Contents of composited overflow-scroll are missing when newly added
https://bugs.webkit.org/show_bug.cgi?id=179556
rdar://problem/20368294

Reviewed by Tim Horton.

Source/WebCore:

When content is appended to an oveflow:scroll, we do a subtree layout. That triggered
a compositing code path that failed to call updateAfterDescendants() which is where
we compute whether we can be a simple composited layer without backing store. Fix to
call that after the updateGeometry() call, as we do elsewhere.

Test: compositing/backing/overflow-gains-content.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterLayout):

LayoutTests:

* compositing/backing/overflow-gains-content-expected.html: Added.
* compositing/backing/overflow-gains-content.html: Added.

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

2 years ago[WinCairo] LayoutTests doesn't read TextExpectations files correctly
commit-queue@webkit.org [Sat, 11 Nov 2017 00:20:31 +0000 (00:20 +0000)]
[WinCairo] LayoutTests doesn't read TextExpectations files correctly
https://bugs.webkit.org/show_bug.cgi?id=179219

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2017-11-10
Reviewed by Alex Christensen.

* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser._parse_line):
* Scripts/webkitpy/port/apple.py:
(ApplePort.__init__):
(ApplePort._allowed_port_names):
(ApplePort):
(ApplePort._future_port_name):
(ApplePort._generate_all_test_configurations):
* Scripts/webkitpy/port/win.py:
(WinCairoPort.default_baseline_search_path):
(WinCairoPort):
(WinCairoPort._future_port_name):

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

2 years ago[WinCairo] Treat 'future' version correctly
commit-queue@webkit.org [Sat, 11 Nov 2017 00:18:30 +0000 (00:18 +0000)]
[WinCairo] Treat 'future' version correctly
https://bugs.webkit.org/show_bug.cgi?id=179345

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2017-11-10
Reviewed by Alex Christensen.

* Scripts/webkitpy/port/win.py:
(WinCairoPort.default_baseline_search_path):

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

2 years agoRemove the 'CompositingChildrenOnly' flag which was always on
simon.fraser@apple.com [Sat, 11 Nov 2017 00:15:15 +0000 (00:15 +0000)]
Remove the 'CompositingChildrenOnly' flag which was always on
https://bugs.webkit.org/show_bug.cgi?id=179546

Reviewed by Antoine Quint.

All calls to updateAfterLayout() passed the CompositingChildrenOnly flag, so all calls
to updateCompositingDescendantGeometry() had compositedChildrenOnly=true, so remove
these flags.

Also use an OptionSet<>.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAfterLayout):
(WebCore::RenderLayerBacking::contentChanged):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
* rendering/RenderLayerCompositor.h:

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

2 years agoRemove dead code from ServiceWorkerRegistration
cdumez@apple.com [Sat, 11 Nov 2017 00:03:55 +0000 (00:03 +0000)]
Remove dead code from ServiceWorkerRegistration
https://bugs.webkit.org/show_bug.cgi?id=179555

Reviewed by Ryosuke Niwa.

* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::setInstallingWorker): Deleted.
(WebCore::ServiceWorkerRegistration::setWaitingWorker): Deleted.
(WebCore::ServiceWorkerRegistration::setActiveWorker): Deleted.
* workers/service/ServiceWorkerRegistration.h:

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

2 years ago[Service Workers] Implement better support for "Clear Registration" algorithm
cdumez@apple.com [Sat, 11 Nov 2017 00:00:01 +0000 (00:00 +0000)]
[Service Workers] Implement better support for "Clear Registration" algorithm
https://bugs.webkit.org/show_bug.cgi?id=179441

Reviewed by Brady Eidson.

LayoutTests/imported/w3c:

Rebaseline WPT test due to behavior change. Unfortunately, the check goes from PASS to FAIL.
The reason is that we do not implement "Try Clear Registration" algorithm, only the "Clear
Registration" one. The test expects that a registration object does not get cleared after
unregistration because it is "in use". However, because we do not yet support checking if
a registration is "in use" in try clear, we proceed to clearing the registration and marking
its service workers as redundant.

Previously, the test was passing because even though we were clearing the registration, we
did not mark its service workers as redundant yet. As a result, we would still report that
the registration as having an active worker with "activated" state and the test would think
we did not clear the registration, even though we did.

* web-platform-tests/service-workers/service-worker/getregistrations.https-expected.txt:

Source/WebCore:

Implement better support for "Clear Registration" algorithm as per:
- https://w3c.github.io/ServiceWorker/#clear-registration-algorithm

In particular, we now properly clear the service workers on the ServiceWorkerRegistration
object and we properly update its service workers' state to "redundant".

Test: http/tests/workers/service/registration-clear-redundant-worker.html

* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::clearRegistration):

LayoutTests:

Add layout test coverage.

* http/tests/workers/service/registration-clear-redundant-worker-expected.txt: Added.
* http/tests/workers/service/registration-clear-redundant-worker.html: Added.

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

2 years agoUnreviewed, rolling out r224705.
ryanhaddad@apple.com [Fri, 10 Nov 2017 23:44:32 +0000 (23:44 +0000)]
Unreviewed, rolling out r224705.

Introduced a LayoutTest crash on WK1.

Reverted changeset:

"[Web Animations] Implement getAnimations()"
https://bugs.webkit.org/show_bug.cgi?id=179535
https://trac.webkit.org/changeset/224705

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

2 years agoFinish rolling out r224544
wenson_hsieh@apple.com [Fri, 10 Nov 2017 23:13:19 +0000 (23:13 +0000)]
Finish rolling out r224544

Rubber-stamped by Tim Horton.

Now that https://bugs.webkit.org/show_bug.cgi?id=179431 has been fixed, we can once again allow one of the API
tests added in r224512 (WKAttachmentTests.AttachmentUpdatesWhenChangingFontStyles) to test toggling underline
style with a selected attachment element.

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

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

2 years agoAdd a FairPlay Streaming based CDM for Modern EME
jer.noble@apple.com [Fri, 10 Nov 2017 23:02:14 +0000 (23:02 +0000)]
Add a FairPlay Streaming based CDM for Modern EME
https://bugs.webkit.org/show_bug.cgi?id=179499
<rdar://problem/35445033>

Reviewed by Eric Carlson.

Source/WebCore:

Tests: platform/mac/media/encrypted-media/fps-createMediaKeys.html
       platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html

Add new CDMFairPlayStreaming and CDMInstanceFairPlayStreamingAVFObjC platform classes which implement
the basics of FairPlay Streaming support in Modern EME.

Drive-by fixes:

- Add a != operator to FourCC
- Add a virtual setStorageDirectory() method to CDMInstance (and default implementations to CDMClearKey
  and MockCDM)
- Move ISOVTTCue into the platform/graphics/iso directory and update all the places where it is called.

* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::mediaKeysStorageDirectory const):
* Modules/encryptedmedia/MediaKeySession.h:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/encryptedmedia/CDMFactory.cpp:
* platform/encryptedmedia/CDMInstance.h:
* platform/encryptedmedia/CDMRestrictions.h:
* platform/encryptedmedia/clearkey/CDMClearKey.cpp:
(WebCore::CDMInstanceClearKey::setStorageDirectory):
* platform/encryptedmedia/clearkey/CDMClearKey.h:
* platform/graphics/FourCC.h:
(WebCore::FourCC::operator!= const):
* platform/graphics/iso/ISOBox.cpp: Added.
(WebCore::ISOBox::peekBox):
(WebCore::ISOBox::read):
(WebCore::ISOBox::parse):
(WebCore::ISOFullBox::parse):
* platform/graphics/iso/ISOBox.h: Added.
(WebCore::ISOBox::minimumBoxSize):
(WebCore::ISOBox::size const):
(WebCore::ISOBox::boxType const):
(WebCore::ISOBox::extendedType const):
(WebCore::ISOBox::checkedRead):
(WebCore::ISOFullBox::version const):
(WebCore::ISOFullBox::flags const):
* platform/graphics/iso/ISOOriginalFormatBox.cpp: Added.
(WebCore::ISOOriginalFormatBox::parse):
* platform/graphics/iso/ISOOriginalFormatBox.h: Added.
(WebCore::ISOOriginalFormatBox::boxTypeName):
(WebCore::ISOOriginalFormatBox::dataFormat const):
* platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: Added.
(WebCore::ISOProtectionSchemeInfoBox::parse):
* platform/graphics/iso/ISOProtectionSchemeInfoBox.h: Added.
(WebCore::ISOProtectionSchemeInfoBox::boxTypeName):
(WebCore::ISOProtectionSchemeInfoBox::schemeTypeBox const):
(WebCore::ISOProtectionSchemeInfoBox::schemeInformationBox const):
* platform/graphics/iso/ISOSchemeInformationBox.cpp: Added.
(WebCore::ISOSchemeInformationBox::parse):
* platform/graphics/iso/ISOSchemeInformationBox.h: Added.
(WebCore::ISOSchemeInformationBox::boxTypeName):
(WebCore::ISOSchemeInformationBox::schemeSpecificData const):
* platform/graphics/iso/ISOSchemeTypeBox.cpp: Added.
(WebCore::ISOSchemeTypeBox::parse):
* platform/graphics/iso/ISOSchemeTypeBox.h: Added.
(WebCore::ISOSchemeTypeBox::boxTypeName):
(WebCore::ISOSchemeTypeBox::schemeType const):
(WebCore::ISOSchemeTypeBox::schemeVersion const):
* platform/graphics/iso/ISOTrackEncryptionBox.cpp: Added.
(WebCore::ISOTrackEncryptionBox::parse):
* platform/graphics/iso/ISOTrackEncryptionBox.h: Added.
(WebCore::ISOTrackEncryptionBox::boxTypeName):
(WebCore::ISOTrackEncryptionBox::defaultCryptByteBlock const):
(WebCore::ISOTrackEncryptionBox::defaultSkipByteBlock const):
(WebCore::ISOTrackEncryptionBox::defaultIsProtected const):
(WebCore::ISOTrackEncryptionBox::defaultPerSampleIVSize const):
(WebCore::ISOTrackEncryptionBox::defaultKID const):
(WebCore::ISOTrackEncryptionBox::defaultConstantIV const):
* platform/graphics/iso/ISOVTTCue.cpp: Added.
(WebCore::ISOStringBox::contents):
(WebCore::vttIdBoxType):
(WebCore::vttSettingsBoxType):
(WebCore::vttPayloadBoxType):
(WebCore::vttCurrentTimeBoxType):
(WebCore::vttCueSourceIDBoxType):
(WebCore::ISOWebVTTCue::ISOWebVTTCue):
(WebCore::ISOWebVTTCue::parse):
* platform/graphics/iso/ISOVTTCue.h: Renamed from Source/WebCore/platform/graphics/ISOVTTCue.h.
(WebCore::ISOWebVTTCue::boxTypeName):
(WebCore::ISOWebVTTCue::presentationTime const):
(WebCore::ISOWebVTTCue::duration const):
(WebCore::ISOWebVTTCue::sourceID const):
(WebCore::ISOWebVTTCue::id const):
(WebCore::ISOWebVTTCue::originalStartTime const):
(WebCore::ISOWebVTTCue::settings const):
(WebCore::ISOWebVTTCue::cueText const):
* platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: Added.
(WebCore::extractSinfData):
(WebCore::extractSchemeAndKeyIdFromSinf):
(WebCore::extractKeyIDsSinf):
(WebCore::sanitizeSinf):
(WebCore::CDMFactory::platformRegisterFactories):
(WebCore::CDMFactoryFairPlayStreaming::singleton):
(WebCore::CDMFactoryFairPlayStreaming::createCDM):
(WebCore::CDMFactoryFairPlayStreaming::supportsKeySystem):
(WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
(WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
(WebCore::CDMPrivateFairPlayStreaming::supportsConfigurationWithRestrictions const):
(WebCore::CDMPrivateFairPlayStreaming::supportsSessionTypeWithConfiguration const):
(WebCore::CDMPrivateFairPlayStreaming::supportsRobustness const):
(WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersRequirement const):
(WebCore::CDMPrivateFairPlayStreaming::persistentStateRequirement const):
(WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersAreUniquePerOriginAndClearable const):
(WebCore::CDMPrivateFairPlayStreaming::createInstance):
(WebCore::CDMPrivateFairPlayStreaming::loadAndInitialize):
(WebCore::CDMPrivateFairPlayStreaming::supportsServerCertificates const):
(WebCore::CDMPrivateFairPlayStreaming::supportsSessions const):
(WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
(WebCore::CDMPrivateFairPlayStreaming::sanitizeResponse const):
(WebCore::CDMPrivateFairPlayStreaming::sanitizeSessionId const):
* platform/graphics/avfoundation/CDMFairPlayStreaming.h: Added.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: Added.
* platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: Added.
(-[WebCoreFPSContentKeySessionDelegate initWithParent:]):
(-[WebCoreFPSContentKeySessionDelegate invalidate]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideContentKeyRequest:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideRenewingContentKeyRequest:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvidePersistableContentKeyRequest:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequest:didFailWithError:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySession:shouldRetryContentKeyRequest:reason:]):
(-[WebCoreFPSContentKeySessionDelegate contentKeySessionContentProtectionSessionIdentifierDidChange:]):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::~CDMInstanceFairPlayStreamingAVFObjC):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistableState):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistentKeys):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setDistinctiveIdentifiersAllowed):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setPersistentStateAllowed):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setServerCertificate):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported const):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
(WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
(WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
* testing/MockCDMFactory.cpp:
(WebCore::MockCDMInstance::setStorageDirectory):
* testing/MockCDMFactory.h:

Source/WTF:

* wtf/Platform.h:

LayoutTests:

* platform/mac/TestExpectations:
* platform/mac/media/encrypted-media/fps-createMediaKeys-expected.txt: Added.
* platform/mac/media/encrypted-media/fps-createMediaKeys.html: Added.
* platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess-expected.txt: Added.
* platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html: Added.

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

2 years agoRebase some layout tests
megan_gardner@apple.com [Fri, 10 Nov 2017 22:36:13 +0000 (22:36 +0000)]
Rebase some layout tests
https://bugs.webkit.org/show_bug.cgi?id=179519

Reviewed by Alex Christensen and Tim Horton.

In helping with cleaning up tests, rebase tests that have only been effected by font changes
and other similarly irrelevant changes. Also turning back on a few tests that actually do work
now.

* platform/ios-wk2/TestExpectations:
* platform/ios/editing/selection/3690703-2-expected.txt:
* platform/ios/editing/selection/3690703-expected.txt:
* platform/ios/editing/selection/3690719-expected.txt:

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

2 years ago[Web Animations] Implement getAnimations()
graouts@webkit.org [Fri, 10 Nov 2017 22:12:08 +0000 (22:12 +0000)]
[Web Animations] Implement getAnimations()
https://bugs.webkit.org/show_bug.cgi?id=179535
<rdar://problem/34932475>

Reviewed by Simon Fraser.

Source/WebCore:

We now allow a list of animations for a document, with Document.getAnimations(), or for an
element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain
a map on AnimationTimeline of all animations for a given element. This map is invalidated
when an animation's timeline changes and when an animation's effect changes. Note that the
Web Animations spec mandates that an AnimationEffect can only be a single animation's effect.

Additionally, we ensure that the Document-to-DocumentTimeline relationship is cleared when
is being prepared for teardown to avoid a ref-cycle.

Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html
       http/wpt/wk-web-animations/interfaces/element-get-animations.html
       http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html

* CMakeLists.txt: Add Animatable.idl.
* DerivedSources.make: Add Animatable.idl.
* WebCore.xcodeproj/project.pbxproj: Add Animatable.idl.
* animation/Animatable.idl: A new interface that Element implements and which currently only exposes
getAnimations(), the animate() method will be added later.
* animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this
effect. This relationship is required so we guarantee that an effect is associated with a single
animation at most.
(WebCore::AnimationEffect::animation const):
(WebCore::AnimationEffect::setAnimation):
* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an
animation registered with this timeline has been associated with a new element through its effect.
(WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an
animation registered with this timeline has been disassociated with an element through its effect.
(WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with
this timeline for a given element.
* animation/AnimationTimeline.h:
(WebCore::AnimationTimeline::animations const): All animations registered with this timeline.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::DocumentTimeline):
(WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document.
* animation/DocumentTimeline.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::create):
(WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old
effect no longer has an associated animation, and that the new effect is associated with this animation.
Additionally, we update the element-to-animations map on the animation's timeline.
(WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline.
* dom/Document.cpp:
(WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline.
(WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline.
* dom/Document.h:
* dom/Document.idl:
* dom/Element.cpp:
(WebCore::Element::getAnimations): Obtain all animations associated with this element.
* dom/Element.h:
* dom/Element.idl:
* testing/Internals.cpp:

LayoutTests:

Update WPT expectations per new progressions and add three new tests that check the behavior of
Document.getAnimations(), Element.getAnimations() and the unique relationship between an Animation
and an AnimationEffect.

* http/wpt/web-animations/interfaces/Animatable/animate-expected.txt:
* http/wpt/web-animations/interfaces/Animatable/getAnimations-expected.txt:
* http/wpt/web-animations/interfaces/Document/getAnimations-expected.txt:
* http/wpt/wk-web-animations/interfaces/document-get-animations-expected.txt: Added.
* http/wpt/wk-web-animations/interfaces/document-get-animations.html: Added.
* http/wpt/wk-web-animations/interfaces/element-get-animations-expected.txt: Added.
* http/wpt/wk-web-animations/interfaces/element-get-animations.html: Added.
* http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship-expected.txt: Added.
* http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html: Added.

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

2 years agoWeb Inspector: Make http status codes be "integer" instead of "number" in protocol
commit-queue@webkit.org [Fri, 10 Nov 2017 22:10:05 +0000 (22:10 +0000)]
Web Inspector: Make http status codes be "integer" instead of "number" in protocol
https://bugs.webkit.org/show_bug.cgi?id=179543

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-11-10
Reviewed by Antoine Quint.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Use a better type for the status code.

Source/WebCore:

* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
No need for the temporary or type change.

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

2 years agoUnreviewed, rolling out r224602 and r224697.
ryanhaddad@apple.com [Fri, 10 Nov 2017 22:03:06 +0000 (22:03 +0000)]
Unreviewed, rolling out r224602 and r224697.
https://bugs.webkit.org/show_bug.cgi?id=179545

The LayoutTest for this change is flaky. (Requested by
ryanhaddad on #webkit).

Reverted changesets:

"Add tests to ensure that <source> tags are only preloaded
when the `type`"
https://bugs.webkit.org/show_bug.cgi?id=179231
https://trac.webkit.org/changeset/224602

"Fix race conditions with setBackingScaleFactor, page refresh
and preloader"
https://bugs.webkit.org/show_bug.cgi?id=179488
https://trac.webkit.org/changeset/224697

Patch by Commit Queue <commit-queue@webkit.org> on 2017-11-10

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

2 years ago[Service Workers] Implement "Try Activate" / "Activate" algorithms
cdumez@apple.com [Fri, 10 Nov 2017 20:30:58 +0000 (20:30 +0000)]
[Service Workers] Implement "Try Activate" / "Activate" algorithms
https://bugs.webkit.org/show_bug.cgi?id=179436

Reviewed by Brady Eidson.

Source/WebCore:

Implement proper "Try Activate" / "Activate" algorithms as per:
- https://w3c.github.io/ServiceWorker/#try-activate-algorithm
- https://w3c.github.io/ServiceWorker/#activation-algorithm

Test: http/tests/workers/service/basic-activate-event.html

* workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::fireActivateEvent):
* workers/service/context/SWContextManager.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::fireActivateEvent):
* workers/service/context/ServiceWorkerThread.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::didFinishActivation):
(WebCore::SWServer::didFinishActivation):
(WebCore::SWServer::fireActivateEvent):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::didFinishInstall):
(WebCore::SWServerJobQueue::tryActivate):
(WebCore::SWServerJobQueue::activate):
(WebCore::SWServerJobQueue::didFinishActivation):
* workers/service/server/SWServerJobQueue.h:

Source/WebKit:

Implement proper "Try Activate" / "Activate" algorithms as per:
- https://w3c.github.io/ServiceWorker/#try-activate-algorithm
- https://w3c.github.io/ServiceWorker/#activation-algorithm

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::fireActivateEvent):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/StorageProcess.cpp:
(WebKit::StorageProcess::didFinishServiceWorkerActivation):
* StorageProcess/StorageProcess.h:
* StorageProcess/StorageProcess.messages.in:
* WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::fireActivateEvent):
(WebKit::WebSWContextManagerConnection::didFinishActivation):
* WebProcess/Storage/WebSWContextManagerConnection.h:
* WebProcess/Storage/WebSWContextManagerConnection.messages.in:

LayoutTests:

Add layout test coverage.

* http/tests/workers/service/basic-activate-event-expected.txt: Added.
* http/tests/workers/service/basic-activate-event.html: Added.
* http/tests/workers/service/resources/basic-activate-event-worker.js: Added.

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

2 years agoFix debug build after r224700
achristensen@apple.com [Fri, 10 Nov 2017 20:11:14 +0000 (20:11 +0000)]
Fix debug build after r224700
https://bugs.webkit.org/show_bug.cgi?id=179460

* platform/text/TextEncodingRegistry.cpp:
(WebCore::addToTextEncodingNameMap):

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

2 years agoRemove TEC decoders that duplicate ICU decoders
mjs@apple.com [Fri, 10 Nov 2017 19:26:25 +0000 (19:26 +0000)]
Remove TEC decoders that duplicate ICU decoders
https://bugs.webkit.org/show_bug.cgi?id=179460

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/encoding/duplicate-tec-encodings.html

* platform/text/TextEncodingRegistry.cpp:
(WebCore::checkExistingName): Deleted.
(WebCore::addToTextEncodingNameMap): Move the check from checkExistingName here,
and make it an ASSERT, since we should now be guaranteed no duplicate encodings.
* platform/text/mac/mac-encodings.txt: Remove encodings that duplicate ones we
implement with ICU.
* platform/text/TextCodecICU.cpp: Add some extra encoding aliases that only TEC
knew about.

LayoutTests:

* fast/encoding/duplicate-tec-encodings-expected.txt: Added.
* fast/encoding/duplicate-tec-encodings.html: Added.

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

2 years agoMake CachedResource::redirectReceived asynchronous
achristensen@apple.com [Fri, 10 Nov 2017 19:23:13 +0000 (19:23 +0000)]
Make CachedResource::redirectReceived asynchronous
https://bugs.webkit.org/show_bug.cgi?id=179503

Reviewed by Antti Koivisto.

There were a few loops where we called redirectReceived many times in a row,
and these are replaced with a completion handler that recursively calls the next
redirectReceived or the code after the loop.

No change in behavior.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::redirectReceived):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setLastCheckedRequest):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::redirectReceived):
* loader/DocumentThreadableLoader.h:
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResource::redirectReceived):
* loader/MediaResourceLoader.h:
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNavigationPolicy):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* loader/cache/CachedRawResource.cpp:
(WebCore::iterate):
(WebCore::CachedRawResource::didAddClient):
(WebCore::CachedRawResource::redirectReceived):
* loader/cache/CachedRawResource.h:
* loader/cache/CachedRawResourceClient.h:
(WebCore::CachedRawResourceClient::redirectReceived):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::redirectReceived):
* loader/cache/CachedResource.h:
* platform/graphics/PlatformMediaResourceLoader.h:
(WebCore::PlatformMediaResourceClient::redirectReceived):
* platform/network/cocoa/WebCoreNSURLSession.mm:
(WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):

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

2 years agoIgnore HSTS for partitioned, cross-origin subresource requests
bfulgham@apple.com [Fri, 10 Nov 2017 19:06:50 +0000 (19:06 +0000)]
Ignore HSTS for partitioned, cross-origin subresource requests
https://bugs.webkit.org/show_bug.cgi?id=178993
<rdar://problem/34962462>

Patch by John Wilander <wilander@apple.com> on 2017-11-10
Reviewed by Brent Fulgham.

Source/WebCore:

No new tests. HSTS is not supported in layout tests.
Tested manually.

* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::synthesizeRedirectResponseIfNecessary):

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:
    Added
    - (BOOL)_schemeWasUpgradedDueToDynamicHSTS
    - (BOOL)_preventHSTSStorage
    - (BOOL)_ignoreHSTS
    - (void)_setPreventHSTSStorage:(BOOL)preventHSTSStorage
    - (void)_setIgnoreHSTS:(BOOL)ignoreHSTS

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(downgradeRequest):
    Convenience function to downgrade a request if
    CFNetwork as already upgraded it during
    canonicalization. This allows the rest of
    WebKit's processing to function, such as UIR
    and mixed content blocking.
(updateIgnoreStrictTransportSecuritySettingIfNecessary):
    Adds and removed the ignore request accordingly.
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
    Now asks CFNetwork to ignore HSTS on resource loads we
    partition cookies for.
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
    Now asks CFNetwork to ignore HSTS on resource loads we
    partition cookies for.

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

2 years agoFix race conditions with setBackingScaleFactor, page refresh and preloader
commit-queue@webkit.org [Fri, 10 Nov 2017 19:01:39 +0000 (19:01 +0000)]
Fix race conditions with setBackingScaleFactor, page refresh and preloader
https://bugs.webkit.org/show_bug.cgi?id=179488

Patch by Colin Bendell <colin@bendell.ca> on 2017-11-10
Reviewed by Darin Adler.

* http/tests/preload/picture-type-expected.txt: remove DPR test
* http/tests/preload/picture-type.html: updated srcset to account for
testRunners with DPR > 1

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

2 years ago_WKThumbnailView initialization with WKWebView needs to call correct initWithFrame
achristensen@apple.com [Fri, 10 Nov 2017 18:45:32 +0000 (18:45 +0000)]
_WKThumbnailView initialization with WKWebView needs to call correct initWithFrame
https://bugs.webkit.org/show_bug.cgi?id=179537
<rdar://problem/35275219>

Reviewed by Darin Adler.

Source/WebKit:

I introduced this in r223439 and made an ObjC mistake.  This is what I get for adding SPI with no tests.
I fixed this by making the existing WKView/_WKThumbnailView API tests work with WKWebView.

* UIProcess/API/Cocoa/_WKThumbnailView.mm:
(-[_WKThumbnailView initWithFrame:fromWKWebView:]):

Tools:

* TestWebKitAPI/Tests/WebKit/WKThumbnailView.mm:
(-[WKThumbnailViewDelegate webView:didFinishNavigation:]):
(TestWebKitAPI::TEST):

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

2 years agowebkitpy: Remove find_system_pid from port classes
jbedard@apple.com [Fri, 10 Nov 2017 18:30:22 +0000 (18:30 +0000)]
webkitpy: Remove find_system_pid from port classes
https://bugs.webkit.org/show_bug.cgi?id=179514
<rdar://problem/35456900>

Reviewed by David Kilzer.

Removing dead code.

* Scripts/webkitpy/port/base.py:
(Port.find_system_pid): Deleted.
* Scripts/webkitpy/port/server_process.py:
(ServerProcess._start):
* Scripts/webkitpy/port/win.py:
(WinPort.find_system_pid): Deleted.

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

2 years agofix style failures in webkitpy: multiple statements on one line (semicolon)
aakash_jain@apple.com [Fri, 10 Nov 2017 17:46:22 +0000 (17:46 +0000)]
fix style failures in webkitpy: multiple statements on one line (semicolon)
https://bugs.webkit.org/show_bug.cgi?id=179530

Reviewed by Alex Christensen.

* Scripts/webkitpy/common/net/buildbot/buildbot.py: Removed semicolon.
* Scripts/webkitpy/layout_tests/controllers/test_result_writer.py: Ditto.
* Scripts/webkitpy/tool/steps/runtests.py: Ditto.

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

2 years agoMark http/wpt/beacon/contentextensions tests as flaky.
ryanhaddad@apple.com [Fri, 10 Nov 2017 17:44:15 +0000 (17:44 +0000)]
Mark http/wpt/beacon/contentextensions tests as flaky.
https://bugs.webkit.org/show_bug.cgi?id=179256

Unreviewed test gardening.

* platform/mac-wk2/TestExpectations:

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

2 years agoThe memory consumption of DFG::BasicBlock can be easily reduced a bit
rmorisset@apple.com [Fri, 10 Nov 2017 17:39:55 +0000 (17:39 +0000)]
The memory consumption of DFG::BasicBlock can be easily reduced a bit
https://bugs.webkit.org/show_bug.cgi?id=179528

Reviewed by Saam Barati.

A few changes here:
- Reordering some fields of DFG::BasicBlock to reduce padding
- Making the enum fields that are glorified booleans fit into a u8
- Make each Operands object have a single vector that holds all arguments followed by all locals, instead of two vectors.
  This change works because we never increase the number of arguments after allocating an Operands object.
  It lets us avoid one extra capacity field and one extra pointer field per Operands,
  and more importantly one allocation per Operands whenever both vectors would have overflowed their inlined buffer.
  Additionally, if a single vector would have overflowed its inline buffer, while the other would have had some free space,
  we have a chance to avoid an allocation.
- Finally, the three methods argumentForIndex, variableForIndex and indexForOperand were deleted since they were dead code.

* bytecode/Operands.h:
(JSC::Operands::Operands):
(JSC::Operands::numberOfArguments const):
(JSC::Operands::numberOfLocals const):
(JSC::Operands::argument):
(JSC::Operands::argument const):
(JSC::Operands::local):
(JSC::Operands::local const):
(JSC::Operands::ensureLocals):
(JSC::Operands::setLocal):
(JSC::Operands::getLocal):
(JSC::Operands::setArgumentFirstTime):
(JSC::Operands::setLocalFirstTime):
(JSC::Operands::operand):
(JSC::Operands::setOperand):
(JSC::Operands::size const):
(JSC::Operands::at const):
(JSC::Operands::at):
(JSC::Operands::isArgument const):
(JSC::Operands::isVariable const):
(JSC::Operands::virtualRegisterForIndex const):
(JSC::Operands::fill):
(JSC::Operands::operator== const):
(JSC::Operands::argumentForIndex const): Deleted.
(JSC::Operands::variableForIndex const): Deleted.
(JSC::Operands::indexForOperand const): Deleted.
* dfg/DFGBasicBlock.cpp:
(JSC::DFG::BasicBlock::BasicBlock):
* dfg/DFGBasicBlock.h:
* dfg/DFGBranchDirection.h:
* dfg/DFGStructureClobberState.h:

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

2 years agofix style failures in webkitpy: expected 2 blank lines found 1
aakash_jain@apple.com [Fri, 10 Nov 2017 17:39:51 +0000 (17:39 +0000)]
fix style failures in webkitpy: expected 2 blank lines found 1
https://bugs.webkit.org/show_bug.cgi?id=179529

Reviewed by Alex Christensen.

* Scripts/webkitpy/benchmark_runner/run_benchmark.py: Added a blank line to follow style guidelines.
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py: Ditto.
* Scripts/webkitpy/common/system/platforminfo_mock.py: Ditto.
* Scripts/webkitpy/common/version.py: Ditto.
* Scripts/webkitpy/layout_tests/models/test_failures.py: Ditto.
* Scripts/webkitpy/port/mac_unittest.py: Ditto.
* Scripts/webkitpy/port/simulator_process.py: Ditto.

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

2 years agoREGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
achristensen@apple.com [Fri, 10 Nov 2017 17:30:59 +0000 (17:30 +0000)]
REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
https://bugs.webkit.org/show_bug.cgi?id=179515
Source/WebCore:

<rdar://problem/35445245>

Reviewed by Andy Estes.

Covered by a new API test which would have timed out without this change.

* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
(schedulePairHashSet):
Collect run loop modes from the NetworkingContext similarly to how we did before https://trac.webkit.org/changeset/224267/webkit#file40
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
(-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):

Source/WTF:

<rdar://problem/35445245>

Reviewed by Andy Estes.

* wtf/MainThread.cpp:
(WTF::callOnMainThread):
* wtf/MainThread.h:
(WTF::callOnMainThread):
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/generic/MainThreadGeneric.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/mac/MainThreadMac.mm:
(WTF::scheduleDispatchFunctionsOnMainThread):
* wtf/win/MainThreadWin.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread):
Add an optional parameter which is an array of run loop mode names to pass to performSelectorOnMainThread.

Tools:

Reviewed by Andy Estes.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/WebViewScheduleInRunLoop.mm: Added.
(-[ScheduleInRunLoopDelegate webView:didFinishLoadForFrame:]):
(TestWebKitAPI::TEST):

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

2 years agoSimplify SWServerRegistration::forEachConnection()
cdumez@apple.com [Fri, 10 Nov 2017 17:23:09 +0000 (17:23 +0000)]
Simplify SWServerRegistration::forEachConnection()
https://bugs.webkit.org/show_bug.cgi?id=179523

Reviewed by Alex Christensen.

Simplify SWServerRegistration::forEachConnection() by dropping the hack
introduced in r224590 to work around the fact that we had a race
between Storage & WebProcess processes during registration. After
r224652, we do an IPC handshake between those 2 processes after
resolving the registration promise so we know for sure the
ServiceWorkerRegistration object has registered itself with the
Storage process before we keep going with the install steps.

No new tests, no expected Web-facing behavior change.

* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):
(WebCore::SWServerJobQueue::install):
(WebCore::SWServerJobQueue::didResolveRegistrationPromise):
(WebCore::SWServerJobQueue::didFinishInstall):
(WebCore::SWServerJobQueue::runRegisterJob):
(WebCore::SWServerJobQueue::runUnregisterJob):
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::updateRegistrationState):
(WebCore::SWServerRegistration::updateWorkerState):
(WebCore::SWServerRegistration::fireUpdateFoundEvent):
(WebCore::SWServerRegistration::forEachConnection):
* workers/service/server/SWServerRegistration.h:

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

2 years ago[webkitpy] Fix PlatformInfo._win_version since r224657
jbedard@apple.com [Fri, 10 Nov 2017 17:02:56 +0000 (17:02 +0000)]
[webkitpy] Fix PlatformInfo._win_version since r224657
https://bugs.webkit.org/show_bug.cgi?id=179520

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-11-10
Reviewed by Aakash Jain.

There are two problems.

The return value of sys.getwindowsversion() doesn't match with
Version.__init__ expects. Truncate the 4th and 5th of it.

_win_version_tuple_from_cmd was deleted in r224657. But, it is
still needed for Cygwin Python.

* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo._win_version): Return [0:3] of getwindowsversion().
Call _win_version_from_cmd for Cygwin Python.
(PlatformInfo._win_version_from_cmd): Restored.

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

2 years agoLayoutTests/imported/w3c:
Ms2ger@igalia.com [Fri, 10 Nov 2017 16:41:03 +0000 (16:41 +0000)]
LayoutTests/imported/w3c:
Allow XHR to override the User-Agent header.
https://bugs.webkit.org/show_bug.cgi?id=179527

Reviewed by Chris Dumez.

* web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed-expected.txt: update expectation.

Source/WebCore:
Allow XHR to override the User-Agent header.
https://bugs.webkit.org/show_bug.cgi?id=179527

Reviewed by Chris Dumez.

Also rename FrameLoader::applyUserAgent to FrameLoader::applyUserAgentIfNeeded
for clarity.

Test: imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::addExtraFieldsToRequest):
(WebCore::FrameLoader::applyUserAgentIfNeeded):
* loader/FrameLoader.h:
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::willSendRequest):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::createResourceHandle):
* loader/cache/CachedResourceRequest.cpp:
(WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):

LayoutTests:
Remove check-combining-headers.html.
https://bugs.webkit.org/show_bug.cgi?id=179527

Reviewed by Chris Dumez.

This test is an old fork of
imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
which is no longer useful.

* http/tests/xmlhttprequest/check-combining-headers-expected.txt: Removed.
* http/tests/xmlhttprequest/check-combining-headers.html: Removed.

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

2 years agobuild-jsc: build testmasm for all platforms using cmake
guijemont@igalia.com [Fri, 10 Nov 2017 16:29:20 +0000 (16:29 +0000)]
build-jsc: build testmasm for all platforms using cmake
https://bugs.webkit.org/show_bug.cgi?id=179512

Reviewed by Michael Catanzaro.

* Scripts/build-jsc:

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

2 years ago[iOS] Use new class name from UIKit when checking UITextSuggestion type for WebKitLegacy
commit-queue@webkit.org [Fri, 10 Nov 2017 16:25:14 +0000 (16:25 +0000)]
[iOS] Use new class name from UIKit when checking UITextSuggestion type for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=179397

Patch by Frederik Riedel <frederik.riedel@frogg.io> on 2017-11-10
Reviewed by Wenson Hsieh.

* DOM/DOMHTMLInputElement.mm:
(-[DOMHTMLInputElement insertTextSuggestion:]):

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

2 years agoSource/WebCore:
Ms2ger@igalia.com [Fri, 10 Nov 2017 15:43:33 +0000 (15:43 +0000)]
Source/WebCore:
[GTK] Use fallible allocation in ImageBuffer::ImageBuffer().
https://bugs.webkit.org/show_bug.cgi?id=179051

Reviewed by Michael Catanzaro.

Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html

* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::ImageBuffer):

Source/WTF:
Export tryFastZeroedMalloc.
https://bugs.webkit.org/show_bug.cgi?id=179051

Reviewed by Michael Catanzaro.

The other functions were exported in bug 72855. There does not seem to be a
reason not to export this one.

* wtf/FastMalloc.h:

LayoutTests:
[GTK] Update test expectations for imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html.
https://bugs.webkit.org/show_bug.cgi?id=179051

Reviewed by Michael Catanzaro.

The expectations are platform-specific because the test times out on mac.
The difference with the mac expectations is only in the last part of the
test, after the timeout.

This follows our policy of creating -expected files with failures for
imported wpt tests, to allow using them as regression tests.

* platform/gtk/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args-expected.txt:

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

2 years agoUnreviewed, mark imported/w3c/web-platform-tests/service-workers/service-worker/unreg...
cdumez@apple.com [Fri, 10 Nov 2017 15:07:47 +0000 (15:07 +0000)]
Unreviewed, mark imported/w3c/web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https.html as flaky

I unskipped it yesterday but it turns out to be flaky.

* TestExpectations:

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

2 years ago[GTK][WPE] Switch to use API::NavigationClient
carlosgc@webkit.org [Fri, 10 Nov 2017 13:03:51 +0000 (13:03 +0000)]
[GTK][WPE] Switch to use API::NavigationClient
https://bugs.webkit.org/show_bug.cgi?id=178720

Reviewed by Alex Christensen.

Replace WebKitLoaderClient and WebKitPolicyClient with WebKitNavigationClient that implements
API::NavigationClient.

* PlatformGTK.cmake:
* PlatformWPE.cmake:
* UIProcess/API/APINavigationAction.h: Add new constructor that receives a target frame name instead of a target
frame info.
* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::didDisplayInsecureContent): Added.
(API::NavigationClient::didRunInsecureContent): Added.
(API::NavigationClient::decidePolicyForNavigationResponse): Change NavigationResponse parameter to be a
Ref<NavigationResponse>&& instead of a NavigationResponse&.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageNavigationClient): Update NavigationResponse parameter.
* UIProcess/API/glib/WebKitBackForwardList.cpp:
(webkitBackForwardListChanged):
* UIProcess/API/glib/WebKitBackForwardListPrivate.h:
* UIProcess/API/glib/WebKitNavigationAction.cpp:
(webkitNavigationActionCreate): Wrap the given API::NavigationAction.
(webkit_navigation_action_get_navigation_type): Use the wrapped API::NavigationAction.
(webkit_navigation_action_get_mouse_button): Ditto.
(webkit_navigation_action_get_modifiers): Ditto.
(webkit_navigation_action_get_request): Ditto.
(webkit_navigation_action_is_user_gesture): Ditto.
(webkit_navigation_action_is_redirect): Ditto.
* UIProcess/API/glib/WebKitNavigationActionPrivate.h:
(_WebKitNavigationAction::_WebKitNavigationAction):
* UIProcess/API/glib/WebKitNavigationClient.cpp: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.cpp.
(NavigationClient::NavigationClient):
(attachNavigationClientToView):
* UIProcess/API/glib/WebKitNavigationClient.h: Renamed from Source/WebKit/UIProcess/API/glib/WebKitLoaderClient.h.
* UIProcess/API/glib/WebKitNavigationPolicyDecision.cpp:
(webkit_navigation_policy_decision_get_frame_name): Add FIXME.
(webkitNavigationPolicyDecisionCreate): Get the target frame name from the API::NavigationAction.
* UIProcess/API/glib/WebKitNavigationPolicyDecisionPrivate.h:
* UIProcess/API/glib/WebKitPolicyClient.cpp: Removed.
* UIProcess/API/glib/WebKitPolicyClient.h: Removed.
* UIProcess/API/glib/WebKitPolicyDecision.cpp:
(webkitPolicyDecisionSetListener): Remove the madePolicyDecision boolean member, we can null-check the listener instead.
(webkit_policy_decision_use): Ensure listener is nullptr after being invoked to prevent the decision from being made
more than once.
(webkit_policy_decision_ignore): Ditto.
(webkit_policy_decision_download): Ditto.
* UIProcess/API/glib/WebKitPolicyDecisionPrivate.h:
* UIProcess/API/glib/WebKitResponsePolicyDecision.cpp:
(webkit_response_policy_decision_get_request): Use the wrapped API::NavigationResponse.
(webkit_response_policy_decision_get_response): Ditto.
(webkit_response_policy_decision_is_mime_type_supported): Ditto.
(webkitResponsePolicyDecisionCreate): Wrap the given API::NavigationResponse.
* UIProcess/API/glib/WebKitResponsePolicyDecisionPrivate.h:
* UIProcess/API/glib/WebKitUIClient.cpp:
(UIClient::createNewPage): Create the WebKitNavigationAction from a new API::NavigationAction.
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed): Attach navigation client.
* UIProcess/Cocoa/NavigationState.h: Update API::NavigationResponse parameter of decidePolicyForNavigationResponse.
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didDisplayInsecureContentForFrame): Notify the navigation client if it's used.
(WebKit::WebPageProxy::didRunInsecureContentForFrame): Ditto.
(WebKit::WebPageProxy::decidePolicyForNewWindowAction): Use the new API::NavigationAction constructor to pass
the target frame name, instead of a null target frame info.
(WebKit::WebPageProxy::decidePolicyForResponse): Move the API::NavigationResponse.

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

2 years ago[GTK][WPE] CoordinatedGraphicsLayer::setNeedsDisplayInRect() converts FloatRect to...
magomez@igalia.com [Fri, 10 Nov 2017 08:51:03 +0000 (08:51 +0000)]
[GTK][WPE] CoordinatedGraphicsLayer::setNeedsDisplayInRect() converts FloatRect to IntRect erroneously
https://bugs.webkit.org/show_bug.cgi?id=179476

Reviewed by Žan Doberšek.

Convert the passed FloatRect into an IntRect using enclosingIntRect(), so we are guaranteed that
the rectangle to paint fits into the buffer that the backingStore will allocate.

No behaviour change.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):

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

2 years agoWebInjectedScriptHost.cpp: warning: variable ‘scope’ set but not used
commit-queue@webkit.org [Fri, 10 Nov 2017 08:30:28 +0000 (08:30 +0000)]
WebInjectedScriptHost.cpp: warning: variable ‘scope’ set but not used
https://bugs.webkit.org/show_bug.cgi?id=179524

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-11-10
Reviewed by Joseph Pecoraro.

r224606 has introduced a new compilation warning if not
ENABLE(PAYMENT_REQUEST).

No new tests (No behavior change).

* inspector/WebInjectedScriptHost.cpp:
(WebCore::WebInjectedScriptHost::getInternalProperties): Do not
define the variable 'scope' if not ENABLE(PAYMENT_REQUEST). Marked
a variable 'vm' with UNUSED_PARAM.

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

2 years ago[Cairo] Start grouping Cairo GraphicsContext operations behind a separate interface
zandobersek@gmail.com [Fri, 10 Nov 2017 08:18:02 +0000 (08:18 +0000)]
[Cairo] Start grouping Cairo GraphicsContext operations behind a separate interface
https://bugs.webkit.org/show_bug.cgi?id=179467

Reviewed by Carlos Garcia Campos.

Start moving the Cairo operations in GraphicsContext into a separate
translation unit, CairoOperations.cpp. This will ease leveraging these
operations from a pre-recorded list of GraphicsContext commands, or
from a Cairo-specific GraphicsContextImpl, without undermining the
current GraphicsContext implementation that we'll want to maintain
in a working state until necessary.

We start with the clipping operations. Each operation is encapsulated
in a static function inside the WebCore::Cairo namespace that expects
PlatformContextCairo reference as the first argument, which makes sense
since we have to utilize the cairo_t state object that's kept there.
Other parameters are passed as well, as required for some specific
operation.

In the Cairo implementation of GraphicsContext, the affected methods
are changed to assert presence of the platform context (i.e. this is a
GraphicsContext that operates on a valid cairo_t object, and is not
using an m_impl object or is in non-painting mode) before the
PlatformContextCairo object is dereferenced and passed along with
other arguments to the Cairo::clip*() function.

No new tests -- no change in behavior.

* platform/SourcesCairo.txt:
* platform/graphics/cairo/CairoOperations.cpp: Added.
(WebCore::Cairo::clip):
(WebCore::Cairo::clipOut):
(WebCore::Cairo::clipPath):
(WebCore::Cairo::clipToImageBuffer):
* platform/graphics/cairo/CairoOperations.h: Added.
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::clipPath):
(WebCore::GraphicsContext::clipToImageBuffer):
(WebCore::GraphicsContext::clipOut):

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

2 years agoWebDriver: WebDriverService::matchCapabilities should follow the spec
carlosgc@webkit.org [Fri, 10 Nov 2017 07:27:30 +0000 (07:27 +0000)]
WebDriver: WebDriverService::matchCapabilities should follow the spec
https://bugs.webkit.org/show_bug.cgi?id=179371

Reviewed by Brian Burg.

The returned object should contain all the entries mentioned in the spec, not only the ones already present in
the passed in capabilities object.

7.2 Processing Capabilities
https://w3c.github.io/webdriver/webdriver-spec.html#dfn-matching-capabilities

* WebDriverService.cpp:
(WebDriver::WebDriverService::matchCapabilities const):
(WebDriver::WebDriverService::processCapabilities const):
* WebDriverService.h:

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

2 years agoWebDriver: capabilities with null value shouldn't be added to the validated capabilit...
carlosgc@webkit.org [Fri, 10 Nov 2017 07:25:59 +0000 (07:25 +0000)]
WebDriver: capabilities with null value shouldn't be added to the validated capabilities object
https://bugs.webkit.org/show_bug.cgi?id=179369

Reviewed by Brian Burg.

"4. If deserialized is not null, set a property on result with name name and value deserialized."

7.2 Processing Capabilities
https://w3c.github.io/webdriver/webdriver-spec.html#dfn-validate-capabilities

Fixes: imported/w3c/webdriver/tests/sessions/new_session/create_firstMatch.py::test_valid[platformName-None]

* WebDriverService.cpp:
(WebDriver::WebDriverService::validatedCapabilities const):

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

2 years ago[Xcode] An extra copy of FileSizeFormatter.h is installed in /usr/local/include
mitz@apple.com [Fri, 10 Nov 2017 07:21:44 +0000 (07:21 +0000)]
[Xcode] An extra copy of FileSizeFormatter.h is installed in /usr/local/include
https://bugs.webkit.org/show_bug.cgi?id=179525

Reviewed by Wenson Hsieh.

* PAL.xcodeproj/project.pbxproj: Demoted FileSizeFormatter.h to a project header in the PAL target. The
  Copy PAL Headers target takes care of installing this header under /usr/local/include/pal.

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

2 years agoUnreviewed, rolling out r224661.
cdumez@apple.com [Fri, 10 Nov 2017 07:03:24 +0000 (07:03 +0000)]
Unreviewed, rolling out r224661.

Broke build on several internal Mac/iOS bots

Reverted changeset:

"Ignore HSTS for partitioned, cross-origin subresource
requests"
https://bugs.webkit.org/show_bug.cgi?id=178993
https://trac.webkit.org/changeset/224661

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

2 years agoServiceWorkerRegistration objects may get recycled for different SWServerRegistration...
cdumez@apple.com [Fri, 10 Nov 2017 06:26:40 +0000 (06:26 +0000)]
ServiceWorkerRegistration objects may get recycled for different SWServerRegistration objects
https://bugs.webkit.org/show_bug.cgi?id=179517

Reviewed by Brady Eidson.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/ready.https-expected.txt:
The test fails differently. The failure is expected here since we do not implement the
"Try Clear Registration" algorithm. As a result, we do not support resurrecting a
registration with the 'uninstalling' flag set. We always clear uninstalling registrations
on server side for now.

* web-platform-tests/service-workers/service-worker/unregister-then-register.https-expected.txt:
Same reason as above. The second checks calls unregister() for a registration that is "in use"
as expects it to get resurrected when calling register() again. We currently always clear
registrations that are unregistered on server side.

Source/WebCore:

ServiceWorkerRegistration objects could get recycled for different SWServerRegistration objects, leading to
flakiness in the tests. We uses ServiceWorkerRegistrationKey as key in the m_registration map on WebProcess
side. The lifetime of the ServiceWorkerRegistration objects is tied to the lifetime of their JS wrapper.
When a test does a registration for a given scope, then unregisters, then registers again for the same scope,
we would end up creating a new SWServerRegistration object on server side, but possibly reuse the same
ServiceWorkerRegistration object on WebProcess side, if its wrapper has not yet been garbage collected.
This is because the registrations have the same ServiceWorkerRegistrationKey in this case.

To address the issue, we now use the ServiceWorkerRegistrationIdentifier as key in the m_registration
hash map. A SWServerRegistration has a unique ServiceWorkerRegistrationIdentifier on server side.
All its clients ServiceWorkerRegistration also use the same ServiceWorkerRegistrationIdentifier.

Test: http/tests/workers/service/basic-unregister-then-register-again-no-reuse.html

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::getRegistration):
(WebCore::ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState):
(WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::removeRegistration):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerRegistration.h:
* workers/service/ServiceWorkerRegistrationData.h:
(WebCore::ServiceWorkerRegistrationData::decode):
* workers/service/server/SWClientConnection.cpp:
(WebCore::SWClientConnection::updateRegistrationState):
(WebCore::SWClientConnection::fireUpdateFoundEvent):
* workers/service/server/SWClientConnection.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
(WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
(WebCore::SWServer::resolveRegistrationJob):
(WebCore::SWServer::addClientServiceWorkerRegistration):
(WebCore::SWServer::removeClientServiceWorkerRegistration):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerRegistration.cpp:
(WebCore::generateServiceWorkerRegistrationIdentifier):
(WebCore::SWServerRegistration::SWServerRegistration):
(WebCore::SWServerRegistration::updateRegistrationState):
(WebCore::SWServerRegistration::fireUpdateFoundEvent):
(WebCore::SWServerRegistration::forEachConnection):
(WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
(WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::identifier const):

Source/WebKit:

* Scripts/webkit/messages.py:
(forward_declarations_and_headers):
* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::updateRegistrationStateInClient):
(WebKit::WebSWServerConnection::fireUpdateFoundEvent):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::addServiceWorkerRegistrationInServer):
(WebKit::WebSWClientConnection::removeServiceWorkerRegistrationInServer):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWClientConnection.messages.in:

LayoutTests:

Add layout test coverage.

* http/tests/workers/service/basic-unregister-then-register-again-no-reuse-expected.txt: Added.
* http/tests/workers/service/basic-unregister-then-register-again-no-reuse.html: Added.

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

2 years agoLayoutTests/imported/w3c:
cdumez@apple.com [Fri, 10 Nov 2017 06:06:12 +0000 (06:06 +0000)]
LayoutTests/imported/w3c:
Unreviewed, ebaseline flaky / skipped service worker tests
https://bugs.webkit.org/show_bug.cgi?id=179521

Rebaseline skipped / flaky service worker tests to get better estimates of our pass rate.

* web-platform-tests/service-workers/service-worker/extendable-event-waituntil.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-canvas-tainting-cache.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-canvas-tainting.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https-expected.txt:
* web-platform-tests/service-workers/service-worker/fetch-request-redirect.https-expected.txt:
* web-platform-tests/service-workers/service-worker/foreign-fetch-basics.https-expected.txt:
* web-platform-tests/service-workers/service-worker/performance-timeline.https-expected.txt:
* web-platform-tests/service-workers/service-worker/register-foreign-fetch-errors.https-expected.txt:
* web-platform-tests/service-workers/service-worker/registration-updateviacache.https-expected.txt:
* web-platform-tests/service-workers/service-worker/unregister-controller.https-expected.txt:
* web-platform-tests/service-workers/service-worker/unregister-then-register-new-script.https-expected.txt:
* web-platform-tests/service-workers/service-worker/update-bytecheck.https-expected.txt:

LayoutTests:
Unreviewed, rebaseline flaky / skipped service worker tests
https://bugs.webkit.org/show_bug.cgi?id=179521

Unskip a test that is no longer timing out.

* TestExpectations:

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

2 years ago[JSC] Retry module fetching if previous request fails
utatane.tea@gmail.com [Fri, 10 Nov 2017 05:28:34 +0000 (05:28 +0000)]
[JSC] Retry module fetching if previous request fails
https://bugs.webkit.org/show_bug.cgi?id=178168

Reviewed by Saam Barati.

Source/JavaScriptCore:

According to the latest spec, the failed fetching operation can be retried if it is requested again.
For example,

    <script type="module" integrity="shaXXX-bad" src="./A.js"></script>
    <script type="module" integrity="shaXXX-correct" src="./A.js"></script>

When performing the first module fetching, integrity check fails, and the load of this module becomes failed.
But when loading the second module, we do not use the cached failure result in the first module loading.
We retry fetching for "./A.js". In this case, we have a correct integrity and module fetching succeeds.
This is specified in whatwg/HTML[1]. If the fetching fails, we do not cache it.

Interestingly, fetching result and instantiation result will be cached if they succeeds. This is because we would
like to cache modules based on their URLs. As a result,

    <script type="module" integrity="shaXXX-correct" src="./A.js"></script>
    <script type="module" integrity="shaXXX-bad" src="./A.js"></script>

In the above case, the first loading succeeds. And the second loading also succeeds since the succeeded fetching and
instantiation are cached in the module pipeline.

This patch implements the above semantics. Previously, our module pipeline always caches the result. If the fetching
failed, all the subsequent fetching for the same URL fails even if we have different integrity values. We retry fetching
if the previous one fails. As an overview of our change,

1. Fetching result should be cached only if it succeeds. Two or more on-the-fly fetching requests to the same URLs should
   be unified. But if currently executing one fails, other attempts should retry fetching.

2. Instantiation should be cached if fetching succeeds.

3. Satisfying should be cached if it succeeds.

[1]: https://html.spec.whatwg.org/#fetch-a-single-module-script

* builtins/ModuleLoaderPrototype.js:
(requestFetch):
(requestInstantiate):
(requestSatisfy):
(link):
(loadModule):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):

LayoutTests:

* js/dom/modules/module-fetch-failure-not-cached-expected.txt: Added.
* js/dom/modules/module-fetch-failure-not-cached.html: Added.
* js/dom/modules/module-integrity-bad-value-success-with-cache-expected.txt: Added.
* js/dom/modules/module-integrity-bad-value-success-with-cache.html: Added.
* js/dom/modules/script-tests/module-fetch-failure-not-cached.js: Added.
* js/dom/modules/script-tests/module-integrity-bad-value-success-with-cache.js: Added.

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

2 years agoIgnore HSTS for partitioned, cross-origin subresource requests
bfulgham@apple.com [Fri, 10 Nov 2017 03:21:23 +0000 (03:21 +0000)]
Ignore HSTS for partitioned, cross-origin subresource requests
https://bugs.webkit.org/show_bug.cgi?id=178993
<rdar://problem/34962462>

Patch by John Wilander <wilander@apple.com> on 2017-11-09
Reviewed by Brent Fulgham.

Source/WebCore:

No new tests. HSTS is not supported in layout tests.
Tested manually.

* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::synthesizeRedirectResponseIfNecessary):

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:
    Added
    - (BOOL)_schemeWasUpgradedDueToDynamicHSTS
    - (BOOL)_preventHSTSStorage
    - (BOOL)_ignoreHSTS
    - (void)_setPreventHSTSStorage:(BOOL)preventHSTSStorage
    - (void)_setIgnoreHSTS:(BOOL)ignoreHSTS

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(downgradeRequest):
    Convenience function to downgrade a request if
    CFNetwork as already upgraded it during
    canonicalization. This allows the rest of
    WebKit's processing to function, such as UIR
    and mixed content blocking.
(updateIgnoreStrictTransportSecuritySettingIfNecessary):
    Adds and removed the ignore request accordingly.
(-[WKNetworkSessionDelegate URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:]):
    Now asks CFNetwork to ignore HSTS on resource loads we
    partition cookies for.
(-[WKNetworkSessionDelegate URLSession:task:_schemeUpgraded:completionHandler:]):
    Now asks CFNetwork to ignore HSTS on resource loads we
    partition cookies for.

Source/WTF:

* wtf/Platform.h:
    Added HAVE_CFNETWORK_IGNORE_HSTS.

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

2 years agoMark multiple service worker tests as flaky.
ryanhaddad@apple.com [Fri, 10 Nov 2017 01:56:10 +0000 (01:56 +0000)]
Mark multiple service worker tests as flaky.

Unreviewed test gardening.

* TestExpectations: Add flaky tests and alphabetize existing entries.

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

2 years ago[iOS] Rebaseline and re-enable editing/deleting tests
ryanhaddad@apple.com [Fri, 10 Nov 2017 01:50:30 +0000 (01:50 +0000)]
[iOS] Rebaseline and re-enable editing/deleting tests
https://bugs.webkit.org/show_bug.cgi?id=179119

Unreviewed test gardening.

* platform/ios-wk2/TestExpectations:
* platform/ios/TestExpectations:
* platform/ios/editing/deleting/collapse-whitespace-3587601-fix-expected.txt: Added.
* platform/ios/editing/deleting/delete-3608445-fix-expected.txt: Added.
* platform/ios/editing/deleting/delete-3800834-fix-expected.txt: Added.
* platform/ios/editing/deleting/delete-after-span-ws-001-expected.txt: Added.
* platform/ios/editing/deleting/delete-after-span-ws-002-expected.txt: Added.
* platform/ios/editing/deleting/delete-after-span-ws-003-expected.txt: Added.
* platform/ios/editing/deleting/delete-at-paragraph-boundaries-004-expected.txt:
* platform/ios/editing/deleting/delete-at-paragraph-boundaries-010-expected.txt:
* platform/ios/editing/deleting/delete-at-paragraph-boundaries-011-expected.txt:
* platform/ios/editing/deleting/delete-at-start-or-end-expected.txt: Added.
* platform/ios/editing/deleting/delete-block-contents-001-expected.txt: Added.
* platform/ios/editing/deleting/delete-block-contents-002-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-br-010-expected.txt.
* platform/ios/editing/deleting/delete-block-merge-contents-005-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-006-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-007-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-008-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-023-expected.txt:
* platform/ios/editing/deleting/delete-block-merge-contents-024-expected.txt:
* platform/ios/editing/deleting/delete-br-002-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-to-select-table-expected.txt.
* platform/ios/editing/deleting/delete-br-004-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-to-select-table-expected.txt.
* platform/ios/editing/deleting/delete-br-005-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-to-select-table-expected.txt.
* platform/ios/editing/deleting/delete-br-006-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-to-select-table-expected.txt.
* platform/ios/editing/deleting/delete-br-008-expected.txt:
* platform/ios/editing/deleting/delete-br-009-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-br-008-expected.txt.
* platform/ios/editing/deleting/delete-br-010-expected.txt:
* platform/ios/editing/deleting/delete-image-004-expected.txt: Added.
* platform/ios/editing/deleting/delete-leading-ws-001-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-br-010-expected.txt.
* platform/ios/editing/deleting/delete-line-011-expected.txt: Copied from LayoutTests/platform/ios/editing/deleting/delete-to-select-table-expected.txt.
* platform/ios/editing/deleting/delete-line-015-expected.txt:
* platform/ios/editing/deleting/delete-line-016-expected.txt:
* platform/ios/editing/deleting/delete-line-017-expected.txt:
* platform/ios/editing/deleting/delete-line-end-ws-001-expected.txt: Added.
* platform/ios/editing/deleting/delete-line-end-ws-002-expected.txt: Added.
* platform/ios/editing/deleting/delete-tab-001-expected.txt: Added.
* platform/ios/editing/deleting/delete-tab-004-expected.txt: Added.
* platform/ios/editing/deleting/delete-to-select-table-expected.txt:
* platform/ios/editing/deleting/merge-no-br-expected.txt:
* platform/ios/editing/deleting/table-cells-expected.txt:

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

2 years agowebkitpy: Unify version parsing code
jbedard@apple.com [Fri, 10 Nov 2017 01:48:40 +0000 (01:48 +0000)]
webkitpy: Unify version parsing code
https://bugs.webkit.org/show_bug.cgi?id=179426
<rdar://problem/35415191>

Unreviewed fix to r224657.

* Scripts/webkitpy/common/version.py:
(Version.__init__): Check if an object is iterable.

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

2 years agowebkitpy: Unify version parsing code
jbedard@apple.com [Fri, 10 Nov 2017 00:58:32 +0000 (00:58 +0000)]
webkitpy: Unify version parsing code
https://bugs.webkit.org/show_bug.cgi?id=179426
<rdar://problem/35415191>

Reviewed by David Kilzer.

webkitpy needs to parse version strings or version lists frequently. Rather than
duplicate this code each time it's needed, unify it in a Version class.

* Scripts/webkitpy/common/system/platforminfo.py:
(PlatformInfo.__init__): Convert mac version string to version object and
use _win_version instead of _win_version_tuple.
(PlatformInfo.xcode_sdk_version): Convert SDK version string to Version object
before returning it.
(PlatformInfo.xcode_version): Return Version object instead of version string.
(PlatformInfo._determine_mac_version): Accept Version object instead of string,
eliminate parsing.
(PlatformInfo._determine_win_version): Accept Version object instead of tuple.
(PlatformInfo._win_version): Return Version object instead of tuple, have Version
object own version string parsing.
(PlatformInfo._win_version_tuple): Renamed to _win_version().
(PlatformInfo._win_version_tuple_from_cmd): Deleted.
* Scripts/webkitpy/common/system/platforminfo_mock.py:
(MockPlatformInfo.xcode_sdk_version): Return Version object instead of string.
(MockPlatformInfo.xcode_version): Dittio.
* Scripts/webkitpy/common/version.py: Added.
(Version): Version object.
(Version.__init__): Initialize the Version object with a string, integer,
tuple of integers, list of integers or another Version object.
(Version.__len__): Return 5 so that the Version object can be treated as
a list or tuple.
(Version.__getitem__): Get item in Version object by index or string.
(Version.__setitem__): Set item in Version object by index or string.
(Version.__str__): Convert version to printable string, omitting trailing 0's.
(Version.__cmp__): Compare two version strings, major taking precedence over
minor, minor taking precedence over build.
* Scripts/webkitpy/common/version_unittest.py: Added.
(VersionTestCase): Test behavior of Version object.
* Scripts/webkitpy/port/ios.py:
(IOSPort.default_baseline_search_path): ios_version now returns a Version object.
(IOSPort._is_valid_ios_version): Deleted.
(IOSPort.get_option): Deleted.
* Scripts/webkitpy/port/ios_device.py:
(IOSDevicePort.determine_full_port_name): Use Version object instead of owning parsing.
(IOSDevicePort.ios_version): Return Version object instead of string.
* Scripts/webkitpy/port/ios_simulator.py:
(IOSSimulatorPort.simulator_runtime): Use from_version instead of from_version_string.
(IOSSimulatorPort.ios_version): Return Version object instead of string.
(IOSSimulatorPort.use_multiple_simulator_apps): Use Version object instead of string.
* Scripts/webkitpy/xcode/simulator.py:
(Runtime.from_version): Accept Version object instead of string.
(Runtime.from_version_string): Replaced by from_version.
(Runtime.__repr__): When printing, a runtime's version will be a Version object instead
of a tuple.
(Simulator._parse_runtimes): Use Version object instead of tuple.
(Simulator._parse_devices): Ditto.
* Scripts/webkitpy/xcode/simulator_unittest.py: Use Version object instead of tuples.

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

2 years ago[WinCairo] Cannot find ImageDiff executable
commit-queue@webkit.org [Fri, 10 Nov 2017 00:48:51 +0000 (00:48 +0000)]
[WinCairo] Cannot find ImageDiff executable
https://bugs.webkit.org/show_bug.cgi?id=179508

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> on 2017-11-09
Reviewed by Per Arne Vollan.

* Scripts/webkitpy/port/win.py:
(WinPort.is_cygwin):
(WinPort._path_to_image_diff):
(WinPort.find_system_pid):

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

2 years agoMark media/modern-media-controls/media-controller/media-controller-auto-hide-mouse...
ryanhaddad@apple.com [Fri, 10 Nov 2017 00:41:27 +0000 (00:41 +0000)]
Mark media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-and-mouse-leave.html as a flaky timeout.
https://bugs.webkit.org/show_bug.cgi?id=169876

Unreviewed test gardening.

* platform/mac/TestExpectations:

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

2 years agoSkip slow encoding WPT LayoutTests.
ryanhaddad@apple.com [Fri, 10 Nov 2017 00:31:34 +0000 (00:31 +0000)]
Skip slow encoding WPT LayoutTests.

Unreviewed test gardening.

* TestExpectations:

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

2 years ago[LayoutState cleanup] Remove explicit pop from LayoutState
zalan@apple.com [Fri, 10 Nov 2017 00:31:24 +0000 (00:31 +0000)]
[LayoutState cleanup] Remove explicit pop from LayoutState
https://bugs.webkit.org/show_bug.cgi?id=179509
<rdar://problem/35454323>

Reviewed by Antti Koivisto.

Both relayoutForPagination()/relayoutToAvoidWidows() call layout recursively which requires
manual layout state pop. This patch addresses this issue by constructing a new LayoutState object
for the positioned descendants.

Covered by existing tests.

* rendering/LayoutState.cpp:
(WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
(WebCore::LayoutStateMaintainer::pop): Deleted.
* rendering/LayoutState.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::RenderBlockFlow::relayoutToAvoidWidows):
(WebCore::RenderBlockFlow::relayoutForPagination):
* rendering/RenderBlockFlow.h:

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

2 years agoImplement real post 'install' event steps of the Install algorithm (steps 14+)
cdumez@apple.com [Thu, 9 Nov 2017 23:45:29 +0000 (23:45 +0000)]
Implement real post 'install' event steps of the Install algorithm (steps 14+)
https://bugs.webkit.org/show_bug.cgi?id=179401

Reviewed by Brady Eidson.

LayoutTests/imported/w3c:

Rebaseline a test that is now failing later (progression).

* web-platform-tests/service-workers/service-worker/navigate-window.https-expected.txt:

Source/WebCore:

Implement step 14+ of Install algorithm, as per:
- https://w3c.github.io/ServiceWorker/#installation-algorithm

* dom/Microtasks.h:
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::ServiceWorker):
(WebCore::ServiceWorker::scheduleTaskToUpdateState):
* workers/service/ServiceWorker.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState):
(WebCore::ServiceWorkerContainer::jobFailedWithException):
(WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
(WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::resolvedWithRegistration):
* workers/service/ServiceWorkerJob.h:
* workers/service/ServiceWorkerJobClient.h:
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
* workers/service/ServiceWorkerTypes.h:
* workers/service/server/SWClientConnection.cpp:
(WebCore::SWClientConnection::registrationJobResolvedInServer):
(WebCore::SWClientConnection::forEachContainer):
(WebCore::SWClientConnection::updateRegistrationState):
(WebCore::SWClientConnection::updateWorkerState):
(WebCore::SWClientConnection::fireUpdateFoundEvent):
* workers/service/server/SWClientConnection.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::Connection::didResolveRegistrationPromise):
(WebCore::SWServer::resolveRegistrationJob):
(WebCore::SWServer::didResolveRegistrationPromise):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::install):
(WebCore::SWServerJobQueue::didResolveRegistrationPromise):
(WebCore::SWServerJobQueue::didFinishInstall):
(WebCore::SWServerJobQueue::runRegisterJob):
* workers/service/server/SWServerJobQueue.h:
* workers/service/server/SWServerRegistration.cpp:
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::installingWorker const):
(WebCore::SWServerRegistration::waitingWorker const):
(WebCore::SWServerRegistration::activeWorker const):
* workers/service/server/SWServerWorker.cpp:
(WebCore::SWServerWorker::terminate):
* workers/service/server/SWServerWorker.h:

Source/WebKit:

Implement step 14+ of Install algorithm, as per:
- https://w3c.github.io/ServiceWorker/#installation-algorithm

* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebCoreArgumentCoders.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::resolveRegistrationJobInClient):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* StorageProcess/ServiceWorker/WebSWServerConnection.messages.in:
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::didResolveRegistrationPromise):
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWClientConnection.messages.in:

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

2 years agoWeb Inspector: Styles Redesign: clicking on inline swatches and property checkboxes...
nvasilyev@apple.com [Thu, 9 Nov 2017 23:40:51 +0000 (23:40 +0000)]
Web Inspector: Styles Redesign: clicking on inline swatches and property checkboxes should not add a new property
https://bugs.webkit.org/show_bug.cgi?id=179507
<rdar://problem/35452204>

Reviewed by Brian Burg.

* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
(WI.SpreadsheetCSSStyleDeclarationSection.prototype._handleClick):
Don't add new properties when clicking on selector fields, source links, and property checkboxes.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype._update):
It is safe to replace "change" event with "click" since it fires even when pressing Space key when the checkbox is focused.

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

2 years agoBug 179068 - AX: search predicate returns containing group for plain text instead...
d_russell@apple.com [Thu, 9 Nov 2017 23:35:34 +0000 (23:35 +0000)]
Bug 179068 - AX: search predicate returns containing group for plain text instead of text element
https://bugs.webkit.org/show_bug.cgi?id=179068

Reviewed by Darin Adler

Implement a check in AccessibilityRenderObject::hasPlainText(), AccessibilityObject::canHavePlainText(), to confirm the element is capable of providing text.

Source/WebCore:

Tests: accessibility/mac/search-predicate-plaintext.html
       accessibility/mac/search-predicate-visible-button.html
       accessibility/mac/search-predicate-visited-links.html

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::text const):
(WebCore::AccessibilityNodeObject::stringValue const):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isARIAStaticText const):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::stringValue const):
(WebCore::AccessibilityRenderObject::canHavePlainText const):
(WebCore::AccessibilityRenderObject::hasPlainText const):
* accessibility/AccessibilityRenderObject.h:

LayoutTests:

* accessibility/mac/search-predicate-expected.txt:
* accessibility/mac/search-predicate-plaintext-expected.txt: Added.
* accessibility/mac/search-predicate-plaintext.html: Added.
* accessibility/mac/search-predicate-visible-button-expected.txt: Added.
* accessibility/mac/search-predicate-visible-button.html: Added.
* accessibility/mac/search-predicate-visited-links-expected.txt: Added.
* accessibility/mac/search-predicate-visited-links.html: Added.
* accessibility/mac/search-predicate.html:
* platform/mac-wk2/TestExpectations:

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

2 years agoInserting an image, selecting, underlining, and then deleting leaves the typing style...
wenson_hsieh@apple.com [Thu, 9 Nov 2017 23:26:55 +0000 (23:26 +0000)]
Inserting an image, selecting, underlining, and then deleting leaves the typing style with both "-webkit-text-decorations-in-effect" and "text-decoration"
https://bugs.webkit.org/show_bug.cgi?id=179431

Reviewed by Ryosuke Niwa.

Source/WebCore:

When inserting an image element, selecting it, underlining the selection, deleting, and then inserting text, we
crash on a debug assert. This codepath was exercised by an API test added in <https://trac.webkit.org/r224512>.
This assertion happens due to the following sequence of events:
1. DeleteSelectionCommand::saveTypingStyleState computes a typing style.
2. In doing so, it calls into EditingStyle::init, which observes that "-webkit-text-decorations-in-effect" is
   present and appends "text-decoration" with an identical CSS value to the EditingStyle's mutable style
   properties.
3. DeleteSelectionCommand::calculateTypingStyleAfterDelete sets the current selection's typing style to the
   above typing style.
4. Later on, when we try to insert text, we compute the StyleChange using the above typing style, which calls
   into reconcileTextDecorationProperties.
5. reconcileTextDecorationProperties debug asserts that "-webkit-text-decorations-in-effect" and
   "text-decoration" don't coexist on the EditingStyle's (i.e. the typing style's) mutable properties; since (2)
   added both properties, this assertion fires.

It appears that step (2) shouldn't be adding "text-decoration" in addition to EditingStyle's mutable style
properties, since doing so would violate the requirements of reconcileTextDecorationProperties. As such, we can
tweak EditingStyle::init to *replace* the "-webkit-text-decorations-in-effect" property with "text-decoration"
instead; this matches the behavior of reconcileTextDecorationProperties, and ensures that we only have the
"text-decorations" property when we try to insert text in step (4).

Test: editing/execCommand/underline-selection-containing-image.html

* editing/EditingStyle.cpp:
(WebCore::EditingStyle::init):

LayoutTests:

Adds a new layout test to fix a debug assertion. See WebCore/ChangeLog for more details. Additionally
rebaselines a few existing tests that serialize markup strings to include `text-decoration: none;`.

* editing/execCommand/underline-selection-containing-image-expected.txt: Added.
* editing/execCommand/underline-selection-containing-image.html: Added.
* editing/pasteboard/data-transfer-get-data-on-drop-rich-text-expected.txt:
* fast/events/before-input-events-prevent-drag-and-drop-expected.txt:
* fast/events/input-events-paste-rich-datatransfer-expected.txt:
* fast/events/ondrop-text-html-expected.txt:

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

2 years agoWeb Inspector: support undo/redo of insertAdjacentHTML
webkit@devinrousso.com [Thu, 9 Nov 2017 23:12:01 +0000 (23:12 +0000)]
Web Inspector: support undo/redo of insertAdjacentHTML
https://bugs.webkit.org/show_bug.cgi?id=179283

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/DOM.json:
Add `insertAdjacentHTML` command that executes an undoable version of `insertAdjacentHTML`
on the given node.

Source/WebCore:

Test: inspector/dom/insertAdjacentHTML.html

Create another version of Element::insertAdjacentHTML that keeps track of the nodes that are
added. This is necessary because the children of a DocumentFragment are removed when it is
added to a ContainerNode. In this way, it is possible to remove those nodes during an undo.

* dom/Element.h:
* dom/Element.cpp:
(WebCore::Element::insertAdjacentHTML):

* inspector/DOMEditor.h:
* inspector/DOMEditor.cpp:
(WebCore::DOMEditor::insertAdjacentHTML):
Drive-by fix: sort functions and class declarations.

* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::insertAdjacentHTML):

Source/WebInspectorUI:

* UserInterface/Models/DOMNode.js:
(WI.DOMNode.prototype.insertAdjacentHTML):

* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype._startEditingAsHTML):
Drive-by: only attempt to update the cursor if an initialValue is supplied.
LayoutTests:

* inspector/dom/insertAdjacentHTML-expected.txt: Added.
* inspector/dom/insertAdjacentHTML.html: Added.

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

2 years ago[WinCairo EWS] svn-apply: 'cp' is not recognized as an internal or external command
commit-queue@webkit.org [Thu, 9 Nov 2017 22:13:16 +0000 (22:13 +0000)]
[WinCairo EWS] svn-apply: 'cp' is not recognized as an internal or external command
https://bugs.webkit.org/show_bug.cgi?id=179469

Patch by Fujii Hironori <Hironori.Fujii@sony.com> on 2017-11-09
Reviewed by Per Arne Vollan.

WinCairo EWS bots haven't installed Cygwin.

* Scripts/svn-apply:
(scmCopy): Use 'copy' function instead of 'cp' command.

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

2 years ago[LayoutState cleanup] Remove redundant LayoutState c'tor
zalan@apple.com [Thu, 9 Nov 2017 22:03:19 +0000 (22:03 +0000)]
[LayoutState cleanup] Remove redundant LayoutState c'tor
https://bugs.webkit.org/show_bug.cgi?id=179505
<rdar://problem/35450650>

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/LayoutState.cpp:
* rendering/LayoutState.h:

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

2 years agoFetchResponse should set the mime type of its internal ResourceResponse
commit-queue@webkit.org [Thu, 9 Nov 2017 21:09:24 +0000 (21:09 +0000)]
FetchResponse should set the mime type of its internal ResourceResponse
https://bugs.webkit.org/show_bug.cgi?id=179487

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

No observable change.
Setting the mime type of the response as navigation loads use that field.
This will be used for navigation loads served by service worker.

* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::create):

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

2 years agoServiceWorker ResourceResponse should not assert in platformCertificateInfo()
commit-queue@webkit.org [Thu, 9 Nov 2017 20:58:15 +0000 (20:58 +0000)]
ServiceWorker ResourceResponse should not assert in platformCertificateInfo()
https://bugs.webkit.org/show_bug.cgi?id=179486

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

No change of behavior.
In case a Response is returned by Service Worker, there may be no related internal response.
In that case, platformCertificateInfo is returning an empty CertificateInfo.

* platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformCertificateInfo const):

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

2 years ago[WPE] Update dyz (WPE MiniBrowser)
clopez@igalia.com [Thu, 9 Nov 2017 20:56:27 +0000 (20:56 +0000)]
[WPE] Update dyz (WPE MiniBrowser)
https://bugs.webkit.org/show_bug.cgi?id=179492

Reviewed by Michael Catanzaro.

Update it to the last version as of today.
This version not longer uses the C API.

* wpe/jhbuild.modules:

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

2 years ago[WPE] Use linker script to control exported symbols
mcatanzaro@igalia.com [Thu, 9 Nov 2017 20:56:03 +0000 (20:56 +0000)]
[WPE] Use linker script to control exported symbols
https://bugs.webkit.org/show_bug.cgi?id=179358

Reviewed by Carlos Alberto Lopez Perez.

The C API is being inadvertently exported because it's marked as WEBKIT_EXPORT in the header
files. But of course it should only be exported in DEVELOPER_MODE, where it's needed for
WebKitTestRunner. Use (almost) the same linker version script as GTK to fix this. It's
slightly different because WPE does not have WebKitPluginProcess.

This also reduces binary size of libWPEWebKit.so in debug mode from 615 MB down to 497 MB.
(Haven't checked release mode.)

* Source/cmake/OptionsWPE.cmake:
* Source/cmake/wpesymbols.filter: Added.

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

2 years ago[LayoutState cleanup] Remove conditional push from RenderTableSection::calcRowLogical...
zalan@apple.com [Thu, 9 Nov 2017 20:22:10 +0000 (20:22 +0000)]
[LayoutState cleanup] Remove conditional push from RenderTableSection::calcRowLogicalHeight
https://bugs.webkit.org/show_bug.cgi?id=179493
<rdar://problem/35446631>

Reviewed by Antti Koivisto.

Pushing layout states is cheap and we do it for every container anyway.

Covered by existing tests.

* rendering/LayoutState.cpp:
(WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
(WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
(WebCore::LayoutStateMaintainer::pop):
(WebCore::LayoutStateMaintainer::push): Deleted.
* rendering/LayoutState.h:
(WebCore::LayoutStateMaintainer::didPush const): Deleted.
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::calcRowLogicalHeight):

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

2 years agoClean out unused selection items from UIKitSPI
megan_gardner@apple.com [Thu, 9 Nov 2017 19:30:16 +0000 (19:30 +0000)]
Clean out unused selection items from UIKitSPI
https://bugs.webkit.org/show_bug.cgi?id=179459

Reviewed by Tim Horton.

Many of these should have been removed from previous commits, but they were missed.
None of these enums or methods are being used by WebKit anymore, and removing them will keep things
clean and allow UIKit to remove things that are not used at all by anyone anymore.

* Platform/spi/ios/UIKitSPI.h:

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

2 years agoCachedResourceLoader::requestRawResource should not assert when destination is set...
commit-queue@webkit.org [Thu, 9 Nov 2017 19:13:36 +0000 (19:13 +0000)]
CachedResourceLoader::requestRawResource should not assert when destination is set in the context of a service worker
https://bugs.webkit.org/show_bug.cgi?id=179491

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

No change of behavior.
requestRawResource on web page should have the destination set as the empty string as per fetch spec.
In the context of a service worker, requestRawResource may be used with any destination.
Updating assertion accordingly.

* loader/cache/CachedResourceLoader.cpp:
(WebCore::CachedResourceLoader::requestRawResource):

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

2 years agoResourceErrorBase::setType should not ASSERT if it is a no op
commit-queue@webkit.org [Thu, 9 Nov 2017 19:00:59 +0000 (19:00 +0000)]
ResourceErrorBase::setType should not ASSERT if it is a no op
https://bugs.webkit.org/show_bug.cgi?id=179490

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

No change of behavior.

* platform/network/ResourceErrorBase.cpp:
(WebCore::ResourceErrorBase::setType):

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

2 years ago[LayoutState cleanup] Remove renderer data members from state maintainers.
zalan@apple.com [Thu, 9 Nov 2017 18:50:03 +0000 (18:50 +0000)]
[LayoutState cleanup] Remove renderer data members from state maintainers.
https://bugs.webkit.org/show_bug.cgi?id=179483
<rdar://problem/35442548>

Reviewed by Darin Adler.

Although layout is not supposed to mutate the tree anymore, it's safer to use LayoutContext instead.

No change in functionality.

* page/LayoutContext.cpp:
* page/LayoutContext.h:
* rendering/LayoutState.cpp:
(WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
(WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
(WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
(WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
* rendering/LayoutState.h:

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

2 years agoRemove support for iOS-only softbank-sjis encoding if possible
mjs@apple.com [Thu, 9 Nov 2017 18:37:09 +0000 (18:37 +0000)]
Remove support for iOS-only softbank-sjis encoding if possible
https://bugs.webkit.org/show_bug.cgi?id=179416

Reviewed by Darin Adler.

Source/WebCore:

* platform/text/TextCodecICU.cpp:
(WebCore::TextCodecICU::registerEncodingNames): Remove support for softbank-sjis
codec, because by code inspection it couldn't have possibly worked.
(WebCore::TextCodecICU::registerCodecs): Ditto.

LayoutTests:

* fast/encoding/charset-softbank-sjis.html: Added. Test that <meta charset>
declaration for softbank-sjis is ignored.
* fast/encoding/charset-softbank-sjis-expected.txt: Added.
* fast/encoding/resources/softbank-sjis-iframe.html: Added. Helper for above test.
* fast/encoding/legacy-ios-encodings.html: Add a case for softbank-sjis.
* fast/encoding/legacy-ios-encodings-expected.txt: Result for above.

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

2 years agoUse enum classes within FileSystem
commit-queue@webkit.org [Thu, 9 Nov 2017 18:33:34 +0000 (18:33 +0000)]
Use enum classes within FileSystem
https://bugs.webkit.org/show_bug.cgi?id=175172

Patch by Christopher Reid <chris.reid@sony.com> on 2017-11-09
Reviewed by Darin Adler.

Source/WebCore:

No new tests, no change in behavior.

Further cleanup to FileSystem's enum classes.
Shortening FileSystem's enum names now that they are enum classes.
Adding OptionSet<FileLockMode> to functions using the FileLockMode enum.

* Modules/webdatabase/OriginLock.cpp:
* loader/appcache/ApplicationCacheStorage.cpp:
* platform/FileHandle.h:
* platform/FileStream.cpp:
* platform/FileSystem.cpp:
* platform/FileSystem.h:
* platform/cocoa/FileMonitorCocoa.mm:
* platform/glib/FileSystemGlib.cpp:
* platform/network/curl/CurlCacheEntry.cpp:
* platform/network/curl/CurlCacheManager.cpp:
* platform/posix/FileSystemPOSIX.cpp:
* platform/win/FileSystemWin.cpp:
* rendering/RenderThemeWin.cpp:

Source/WebKit:

* NetworkProcess/Downloads/BlobDownloadClient.cpp:
* NetworkProcess/NetworkDataTaskBlob.cpp:
* NetworkProcess/cache/NetworkCache.cpp:
* NetworkProcess/capture/NetworkCaptureManager.cpp:
* NetworkProcess/capture/NetworkCaptureRecorder.cpp:
* Shared/WebMemorySampler.cpp:
* UIProcess/API/APIContentRuleListStore.cpp:
* UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:

Source/WebKitLegacy/win:

* Plugins/PluginDatabase.cpp:

Tools:

* TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
* TestWebKitAPI/Tests/WebCore/cocoa/DatabaseTrackerTest.mm:

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

2 years agoWeb Inspector: Make domain availability a list of types instead of a single type
commit-queue@webkit.org [Thu, 9 Nov 2017 18:32:26 +0000 (18:32 +0000)]
Web Inspector: Make domain availability a list of types instead of a single type
https://bugs.webkit.org/show_bug.cgi?id=179457

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

Source/JavaScriptCore:

* inspector/scripts/codegen/generate_js_backend_commands.py:
(JSBackendCommandsGenerator.generate_domain):
Update output of `InspectorBackend.activateDomain` to include the list.

* inspector/scripts/codegen/models.py:
(Protocol.parse_domain):
Parse `availability` as a list and include a new supported value of "service-worker".

* inspector/protocol/ApplicationCache.json:
* inspector/protocol/CSS.json:
* inspector/protocol/Canvas.json:
* inspector/protocol/DOM.json:
* inspector/protocol/DOMDebugger.json:
* inspector/protocol/DOMStorage.json:
* inspector/protocol/Database.json:
* inspector/protocol/IndexedDB.json:
* inspector/protocol/LayerTree.json:
* inspector/protocol/Memory.json:
* inspector/protocol/Network.json:
* inspector/protocol/Page.json:
* inspector/protocol/Timeline.json:
* inspector/protocol/Worker.json:
Update `availability` to be a list.

* inspector/scripts/tests/generic/domain-availability.json:
* inspector/scripts/tests/generic/expected/domain-availability.json-result:
* inspector/scripts/tests/generic/expected/fail-on-domain-availability-type.json-error: Added.
* inspector/scripts/tests/generic/expected/fail-on-domain-availability-value.json-error: Added.
* inspector/scripts/tests/generic/expected/fail-on-domain-availability.json-error:
* inspector/scripts/tests/generic/fail-on-domain-availability-type.json: Copied from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-availability.json.
* inspector/scripts/tests/generic/fail-on-domain-availability-value.json: Renamed from Source/JavaScriptCore/inspector/scripts/tests/generic/fail-on-domain-availability.json.
Update tests to include a test for the type and an invalid value.

Source/WebInspectorUI:

* UserInterface/Protocol/InspectorBackend.js:
(InspectorBackendClass.prototype.activateDomain):
The second value changed to be an optional list. Check if the active
debuggable type is in the list or not.

* UserInterface/Protocol/Legacy/10.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/10.3/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/11.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/8.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/9.0/InspectorBackendCommands.js:
* UserInterface/Protocol/Legacy/9.3/InspectorBackendCommands.js:
* Versions/Inspector-iOS-10.0.json:
* Versions/Inspector-iOS-10.3.json:
* Versions/Inspector-iOS-11.0.json:
* Versions/Inspector-iOS-8.0.json:
* Versions/Inspector-iOS-9.0.json:
* Versions/Inspector-iOS-9.3.json:
Since this is a change to how we generate the frontend resource,
update the legacy versioned backends and regenerate their resource.

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

2 years agoServiceWorkerClientFetch should create not null ResourceError
commit-queue@webkit.org [Thu, 9 Nov 2017 18:24:21 +0000 (18:24 +0000)]
ServiceWorkerClientFetch should create not null ResourceError
https://bugs.webkit.org/show_bug.cgi?id=179485

Patch by Youenn Fablet <youenn@apple.com> on 2017-11-09
Reviewed by Darin Adler.

* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::didReceiveResponse):

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

2 years ago[LayoutState cleanup] LayouState::m_lineGrid should be a weak pointer
zalan@apple.com [Thu, 9 Nov 2017 18:21:58 +0000 (18:21 +0000)]
[LayoutState cleanup] LayouState::m_lineGrid should be a weak pointer
https://bugs.webkit.org/show_bug.cgi?id=179484
<rdar://problem/35442725>

Reviewed by Darin Adler.

Covered by existing tests.

* rendering/LayoutState.cpp:
(WebCore::LayoutState::propagateLineGridInfo):
(WebCore::LayoutState::establishLineGrid):
* rendering/LayoutState.h:
(WebCore::LayoutState::lineGrid const):

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