Web Inspector: standardize language-specific protocol generator file, class, and method prefixes
https://bugs.webkit.org/show_bug.cgi?id=138237

Reviewed by Joseph Pecoraro.

Settle on cpp/objc/js file prefixes and Cpp/ObjC/JS class prefixes for generators.
Move C++-specific static methods into CppGenerator and add cpp_ prefixes where relevant.
Split the templates file into language-specific template files.

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* inspector/scripts/codegen/__init__.py:
* inspector/scripts/codegen/cpp_generator.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generator.py.
* inspector/scripts/codegen/cpp_generator_templates.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py.
(CppGeneratorTemplates):
* inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py.
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_backend_dispatcher_header.py.
* inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_backend_dispatcher_implementation.py.
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_frontend_dispatcher_header.py.
* inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_frontend_dispatcher_implementation.py.
* inspector/scripts/codegen/generate_cpp_protocol_types_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_protocol_types_header.py.
* inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_protocol_types_implementation.py.
* inspector/scripts/codegen/generate_js_backend_commands.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_backend_commands.py.
* inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_backend_dispatcher_header.py.
* inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_backend_dispatcher_implementation.py.
* inspector/scripts/codegen/generate_objc_configuration_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_configuration_header.py.
* inspector/scripts/codegen/generate_objc_configuration_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_configuration_implementation.py.
* inspector/scripts/codegen/generate_objc_conversion_helpers.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_conversion_helpers.py.
* inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_frontend_dispatcher_implementation.py.
* inspector/scripts/codegen/generate_objc_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_header.py.
* inspector/scripts/codegen/generate_objc_internal_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_internal_header.py.
* inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_types_implementation.py.
* inspector/scripts/codegen/generator.py:
* inspector/scripts/codegen/generator_templates.py:
* inspector/scripts/codegen/objc_generator.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c.py.
* inspector/scripts/codegen/objc_generator_templates.py: Added.
* inspector/scripts/generate-inspector-protocol-bindings.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add layout test for DOM timer throttling and element moving into view after layout
https://bugs.webkit.org/show_bug.cgi?id=138874

Reviewed by Simon Fraser.

Add a layout test to make sure we unthrottle a DOM timer changing the
style of an element outside viewport if the element ends up inside
the viewport after layout.

* fast/dom/timer-unthrottle-on-layout-expected.txt: Added.
* fast/dom/timer-unthrottle-on-layout.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Get rid of AccessibilityObject::setRoleValue()
https://bugs.webkit.org/show_bug.cgi?id=138861

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-11-19
Reviewed by Chris Fleizach.

* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::setRoleValue): Deleted.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176331 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add layout test for throttling of DOM timer changing the style of visible and invisible elements
https://bugs.webkit.org/show_bug.cgi?id=138875

Reviewed by Simon Fraser.

Add a layout test to test that a repeating DOM timer changing the style
of both visible and invisible elements does not get throttled.

Also rename existing tests to use "display-none" instead of "invisible"
for clarity.

* fast/dom/nested-timer-display-none-element-throttling-expected.txt: Renamed from LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt.
* fast/dom/nested-timer-display-none-element-throttling.html: Renamed from LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html.
* fast/dom/repeating-timer-display-none-element-throttling-expected.txt: Renamed from LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt.
* fast/dom/repeating-timer-display-none-element-throttling.html: Renamed from LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html.
* fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling-expected.txt: Added.
* fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176333 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2 UI-side Compositing] Fix the position and scroll indicator of the UI-side tiled scrolling indicator
https://bugs.webkit.org/show_bug.cgi?id=138876

Reviewed by Beth Dakin.

Fix the position of the tiled scrolling indicator in MiniBrowser by taking top
content offset into account.

On Mac, pass the current scroll position back to the UI process via the RemoteLayerTreeTransaction
so that we can use it to show the correctly scroll offset in the indicator. This is temporary until
Mac does UI-side scrolling.

* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::scrollPosition):
(WebKit::RemoteLayerTreeTransaction::setScrollPosition):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::willCommitLayerTree):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed build fixes after r176329.

  - export all of the codegen python files as they are included by the main generator
  - update the imports of the main generator to match __init__.py
  - remove bundling the python scripts as framework resources, just have them PrivateHeaders

* JavaScriptCore.xcodeproj/project.pbxproj:
* inspector/scripts/generate-inspector-protocol-bindings.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176335 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refactor iOS selection gestures.
https://bugs.webkit.org/show_bug.cgi?id=138720
rdar://problem/18964359

Reviewed by Benjamin Poulain.

This is a first step towards refactoring the selection gestures code.
It introduces more general selection movement functions that can be used to build
the gestures.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(toWKTextGranularity):
(toWKSelectionDirection):
(-[WKContentView selectPositionAtPoint:completionHandler:]):
(-[WKContentView selectPositionAtBoundary:inDirection:fromPoint:completionHandler:]):
(-[WKContentView selectTextWithGranularity:atPoint:completionHandler:]):
(-[WKContentView beginSelectionInDirection:completionHandler:]):
(-[WKContentView updateSelectionWithExtentPoint:completionHandler:]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::selectTextWithGranularityAtPoint):
(WebKit::WebPageProxy::selectPositionAtBoundaryWithDirection):
(WebKit::WebPageProxy::selectPositionAtPoint):
(WebKit::WebPageProxy::beginSelectionInDirection):
(WebKit::WebPageProxy::updateSelectionWithExtentPoint):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::selectWithGesture):
(WebKit::WebPage::visiblePositionInFocusedNodeForPoint):
(WebKit::WebPage::selectPositionAtPoint):
(WebKit::WebPage::selectPositionAtBoundaryWithDirection):
(WebKit::WebPage::selectTextWithGranularityAtPoint):
(WebKit::WebPage::beginSelectionInDirection):
(WebKit::WebPage::updateSelectionWithExtentPoint):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[WK2 UI-side compositing] Initialize RemoteLayerTreeTransaction properties which are unset on Mac
https://bugs.webkit.org/show_bug.cgi?id=138877

Reviewed by Tim Horton.

These data members are unused on Mac, but still encoded, so initialize them with
reasonable values.

* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::RemoteLayerTreeTransaction):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176339 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Add APIs for customizing the user agent
https://bugs.webkit.org/show_bug.cgi?id=138881
rdar://problem/17233981

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView customUserAgent]):
(-[WKWebView setCustomUserAgent:]):
(-[WKWebView _customUserAgent]):
(-[WKWebView _setCustomUserAgent:]):
* UIProcess/API/Cocoa/WKWebViewConfiguration.h:
* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(LazyInitialized::set):
(-[WKWebViewConfiguration copyWithZone:]):
(defaultApplicationNameForUserAgent):
(-[WKWebViewConfiguration applicationNameForUserAgent]):
(-[WKWebViewConfiguration setApplicationNameForUserAgent:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176340 268f45cc-cd09-0410-ab3c-d52691b4dbfc
AX: Screen braille input doesn't work on forms.
https://bugs.webkit.org/show_bug.cgi?id=138804

Unreviewed build fix.

* DumpRenderTree/AccessibilityUIElement.cpp:
(AccessibilityUIElement::setValue):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[iOS] Make WebKit build with public iOS SDK
https://bugs.webkit.org/show_bug.cgi?id=136863

Reviewed by David Kilzer.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj: Add private headers CFNetworkSPI.h and
NS{CalendarDate, String, URLDownload}SPI.h.
* loader/cocoa/DiskCacheMonitorCocoa.mm: Move forward declaration of
CFNetwork data types and functions from here to file CFNetworkSPI.h and
include header CFNetworkSPI.h.
* platform/network/mac/ResourceHandleMac.mm: Substitute CFNetworkSPI.h for
CFURLRequestSPI.h as the content of the latter was incorporated into the former.
* platform/spi/cf/CFNetworkSPI.h: Added.
* platform/spi/cf/CFURLRequestSPI.h: Removed; incorporated its functionality
into CFNetworkSPI.h
* platform/spi/cocoa/NSCalendarDateSPI.h: Added.
* platform/spi/cocoa/NSStringSPI.h: Added.
* platform/spi/cocoa/NSURLDownloadSPI.h: Added.

Source/WebKit/ios:

* Misc/WebGeolocationCoreLocationProvider.mm:  Remove unnecessary include of header <CoreLocation/CoreLocationPriv.h>.
* Misc/WebNSStringExtrasIOS.m: Substitute header <WebCore/NSStringSPI.h> for <Foundation/NSString_NSURLExtras.h>.
* Misc/WebUIKitSupport.mm: Remove unnecessary include of header CoreFoundation/CFPriv.h.

Source/WebKit/mac:

* History/WebHistory.mm: Include header NSCalendarDateSPI.h.
* History/WebHistoryItemPrivate.h: Remove include of private header Foundation/NSCalendarDate.h.
* Misc/WebDownload.h: Forward declare NSURLDownload when building without header Foundation/NSURLDownload.h.
We use __has_include() instead of WTF_USE_APPLE_INTERNAL_SDK since this header
may be used by Apple internal clients that do not include wtf/Platform.h.
* Misc/WebDownload.mm: Include header NSURLDownloadSPI.h instead of including
private Foundation headers directly.
* Misc/WebNSURLExtras.mm: Remove unnecessary include of private Foundation header.
* WebCoreSupport/WebFrameNetworkingContext.mm: Include header CFNetworkSPI.h
instead of including private CFNetwork headers directly. Also fixed up style and
ordering of header include directives.
* WebView/WebView.mm: Include header CFNetworkSPI.h instead of including private
CFNetwork headers directly. Also sort the #import directives.
* WebView/WebViewPrivate.h: Define ENABLE_TOUCH_EVENTS if not otherwise defined
and added ENABLE_TOUCH_EVENTS-guard around -_touchEventRegions.

Source/WebKit2:

* NetworkProcess/cocoa/NetworkProcessCocoa.mm: Moved CFNetwork forward declarations
from this file to file CFNetworkSPI.h and included header CFNetworkSPI.h.
* NetworkProcess/mac/NetworkDiskCacheMonitor.mm: Ditto.
* NetworkProcess/mac/NetworkResourceLoaderMac.mm: Ditto.
* UIProcess/API/Cocoa/WKProcessPool.mm: Ditto.
* UIProcess/mac/WebContextMac.mm: Ditto.
* WebProcess/cocoa/WebProcessCocoa.mm: Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176347 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix TilesAdded bitmask
https://bugs.webkit.org/show_bug.cgi?id=138883

Reviewed by Simon Fraser.

Simon spotted this.

* platform/graphics/ca/GraphicsLayerCA.h:

    Use 1LLU << 29 instead of 1LLU < 29
    This worked before by pure luck as bit 0 is unused.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176348 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Attempt to fix the Apple Internal Mountain Lion build after <https://trac.webkit.org/changeset/176347>
(https://bugs.webkit.org/show_bug.cgi?id=136863)

Only import header CFNSURLConnection.h when building for iOS or OS X Yosemite.

* platform/spi/cf/CFNetworkSPI.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Take Web Audio into account for the Page::isPlayingAudio() API.
https://bugs.webkit.org/show_bug.cgi?id=137464

Reviewed by Jer Noble.

Source/WebCore:

Make AudioContext a subclass of AudioProducer. It figures out whether there's
audio playing by checking whether its AudioDestinationNode is playing (and not
silent). It calls Document::updateIsPlayingAudio() whenever its audio playing
state has changed.

Test: webaudio/web-audio-is-playing.html

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::lazyInitialize):
Add itself to the Document's list of AudioProducers if it's not an offline
audio context.
(WebCore::AudioContext::uninitialize):
Remove itself from the Document's list of AudioProducers if it's not an offline
audio context.
(WebCore::AudioContext::stop):
Tell the document to update its audio playing state.
(WebCore::AudioContext::isPlayingAudio):
Return true if the audio context hasn't been stopped and its destination node is
playing audio.
(WebCore::AudioContext::pageMutedStateDidChange):
Add a FIXME for now.
(WebCore::AudioContext::isPlayingAudioDidChange):
Call Document::updateIsPlayingAudio().
* Modules/webaudio/AudioContext.h:

* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::AudioDestinationNode):
Initialize m_isSilent and m_isEffectivelyPlayingAudio.
(WebCore::AudioDestinationNode::render):
Call setIsSilent() with the appropriate value after rendering.
(WebCore::AudioDestinationNode::isPlayingDidChange):
Call updateIsEffectivelyPlayingAudio().
(WebCore::AudioDestinationNode::setIsSilent):
If m_isSilent has changed, call updateIsEffectivelyPlayingAudio().
(WebCore::AudioDestinationNode::updateIsEffectivelyPlayingAudio):
If m_isEffectivelyPlayingAudio has changed, call AudioContext::isPlayingAudioDidChange().
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::isPlaying):
(WebCore::AudioDestinationNode::isPlayingAudio):

* Modules/webaudio/DefaultAudioDestinationNode.cpp:
(WebCore::DefaultAudioDestinationNode::isPlaying):
Return whether the AudioDestination is playing.
* Modules/webaudio/DefaultAudioDestinationNode.h:

* platform/audio/AudioIOCallback.h:
* platform/audio/ios/AudioDestinationIOS.cpp:
(WebCore::AudioDestinationIOS::start):
Call setIsPlaying() instead.
(WebCore::AudioDestinationIOS::stop):
Ditto.
(WebCore::AudioDestinationIOS::setIsPlaying):
If m_isPlaying has changed, call AudioIOCallback::isPlayingDidChange().
* platform/audio/ios/AudioDestinationIOS.h:

* platform/audio/mac/AudioDestinationMac.cpp:
(WebCore::AudioDestinationMac::start):
Call setIsPlaying() instead.
(WebCore::AudioDestinationMac::stop):
Ditto.
(WebCore::AudioDestinationMac::setIsPlaying):
If m_isPlaying has changed, call AudioIOCallback::isPlayingDidChange().
* platform/audio/mac/AudioDestinationMac.h:

* testing/Internals.cpp:
(WebCore::Internals::isPagePlayingAudio):
* testing/Internals.h:
* testing/Internals.idl:
Add internals.isPagePlayingAudio() for testing.

LayoutTests:

This test checks that Page::isPlayingAudio() returns false before an audio context is created
and before the oscillator node makes a sound. It then starts the oscillator node and checks
that Page::isPlayingAudio() later returns true.

* webaudio/web-audio-is-playing-expected.txt: Added.
* webaudio/web-audio-is-playing.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176350 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Data detected results with no menu items should not fall through to regular text 
action menus
https://bugs.webkit.org/show_bug.cgi?id=138887
-and corresponding-
rdar://problem/18971616

Reviewed by Tim Horton.

Source/WebKit/mac:

* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _defaultMenuItems]):

Source/WebKit2:

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _defaultMenuItems]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176351 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename two Cocoa-only .cpp files to .mm.

Rubber-stamped by Sam Weinig.

* Shared/APIWebArchive.mm: Renamed from Source/WebKit2/Shared/APIWebArchive.cpp.
* Shared/APIWebArchiveResource.mm: Renamed from Source/WebKit2/Shared/APIWebArchiveResource.cpp.
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176352 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Images/replaced elements that are as tall as a page should be on their own page
https://bugs.webkit.org/show_bug.cgi?id=138886 - <rdar://problem/18296371>

Reviewed by Dean Jackson.

Source/WebCore:

Added fast/multicol/tall-image-behavior.html (and RL/LR variants)

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::computeReplacedAndTextLineTopAndBottom):
* rendering/InlineFlowBox.h:
Add a new method that computes the line top and line bottom ignoring all margins,
overflow and line-height. This allows us to see if a line that is taller than a page
can be made to fit if we ignored margins and unused descent.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustLinePositionForPagination):
Call the new helper function, computeReplacedAndTextLineTopAndBottom and push
to a new page if we see that we can fit on a page by ourselves without blank space
included.

LayoutTests:

* fast/multicol/tall-image-behavior-lr.html: Added.
* fast/multicol/tall-image-behavior-rl.html: Added.
* fast/multicol/tall-image-behavior.html: Added.
* platform/mac/fast/multicol/tall-image-behavior-expected.png: Added.
* platform/mac/fast/multicol/tall-image-behavior-expected.txt: Added.
* platform/mac/fast/multicol/tall-image-behavior-lr-expected.png: Added.
* platform/mac/fast/multicol/tall-image-behavior-lr-expected.txt: Added.
* platform/mac/fast/multicol/tall-image-behavior-rl-expected.png: Added.
* platform/mac/fast/multicol/tall-image-behavior-rl-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Fix iOS build.

* UIProcess/API/Cocoa/WKWebViewConfiguration.mm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Invoking an action menu on a selection should result in the text menu
https://bugs.webkit.org/show_bug.cgi?id=138892
-and corresponding-
rdar://problem/18996776

Reviewed by Tim Horton.

Source/WebKit/mac:

* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _defaultMenuItems]):

Source/WebKit2:

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _defaultMenuItems]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176356 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Provide $exception in the console for the thrown exception value
https://bugs.webkit.org/show_bug.cgi?id=138726

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* debugger/DebuggerScope.cpp:
(JSC::DebuggerScope::caughtValue):
* debugger/DebuggerScope.h:
Access the caught value if this scope is a catch scope.

* runtime/JSNameScope.h:
(JSC::JSNameScope::isFunctionNameScope):
(JSC::JSNameScope::isCatchScope):
(JSC::JSNameScope::value):
Provide an accessor for the single value in the JSNameScope (with / catch block).

* inspector/InjectedScriptSource.js:
Save the exception value and expose it via $exception. Since the command line api
is recreated on each evaluation, $exception is essentially readonly.

* inspector/ScriptDebugServer.h:
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::dispatchDidPause):
(Inspector::ScriptDebugServer::exceptionOrCaughtValue):
When pausing, get the exception or caught value. The exception will be provided
if we are breaking on an explicit exception. When inside of a catch block, we
can get the caught value by walking up the scope chain.

* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
(Inspector::InspectorDebuggerAgent::resume):
(Inspector::InspectorDebuggerAgent::stepOver):
(Inspector::InspectorDebuggerAgent::stepInto):
(Inspector::InspectorDebuggerAgent::stepOut):
Clearing state can be done in didContinue.

(Inspector::InspectorDebuggerAgent::didPause):
Set the exception value explicitly in the injected script when we have it.

(Inspector::InspectorDebuggerAgent::didContinue):
Clear state saved when we had paused, including clearly an exception value if needed.

(Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
(Inspector::InspectorDebuggerAgent::clearExceptionValue):
Call into the injected script only when needed.

* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::setExceptionValue):
(Inspector::InjectedScript::clearExceptionValue):
* inspector/InjectedScript.h:
* inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::clearExceptionValue):
* inspector/InjectedScriptManager.h:
Clear on all injected scripts.

Source/WebCore:

Tests: inspector/debugger/command-line-api-exception-nested-catch.html
       inspector/debugger/command-line-api-exception.html

* inspector/CommandLineAPIModuleSource.js:
Expose $exception in the more complete command line API.

Source/WebInspectorUI:

* UserInterface/Base/Test.js:
(WebInspector.loaded):
In order to use RuntimeManager to execute in the global context or on the
active debugger call frame, we need to expose the quickConsole controller.

* UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
Expose $exception to completion when we paused because of an exception.

LayoutTests:

Provide some tests to ensure $exception is the value we expect at different times,
such as on the exception line, when there is no exception, or when stepping through
catch blocks (it should always be the most recent caught exception).

* inspector/debugger/command-line-api-exception-expected.txt: Added.
* inspector/debugger/command-line-api-exception-nested-catch-expected.txt: Added.
* inspector/debugger/command-line-api-exception-nested-catch.html: Added.
* inspector/debugger/command-line-api-exception.html: Added.
* inspector/debugger/resources/exceptions.js: Added.
(triggerUncaughtTypeException):
(triggerUncaughtReferenceException):
(triggerUncaughtSyntaxException):
(triggerUncaughtDOMException):
(throwString):
(throwNumber):
(throwNull):
(throwObject):
(throwNode):
(catcher):
(nestedCatchBlocks):

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