JSDOMWindow should not claim HasImpureGetOwnPropertySlot
https://bugs.webkit.org/show_bug.cgi?id=132918

Reviewed by Geoffrey Garen.


Source/JavaScriptCore: 
* jit/Repatch.cpp:
(JSC::tryRepatchIn): We forgot to check for watchpoints when repatching "in".

Source/WebCore: 
Tests: js/cached-window-properties.html
       js/cached-window-prototype-properties.html

We now correctly handle the impurity of JSDOMWindow's custom getOwnPropertySlot without needing the 
blanket HasImpureGetOwnPropertySlot. We do this through the use of watchpoints and by explicitly forbidding
any caching beyond a certain point using PropertySlot::disableCaching. Getting rid of this flag will allow 
us to cache many properties/methods on both the JSDOMWindow and its prototype, which are very commonly used 
across the web.

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot):
* bindings/scripts/CodeGeneratorJS.pm:
(HasComplexGetOwnProperty):
(InterfaceRequiresAttributesOnInstance):
(InstanceOverridesGetOwnPropertySlot):
(GenerateHeader):

LayoutTests: 
We now correctly handle the impurity of JSDOMWindow's custom getOwnPropertySlot without needing the 
blanket HasImpureGetOwnPropertySlot. We do this through the use of watchpoints and by explicitly forbidding
any caching beyond a certain point using PropertySlot::disableCaching. Getting rid of this flag will allow 
us to cache many properties/methods on both the JSDOMWindow and its prototype, which are very commonly used 
across the web.

These tests trigger inline caching of window and window prototype properties.

* js/cached-window-properties-expected.txt: Added.
* js/cached-window-properties.html: Added.
* js/cached-window-prototype-properties-expected.txt: Added.
* js/cached-window-prototype-properties.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
SVG element may reference arbitrary DOM element before running its insertion logic
https://bugs.webkit.org/show_bug.cgi?id=132757
<rdar://problem/15703817>

Reviewed by Ryosuke Niwa.

Source/WebCore:
Fixes an issue where an SVG element may reference an arbitrary DOM element e before e finished being
inserted in the tree.

Currently when an SVG element A is inserted into a document we use document.getElementById() to find the
element B it references (if any). If A is inserted before B and B has the same id as a later element in
the document then A can find B before B is notified that its been inserted into the document (i.e. before
Element::insertedFrom() is called on B). Instead, A should call document.getElementById() only after
cessation of the insertion operation that inserted it to ensure that all inserted nodes (including B)
processed their insertion-specific logic.

Tests: svg/custom/reparent-animate-element.html
       svg/custom/reparent-feimage-element.html
       svg/custom/reparent-mpath-element.html
       svg/custom/reparent-textpath-element.html
       svg/custom/reparent-tref-element.html
       svg/custom/reparent-use-element.html

* svg/SVGFEImageElement.cpp:
(WebCore::SVGFEImageElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
we are called back to resolve our target element (i.e. call SVGFEImageElement::buildPendingResources())
after the subtree we're in is inserted.
(WebCore::SVGFEImageElement::didNotifySubtreeInsertions): Added; turns around and calls SVGFEImageElement::buildPendingResources().
* svg/SVGFEImageElement.h:
* svg/SVGMPathElement.cpp:
(WebCore::SVGMPathElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
we are called back to resolve our target element (i.e. call SVGMPathElement::buildPendingResources())
after the subtree we're in is inserted.
(WebCore::SVGMPathElement::didNotifySubtreeInsertions): Added; turns around and calls SVGMPathElement::buildPendingResources().
* svg/SVGMPathElement.h:
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
we are called back to resolve our target element (i.e. call SVGTRefElement::buildPendingResources())
after the subtree we're in is inserted.
(WebCore::SVGTRefElement::didNotifySubtreeInsertions): Added; turns around and calls SVGTRefElement::buildPendingResources().
* svg/SVGTRefElement.h:
* svg/SVGTextPathElement.cpp:
(WebCore::SVGTextPathElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
we are called back to resolve our target element (i.e. call SVGTextPathElement::buildPendingResources())
after the subtree we're in is inserted.
(WebCore::SVGTextPathElement::didNotifySubtreeInsertions): Added; turns around and calls SVGTextPathElement::buildPendingResources().
* svg/SVGTextPathElement.h:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
we are called back to resolve our target element (i.e. call SVGUseElement::buildPendingResources()) after its subtree is
inserted.
(WebCore::SVGUseElement::didNotifySubtreeInsertions): Added; turns around and calls SVGUseElement::buildPendingResources().
* svg/SVGUseElement.h:
* svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::insertedInto): Return InsertionShouldCallDidNotifySubtreeInsertions so that
we are called back to resolve our target element (i.e. call SVGSMILElement::buildPendingResources())
after the subtree we're in is inserted.
(WebCore::SVGSMILElement::didNotifySubtreeInsertions): Added; turns around and calls SVGSMILElement::buildPendingResources().
* svg/animation/SVGSMILElement.h:

LayoutTests:
Add tests to ensure that we don't cause an assertion failure when re-parenting an SVG subtree that
contains an element with a duplicate id.

* svg/custom/reparent-animate-element-expected.txt: Added.
* svg/custom/reparent-animate-element.html: Added.
* svg/custom/reparent-feimage-element-expected.txt: Added.
* svg/custom/reparent-feimage-element.html: Added.
* svg/custom/reparent-mpath-element-expected.txt: Added.
* svg/custom/reparent-mpath-element.html: Added.
* svg/custom/reparent-textpath-element-expected.txt: Added.
* svg/custom/reparent-textpath-element.html: Added.
* svg/custom/reparent-tref-element-expected.txt: Added.
* svg/custom/reparent-tref-element.html: Added.
* svg/custom/reparent-use-element-expected.txt: Added.
* svg/custom/reparent-use-element.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168915 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] www.wikipedia.org is loading much slower due to FormClient::willBeginInputSession
https://bugs.webkit.org/show_bug.cgi?id=132974

Reviewed by Enrica Casucci.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::elementDidFocus): Don’t call FormClient::willBeginInputSession if the
focus isn’t user-initiated, because in that case the UI process will bail out of
-_startAssistingNode:userIsInteracting:userObject: before creating an input session and
calling the -_webView:didStartInputSession:.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fixed a typo in a comment and updated previous change log entry.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::elementDidFocus):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@168917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
<https://webkit.org/b/132976> Move discovery of sharing services off the main thread

Discovery of sharing services can require disk access and IPC. Since the interface to
ServicesController is already asynchronous, we can easily perform the discovery on a
background queue. This can eliminate tens to hundreds of milliseconds worth of work
from the main thread when creating the first web process.

Reviewed by Brady Eidson.

* UIProcess/mac/ServicesController.h:
* UIProcess/mac/ServicesController.mm:
(WebKit::ServicesController::ServicesController):
(WebKit::ServicesController::refreshExistingServices): Bail out early if we're already
in the process of refreshing the services. Kick the discovery over to a background queue,
with it hopping back to the main queue to update the actual state and notify any contexts
that were interested.

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