Don't allow app sandboxed apps without the network client entitlement to launch the network process
https://bugs.webkit.org/show_bug.cgi?id=131868
<rdar://problem/12354188>

Reviewed by Dan Bernstein.

* NetworkProcess/EntryPoint/mac/XPCService/NetworkServiceEntryPoint.mm:
(WebKit::NetworkServiceInitializerDelegate::NetworkServiceInitializerDelegate):
Add a new delegate that implements checkEntitlements().

(NetworkServiceInitializer):
Pass the new delegate to XPCServiceInitializer.

* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.h:
* Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
Call checkEntitlements.

(WebKit::XPCServiceInitializerDelegate::checkEntitlements):
Return true.

(WebKit::XPCServiceInitializerDelegate::hasEntitlement):
Helper function that returns whether a client has the given entitlement.

(WebKit::XPCServiceInitializerDelegate::isClientSandboxed):
Helper function that checks whether the client is sandboxed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Move DOM throttling out of the page throttler
<rdar://problem/16473004>
https://bugs.webkit.org/show_bug.cgi?id=131697

Reviewed by Gavin Barraclough.

No new tests since it's not web exposed.

DOM timer throttling is currently part of the page throttler which uses per process
state and per page state to determine when to throttle.  This led us to being overly
conservative when turning DOM throttling off.  It should only respond to view state changes.

Additionally since creating extra page throttlers SVG images caused bugs
in tracking state we'll reserve the page throttler for WebKit2 views.  To avoid regressing
WebKit1 we should move DOM timer throttling back to the page.

* page/Page.cpp:
(WebCore::Page::Page): set DOM timer throttling.
(WebCore::Page::setIsVisuallyIdleInternal): ditto.
(WebCore::Page::hiddenPageDOMTimerThrottlingStateChanged): ditto.
(WebCore::Page::setIsVisible): Update view state masks for WebKit1 to include IsVisibleOrOccluded and IsVisuallyIdle
* page/Page.h:
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler): remove DOM timer throttling.
(WebCore::PageThrottler::started): ditto.
(WebCore::PageThrottler::stopped): ditto.
(WebCore::PageThrottler::hiddenPageDOMTimerThrottlingStateChanged): Deleted.
* page/PageThrottler.h:
* page/Settings.cpp:
(WebCore::Settings::setHiddenPageDOMTimerThrottlingEnabled):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167522 268f45cc-cd09-0410-ab3c-d52691b4dbfc
We shouldn’t create page throttlers for other pages than WebKit2 pages.

Source/WebCore:
Part of <rdar://problem/16473045> Visibility state counters are often incorrect
https://bugs.webkit.org/show_bug.cgi?id=131696

Reviewed by Gavin Barraclough.

No new test since not web exposed.

Page throttlers were being created for SVG images and other page instances that
were not accurately tracking the states that enable and disable page throttling.
Make the throttler an unique ptr and only initialize it for WebKit2.

This also fixes an inefficiency where we would throttle a new page on creation because
we assumed it was visible even if that was not the case.

* WebCore.exp.in:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute): Check page throttler exists.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::started): ditto
* page/Page.cpp:
(WebCore::Page::Page): Don’t automatically create page throttler.
(WebCore::Page::createPageThrottler): Create page throttler.
(WebCore::Page::setViewState): Check page throttler exists.
* page/Page.h:
(WebCore::Page::pageThrottler): Make the page throttler a unique ptr.
* page/PageThrottler.h:
* page/Settings.cpp:
(WebCore::Settings::setHiddenPageDOMTimerThrottlingEnabled): Check page throttler exists.

Source/WebKit2:
Part of <rdar://problem/16473045> Visibility state counters are often incorrect.
https://bugs.webkit.org/show_bug.cgi?id=131696

Reviewed by Gavin Barraclough.

Page throttlers were being created for SVG images and other page instances that
were not accurately tracking the states that enable and disable page throttling.
Make the throttler an unique ptr and only initialize it for WebKit2.

This also fixes  an inefficiency where we would throttle a new page on creation because
we assumed it was visible even if that was not the case.

* WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: Check page throttler exists.
(WebKit::NPRuntimeObjectMap::evaluate):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize page throttler for WebKit2 views.
(WebKit::WebPage::mouseEvent): Check page throttler exists.
(WebKit::WebPage::wheelEvent): ditto
(WebKit::WebPage::keyEvent): ditto

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Harden RenderInline::inlineElementContinuation()

<https://bugs.webkit.org/show_bug.cgi?id=131858>

Reviewed by Sam Weinig.

No new tests, as there are no known cases of this happening.

* rendering/RenderInline.cpp:
(WebCore::RenderInline::inlineElementContinuation):
Return nullptr if the continuation is neither a RenderInline nor a
RenderBlock.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@167524 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Keep the WebPageProxy alive for the lifetime of all PageLoadState::Transaction objects
https://bugs.webkit.org/show_bug.cgi?id=131872
<rdar://problem/15758414>

Reviewed by Dan Bernstein.

* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::PageLoadState):
(WebKit::PageLoadState::Transaction::Transaction):
(WebKit::PageLoadState::Transaction::~Transaction):
* UIProcess/PageLoadState.h:
(WebKit::PageLoadState::Transaction::Transaction): Deleted.
(WebKit::PageLoadState::Transaction::~Transaction): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):

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