*/
@property(readonly, retain) JSVirtualMachine *virtualMachine;
+/*!
+@property
+@discussion Name of the JSContext. Exposed when remote debugging the context.
+*/
+@property(copy) NSString *name;
+
@end
/*!
return m_virtualMachine;
}
+- (NSString *)name
+{
+ JSStringRef name = JSGlobalContextCopyName(m_context);
+ if (!name)
+ return nil;
+
+ return [(NSString *)JSStringCopyCFString(kCFAllocatorDefault, name) autorelease];
+}
+
+- (void)setName:(NSString *)name
+{
+ JSStringRef nameJS = JSStringCreateWithCFString((CFStringRef)[name copy]);
+ JSGlobalContextSetName(m_context, nameJS);
+ JSStringRelease(nameJS);
+}
+
@end
@implementation JSContext(SubscriptSupport)
return toGlobalRef(exec->lexicalGlobalObject()->globalExec());
}
+JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx)
+{
+ if (!ctx) {
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
+
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ String name = exec->vmEntryGlobalObject()->name();
+ if (name.isNull())
+ return 0;
+
+ return OpaqueJSString::create(name).leakRef();
+}
+
+void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name)
+{
+ if (!ctx) {
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
+ ExecState* exec = toJS(ctx);
+ APIEntryShim entryShim(exec);
+
+ exec->vmEntryGlobalObject()->setName(name ? name->string() : String());
+}
+
+
class BacktraceFunctor {
public:
BacktraceFunctor(StringBuilder& builder, unsigned remainingCapacityForFrameCapture)
*/
JS_EXPORT JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) CF_AVAILABLE(10_7, 4_0);
+/*!
+@function
+@abstract Gets a copy of the name of a context.
+@param ctx The JSGlobalContext whose name you want to get.
+@result The name for ctx.
+@discussion A JSGlobalContext's name is exposed for remote debugging to make it
+easier to identify the context you would like to attach to.
+*/
+JS_EXPORT JSStringRef JSGlobalContextCopyName(JSGlobalContextRef ctx);
+
+/*!
+@function
+@abstract Sets the remote debugging name for a context.
+@param ctx The JSGlobalContext that you want to name.
+@param name The remote debugging name to set on ctx.
+*/
+JS_EXPORT void JSGlobalContextSetName(JSGlobalContextRef ctx, JSStringRef name);
+
#ifdef __cplusplus
}
#endif
"${JAVASCRIPTCORE_DIR}/ftl"
"${JAVASCRIPTCORE_DIR}/heap"
"${JAVASCRIPTCORE_DIR}/debugger"
+ "${JAVASCRIPTCORE_DIR}/inspector"
"${JAVASCRIPTCORE_DIR}/interpreter"
"${JAVASCRIPTCORE_DIR}/jit"
"${JAVASCRIPTCORE_DIR}/llint"
collector/handles
debugger
heap
+ inspector
interpreter
jit
llint
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ Move the ENABLE(REMOTE_INSPECTOR) remote debugger connection management
+ into JavaScriptCore (originally from WebKit/mac). Include enhancements:
+
+ * allow for different types of remote debuggable targets,
+ eventually at least a JSContext, WebView, WKView.
+ * allow debuggables to be registered and debugged on any thread. Unlike
+ WebViews, JSContexts may be run entirely off of the main thread.
+ * move the remote connection (XPC connection) itself off of the main thread,
+ it doesn't need to be on the main thread.
+
+ Make JSContext @class and JavaScriptCore::JSContextRef
+ "JavaScript" Remote Debuggables.
+
+ * inspector/remote/RemoteInspectorDebuggable.h: Added.
+ * inspector/remote/RemoteInspectorDebuggable.cpp: Added.
+ (Inspector::RemoteInspectorDebuggable::RemoteInspectorDebuggable):
+ (Inspector::RemoteInspectorDebuggable::~RemoteInspectorDebuggable):
+ (Inspector::RemoteInspectorDebuggable::init):
+ (Inspector::RemoteInspectorDebuggable::update):
+ (Inspector::RemoteInspectorDebuggable::setRemoteDebuggingAllowed):
+ (Inspector::RemoteInspectorDebuggable::info):
+ RemoteInspectorDebuggable defines a debuggable target. As long as
+ something creates a debuggable and is set to allow remote inspection
+ it will be listed in remote debuggers. For the different types of
+ debuggables (JavaScript and Web) there is different basic information
+ that may be listed.
+
+ * inspector/InspectorFrontendChannel.h: Added.
+ (Inspector::InspectorFrontendChannel::~InspectorFrontendChannel):
+ The only thing a debuggable needs for remote debugging is an
+ InspectorFrontendChannel a way to send messages to a remote frontend.
+ This class provides that method, and is vended to the
+ RemoteInspectorDebuggable when a remote connection is setup.
+
+ * inspector/remote/RemoteInspector.h: Added.
+ * inspector/remote/RemoteInspector.mm: Added.
+ Singleton, created at least when the first Debuggable is created.
+ This class manages the list of debuggables, any connection to a
+ remote debugger proxy (XPC service "com.apple.webinspector").
+
+ (Inspector::dispatchAsyncOnQueueSafeForAnyDebuggable):
+ (Inspector::RemoteInspector::shared):
+ (Inspector::RemoteInspector::RemoteInspector):
+ (Inspector::RemoteInspector::nextAvailableIdentifier):
+ (Inspector::RemoteInspector::registerDebuggable):
+ (Inspector::RemoteInspector::unregisterDebuggable):
+ (Inspector::RemoteInspector::updateDebuggable):
+ Debuggable management. When debuggables are added, removed, or updated
+ we stash a copy of the debuggable information and push an update to
+ debuggers. Stashing a copy of the information in the RemoteInspector
+ is a thread safe way to avoid walking over all debuggables to gather
+ the information when it is needed.
+
+ (Inspector::RemoteInspector::start):
+ (Inspector::RemoteInspector::stop):
+ Runtime API to enable / disable the feature.
+
+ (Inspector::RemoteInspector::listingForDebuggable):
+ (Inspector::RemoteInspector::pushListingNow):
+ (Inspector::RemoteInspector::pushListingSoon):
+ Pushing a listing to remote debuggers.
+
+ (Inspector::RemoteInspector::sendMessageToRemoteFrontend):
+ (Inspector::RemoteInspector::setupXPCConnectionIfNeeded):
+ (Inspector::RemoteInspector::xpcConnectionReceivedMessage):
+ (Inspector::RemoteInspector::xpcConnectionFailed):
+ (Inspector::RemoteInspector::xpcConnectionUnhandledMessage):
+ XPC setup, send, and receive handling.
+
+ (Inspector::RemoteInspector::updateHasActiveDebugSession):
+ Applications being debugged may want to know when a debug
+ session is active. This provides that notification.
+
+ (Inspector::RemoteInspector::receivedSetupMessage):
+ (Inspector::RemoteInspector::receivedDataMessage):
+ (Inspector::RemoteInspector::receivedDidCloseMessage):
+ (Inspector::RemoteInspector::receivedGetListingMessage):
+ (Inspector::RemoteInspector::receivedIndicateMessage):
+ (Inspector::RemoteInspector::receivedConnectionDiedMessage):
+ Dispatching incoming remote debugging protocol messages.
+ These are wrapping above the inspector protocol messages.
+
+ * inspector/remote/RemoteInspectorConstants.h: Added.
+ Protocol messages and dictionary keys inside the messages.
+
+ (Inspector::RemoteInspectorDebuggableInfo::RemoteInspectorDebuggableInfo):
+ * inspector/remote/RemoteInspectorDebuggableConnection.h: Added.
+ * inspector/remote/RemoteInspectorDebuggableConnection.mm: Added.
+ This is a connection between the RemoteInspector singleton and a RemoteInspectorDebuggable.
+
+ (Inspector::RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection):
+ (Inspector::RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection):
+ Allow for dispatching messages on JavaScript debuggables on a dispatch_queue
+ instead of the main queue.
+
+ (Inspector::RemoteInspectorDebuggableConnection::destination):
+ (Inspector::RemoteInspectorDebuggableConnection::connectionIdentifier):
+ Needed in the remote debugging protocol to identify the remote debugger.
+
+ (Inspector::RemoteInspectorDebuggableConnection::dispatchSyncOnDebuggable):
+ (Inspector::RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable):
+ (Inspector::RemoteInspectorDebuggableConnection::setup):
+ (Inspector::RemoteInspectorDebuggableConnection::closeFromDebuggable):
+ (Inspector::RemoteInspectorDebuggableConnection::close):
+ (Inspector::RemoteInspectorDebuggableConnection::sendMessageToBackend):
+ (Inspector::RemoteInspectorDebuggableConnection::sendMessageToFrontend):
+ The connection is a thin channel between the two sides that can be closed
+ from either side, so there is some logic around multi-threaded access.
+
+ * inspector/remote/RemoteInspectorXPCConnection.h: Added.
+ (Inspector::RemoteInspectorXPCConnection::Client::~Client):
+ * inspector/remote/RemoteInspectorXPCConnection.mm: Added.
+ (Inspector::RemoteInspectorXPCConnection::RemoteInspectorXPCConnection):
+ (Inspector::RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection):
+ (Inspector::RemoteInspectorXPCConnection::close):
+ (Inspector::RemoteInspectorXPCConnection::deserializeMessage):
+ (Inspector::RemoteInspectorXPCConnection::handleEvent):
+ (Inspector::RemoteInspectorXPCConnection::sendMessage):
+ This is a connection between the RemoteInspector singleton and an XPC service
+ named "com.apple.webinspector". This handles serialization of the dictionary
+ messages to and from the service. The receiving is done on a non-main queue.
+
+ * API/JSContext.h:
+ * API/JSContext.mm:
+ (-[JSContext name]):
+ (-[JSContext setName:]):
+ ObjC API to enable/disable JSContext remote inspection and give a name.
+
+ * API/JSContextRef.h:
+ * API/JSContextRef.cpp:
+ (JSGlobalContextGetName):
+ (JSGlobalContextSetName):
+ C API to give a JSContext a name.
+
+ * runtime/JSGlobalObject.cpp:
+ (JSC::JSGlobalObject::setName):
+ * runtime/JSGlobalObject.h:
+ (JSC::JSGlobalObject::name):
+ Shared handling of the APIs above.
+
+ * runtime/JSGlobalObjectDebuggable.cpp: Added.
+ (JSC::JSGlobalObjectDebuggable::JSGlobalObjectDebuggable):
+ (JSC::JSGlobalObjectDebuggable::name):
+ (JSC::JSGlobalObjectDebuggable::connect):
+ (JSC::JSGlobalObjectDebuggable::disconnect):
+ (JSC::JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend):
+ * runtime/JSGlobalObjectDebuggable.h: Added.
+ Stub for the actual remote debugging implementation. We will push
+ down the appropriate WebCore/inspector peices suitable for debugging
+ just a JavaScript context.
+
+ * CMakeLists.txt:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * GNUmakefile.am:
+ * GNUmakefile.list.am:
+ * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+ * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+ Update build files.
+
2013-12-04 Michael Saboff <msaboff@apple.com>
Move the setting up of callee's callFrame from pushFrame to callToJavaScript thunk
-I$(srcdir)/Source/JavaScriptCore/disassembler \
-I$(srcdir)/Source/JavaScriptCore/ftl \
-I$(srcdir)/Source/JavaScriptCore/heap \
+ -I$(srcdir)/Source/JavaScriptCore/inspector \
-I$(srcdir)/Source/JavaScriptCore/interpreter \
-I$(srcdir)/Source/JavaScriptCore/jit \
-I$(srcdir)/Source/JavaScriptCore/llint \
Source/JavaScriptCore/icu/unicode/utf_old.h \
Source/JavaScriptCore/icu/unicode/utypes.h \
Source/JavaScriptCore/icu/unicode/uversion.h \
+ Source/JavaScriptCore/inspector/InspectorFrontendChannel.h \
Source/JavaScriptCore/interpreter/AbstractPC.cpp \
Source/JavaScriptCore/interpreter/AbstractPC.h \
Source/JavaScriptCore/interpreter/CachedCall.h \
<ClInclude Include="..\heap\WeakSet.h" />
<ClInclude Include="..\heap\WeakSetInlines.h" />
<ClInclude Include="..\heap\WriteBarrierSupport.h" />
+ <ClInclude Include="..\inspector\InspectorFrontendChannel.h" />
<ClInclude Include="..\interpreter\AbstractPC.h" />
<ClInclude Include="..\interpreter\CachedCall.h" />
<ClInclude Include="..\interpreter\CallFrame.h" />
<Filter Include="heap">
<UniqueIdentifier>{bd49e5cf-95d6-4151-b286-8837ccd347fa}</UniqueIdentifier>
</Filter>
+ <Filter Include="inspector">
+ <UniqueIdentifier>{09ae09da-1239-00ea-8dfe-9087ae123bbe}</UniqueIdentifier>
+ </Filter>
<Filter Include="interpreter">
<UniqueIdentifier>{10d97ea3-2af9-489c-a54e-d69ef2e4ca0a}</UniqueIdentifier>
</Filter>
<ClInclude Include="..\heap\WriteBarrierSupport.h">
<Filter>heap</Filter>
</ClInclude>
+ <ClInclude Include="..\inspector\InspectorFrontendChannel.h">
+ <Filter>inspector</Filter>
+ </ClInclude>
<ClInclude Include="..\interpreter\AbstractPC.h">
<Filter>interpreter</Filter>
</ClInclude>
A1712B4111C7B235007A5315 /* RegExpKey.h in Headers */ = {isa = PBXBuildFile; fileRef = A1712B4011C7B235007A5315 /* RegExpKey.h */; settings = {ATTRIBUTES = (Private, ); }; };
A1A009C01831A22D00CF8711 /* MacroAssemblerARM64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8640923C156EED3B00566CB2 /* MacroAssemblerARM64.h */; settings = {ATTRIBUTES = (Private, ); }; };
A1A009C11831A26E00CF8711 /* ARM64Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 8640923B156EED3B00566CB2 /* ARM64Assembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */; };
+ A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */; };
+ A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */; };
+ A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E1182340B300A82E69 /* RemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E2182340B300A82E69 /* RemoteInspector.mm */; };
+ A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */; };
+ A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */; };
+ A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */; };
+ A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */; };
+ A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */; settings = {ATTRIBUTES = (Private, ); }; };
A700873917CBE85300C3E643 /* MapConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A700873717CBE85300C3E643 /* MapConstructor.cpp */; };
A700873A17CBE85300C3E643 /* MapConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = A700873817CBE85300C3E643 /* MapConstructor.h */; };
A700873D17CBE8D300C3E643 /* MapPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A700873B17CBE8D300C3E643 /* MapPrototype.cpp */; };
A1712B3A11C7B212007A5315 /* RegExpCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExpCache.cpp; sourceTree = "<group>"; };
A1712B3E11C7B228007A5315 /* RegExpCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpCache.h; sourceTree = "<group>"; };
A1712B4011C7B235007A5315 /* RegExpKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpKey.h; sourceTree = "<group>"; };
+ A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RemoteInspectorDebuggable.cpp; path = inspector/remote/RemoteInspectorDebuggable.cpp; sourceTree = "<group>"; };
+ A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGlobalObjectDebuggable.cpp; sourceTree = "<group>"; };
+ A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGlobalObjectDebuggable.h; sourceTree = "<group>"; };
+ A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InspectorFrontendChannel.h; path = inspector/InspectorFrontendChannel.h; sourceTree = "<group>"; };
+ A5BA15E1182340B300A82E69 /* RemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspector.h; path = inspector/remote/RemoteInspector.h; sourceTree = "<group>"; };
+ A5BA15E2182340B300A82E69 /* RemoteInspector.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteInspector.mm; path = inspector/remote/RemoteInspector.mm; sourceTree = "<group>"; };
+ A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorConstants.h; path = inspector/remote/RemoteInspectorConstants.h; sourceTree = "<group>"; };
+ A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorDebuggableConnection.h; path = inspector/remote/RemoteInspectorDebuggableConnection.h; sourceTree = "<group>"; };
+ A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteInspectorDebuggableConnection.mm; path = inspector/remote/RemoteInspectorDebuggableConnection.mm; sourceTree = "<group>"; };
+ A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorXPCConnection.h; path = inspector/remote/RemoteInspectorXPCConnection.h; sourceTree = "<group>"; };
+ A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteInspectorXPCConnection.mm; path = inspector/remote/RemoteInspectorXPCConnection.mm; sourceTree = "<group>"; };
+ A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteInspectorDebuggable.h; path = inspector/remote/RemoteInspectorDebuggable.h; sourceTree = "<group>"; };
A700873717CBE85300C3E643 /* MapConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapConstructor.cpp; sourceTree = "<group>"; };
A700873817CBE85300C3E643 /* MapConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapConstructor.h; sourceTree = "<group>"; };
A700873B17CBE8D300C3E643 /* MapPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MapPrototype.cpp; sourceTree = "<group>"; };
0867D69AFE84028FC02AAC07 /* Frameworks */,
0FEA09FC1705137F00BB722C /* ftl */,
142E312A134FF0A600AFADB5 /* heap */,
+ A5BA15DF1823409200A82E69 /* inspector */,
1429D77A0ED20D7300B89619 /* interpreter */,
1429D92C0ED22D7000B89619 /* jit */,
0F46809C14BA7F4D00BFE272 /* llint */,
0F2B66C817B6B5AB00A7AE3F /* JSGenericTypedArrayViewPrototypeInlines.h */,
14DE0D680D02431400AACCA2 /* JSGlobalObject.cpp */,
A8E894330CD0603F00367179 /* JSGlobalObject.h */,
+ A59455901824744700CC3843 /* JSGlobalObjectDebuggable.cpp */,
+ A59455911824744700CC3843 /* JSGlobalObjectDebuggable.h */,
BC756FC60E2031B200DE7D12 /* JSGlobalObjectFunctions.cpp */,
BC756FC70E2031B200DE7D12 /* JSGlobalObjectFunctions.h */,
0F2B66CA17B6B5AB00A7AE3F /* JSInt16Array.h */,
path = bytecode;
sourceTree = "<group>";
};
+ A5BA15DF1823409200A82E69 /* inspector */ = {
+ isa = PBXGroup;
+ children = (
+ A5BA15E01823409D00A82E69 /* remote */,
+ A5945594182479EB00CC3843 /* InspectorFrontendChannel.h */,
+ );
+ name = inspector;
+ sourceTree = "<group>";
+ };
+ A5BA15E01823409D00A82E69 /* remote */ = {
+ isa = PBXGroup;
+ children = (
+ A5BA15E1182340B300A82E69 /* RemoteInspector.h */,
+ A5BA15E2182340B300A82E69 /* RemoteInspector.mm */,
+ A5BA15E3182340B300A82E69 /* RemoteInspectorConstants.h */,
+ A5BA15EF182345AF00A82E69 /* RemoteInspectorDebuggable.h */,
+ A594558E18245EDE00CC3843 /* RemoteInspectorDebuggable.cpp */,
+ A5BA15E4182340B300A82E69 /* RemoteInspectorDebuggableConnection.h */,
+ A5BA15E5182340B300A82E69 /* RemoteInspectorDebuggableConnection.mm */,
+ A5BA15E6182340B300A82E69 /* RemoteInspectorXPCConnection.h */,
+ A5BA15E7182340B300A82E69 /* RemoteInspectorXPCConnection.mm */,
+ );
+ name = remote;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
866739D213BFDE710023D87C /* BigInteger.h in Headers */,
14816E1C154CC56C00B8054C /* BlockAllocator.h in Headers */,
BC18C3EC0E16F5CD00B34460 /* BooleanObject.h in Headers */,
+ A5BA15EA182340B400A82E69 /* RemoteInspectorConstants.h in Headers */,
0FB7F39715ED8E4600F167B2 /* Butterfly.h in Headers */,
0FB7F39815ED8E4600F167B2 /* ButterflyInlines.h in Headers */,
0F21C27F14BEAA8200ADC64B /* BytecodeConventions.h in Headers */,
0F16015E156198C900C2587C /* DFGArgumentsSimplificationPhase.h in Headers */,
0F05C3B41683CF9200BAF45B /* DFGArrayifySlowPathGenerator.h in Headers */,
0F63948515E4811B006A597C /* DFGArrayMode.h in Headers */,
+ A5BA15EB182340B400A82E69 /* RemoteInspectorDebuggableConnection.h in Headers */,
A7D9A29517A0BC7400EE2618 /* DFGAtTailAbstractState.h in Headers */,
0F714CA516EA92F200F3EBEB /* DFGBackwardsPropagationPhase.h in Headers */,
0F620176143FCD3B0068B77C /* DFGBasicBlock.h in Headers */,
0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */,
0FC0976A1468A6F700CF2442 /* DFGOSRExit.h in Headers */,
0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */,
+ A5BA15ED182340B400A82E69 /* RemoteInspectorXPCConnection.h in Headers */,
0FFB921C16D02F110055A5DB /* DFGOSRExitCompilationInfo.h in Headers */,
0FC0977114693AF500CF2442 /* DFGOSRExitCompiler.h in Headers */,
0F7025AA1714B0FC00382C0E /* DFGOSRExitCompilerCommon.h in Headers */,
0FEA0A08170513DB00BB722C /* FTLAbbreviations.h in Headers */,
0FEA0A1D1708B00700BB722C /* FTLAbstractHeap.h in Headers */,
0FEA0A1F1708B00700BB722C /* FTLAbstractHeapRepository.h in Headers */,
+ A59455931824744700CC3843 /* JSGlobalObjectDebuggable.h in Headers */,
0FEA0A0A170513DB00BB722C /* FTLCapabilities.h in Headers */,
0FEA0A231709606900BB722C /* FTLCommonValues.h in Headers */,
0FEA0A0C170513DB00BB722C /* FTLCompile.h in Headers */,
86CCEFDE0F413F8900FD7F9E /* JITCode.h in Headers */,
0F0776BF14FF002B00102332 /* JITCompilationEffort.h in Headers */,
0FAF7EFE165BA91F000C8455 /* JITDisassembler.h in Headers */,
+ A5BA15F0182345AF00A82E69 /* RemoteInspectorDebuggable.h in Headers */,
0F46808214BA572D00BFE272 /* JITExceptions.h in Headers */,
0FB14E1F18124ACE009B6B4D /* JITInlineCacheGenerator.h in Headers */,
86CC85A10EE79A4700288682 /* JITInlines.h in Headers */,
14D2F3DB139F4BE200491031 /* MarkedSpace.h in Headers */,
142D6F1213539A4100B02E86 /* MarkStack.h in Headers */,
C21122E315DD9AB300790E3A /* MarkStackInlines.h in Headers */,
+ A5945595182479EB00CC3843 /* InspectorFrontendChannel.h in Headers */,
8612E4CD152389EC00C836BE /* MatchResult.h in Headers */,
BC18C43C0E16F5CD00B34460 /* MathObject.h in Headers */,
90213E3E123A40C200D422F3 /* MemoryStatistics.h in Headers */,
142E313C134FF0A600AFADB5 /* Weak.h in Headers */,
14E84F9F14EE1ACC00D6D5D4 /* WeakBlock.h in Headers */,
14BFCE6910CDB1FC00364CCE /* WeakGCMap.h in Headers */,
+ A5BA15E8182340B300A82E69 /* RemoteInspector.h in Headers */,
14F7256614EE265E00B1652B /* WeakHandleOwner.h in Headers */,
14E84FA214EE1ACC00D6D5D4 /* WeakImpl.h in Headers */,
14BE7D3317135CF400D1807A /* WeakInlines.h in Headers */,
A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */,
86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */,
0F56A1D515001CF4002992B1 /* ExecutionCounter.cpp in Sources */,
+ A59455921824744700CC3843 /* JSGlobalObjectDebuggable.cpp in Sources */,
0FB105851675480F00F8AB6E /* ExitKind.cpp in Sources */,
0FEA0A1C1708B00700BB722C /* FTLAbstractHeap.cpp in Sources */,
0FEA0A1E1708B00700BB722C /* FTLAbstractHeapRepository.cpp in Sources */,
14469DDE107EC7E700650446 /* Lookup.cpp in Sources */,
0F4680CC14BBB17A00BFE272 /* LowLevelInterpreter.cpp in Sources */,
14B723B212D7DA46003BD5ED /* MachineStackMarker.cpp in Sources */,
+ A594558F18245EFD00CC3843 /* RemoteInspectorDebuggable.cpp in Sources */,
0FEB3ECF16237F6C00AB67AD /* MacroAssembler.cpp in Sources */,
86C568E011A213EE0007F7F0 /* MacroAssemblerARM.cpp in Sources */,
A729009C17976C6000317298 /* MacroAssemblerARMv7.cpp in Sources */,
A7CA3AE517DA41AE006538AF /* WeakMapPrototype.cpp in Sources */,
14E84FA014EE1ACC00D6D5D4 /* WeakSet.cpp in Sources */,
0FC8150B14043C0E00CFA603 /* WriteBarrierSupport.cpp in Sources */,
+ A5BA15E9182340B300A82E69 /* RemoteInspector.mm in Sources */,
+ A5BA15EC182340B400A82E69 /* RemoteInspectorDebuggableConnection.mm in Sources */,
+ A5BA15EE182340B400A82E69 /* RemoteInspectorXPCConnection.mm in Sources */,
A7E5AB3A1799E4B200D2833D /* X86Disassembler.cpp in Sources */,
863C6D9C1521111A00585E4E /* YarrCanonicalizeUCS2.cpp in Sources */,
86704B8412DBA33700A9FE7B /* YarrInterpreter.cpp in Sources */,
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef InspectorFrontendChannel_h
#define InspectorFrontendChannel_h
-#include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
-namespace WebCore {
+namespace Inspector {
class InspectorFrontendChannel {
public:
virtual bool sendMessageToFrontend(const String& message) = 0;
};
-} // namespace WebCore
+} // namespace Inspector
#endif // !defined(InspectorFrontendChannel_h)
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspector_h
+#define RemoteInspector_h
+
+#import "RemoteInspectorDebuggableConnection.h"
+#import "RemoteInspectorXPCConnection.h"
+#import <wtf/Forward.h>
+#import <wtf/HashMap.h>
+#import <wtf/NeverDestroyed.h>
+#import <wtf/Threading.h>
+
+OBJC_CLASS NSString;
+OBJC_CLASS NSDictionary;
+
+namespace Inspector {
+
+class RemoteInspectorDebuggable;
+struct RemoteInspectorDebuggableInfo;
+
+class JS_EXPORT_PRIVATE RemoteInspector FINAL : public RemoteInspectorXPCConnection::Client {
+public:
+ static RemoteInspector& shared();
+ friend class NeverDestroyed<RemoteInspector>;
+
+ void registerDebuggable(RemoteInspectorDebuggable*);
+ void unregisterDebuggable(RemoteInspectorDebuggable*);
+ void updateDebuggable(RemoteInspectorDebuggable*);
+ void sendMessageToRemoteFrontend(unsigned identifier, const String& message);
+
+ bool enabled() const { return m_enabled; }
+ bool hasActiveDebugSession() const { return m_hasActiveDebugSession; }
+
+ void start();
+ void stop();
+
+private:
+ RemoteInspector();
+
+ unsigned nextAvailableIdentifier();
+
+ void setupXPCConnectionIfNeeded();
+
+ NSDictionary *listingForDebuggable(const RemoteInspectorDebuggableInfo&) const;
+ void pushListingNow();
+ void pushListingSoon();
+
+ void updateHasActiveDebugSession();
+
+ virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) OVERRIDE;
+ virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) OVERRIDE;
+ virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) OVERRIDE;
+
+ void receivedSetupMessage(NSDictionary *userInfo);
+ void receivedDataMessage(NSDictionary *userInfo);
+ void receivedDidCloseMessage(NSDictionary *userInfo);
+ void receivedGetListingMessage(NSDictionary *userInfo);
+ void receivedIndicateMessage(NSDictionary *userInfo);
+ void receivedConnectionDiedMessage(NSDictionary *userInfo);
+
+ // Debuggables can be registered from any thread at any time.
+ // Any debuggable can send messages over the XPC connection.
+ // So lock access to all maps and state as they can change
+ // from any thread.
+ Mutex m_lock;
+
+ HashMap<unsigned, std::pair<RemoteInspectorDebuggable*, RemoteInspectorDebuggableInfo>> m_debuggableMap;
+ HashMap<unsigned, RefPtr<RemoteInspectorDebuggableConnection>> m_connectionMap;
+ std::unique_ptr<RemoteInspectorXPCConnection> m_xpcConnection;
+ unsigned m_nextAvailableIdentifier;
+ int m_notifyToken;
+ bool m_enabled;
+ bool m_hasActiveDebugSession;
+ bool m_pushScheduled;
+};
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
+
+#endif // WebInspectorServer_h
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "RemoteInspector.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import "InitializeThreading.h"
+#import "RemoteInspectorConstants.h"
+#import "RemoteInspectorDebuggable.h"
+#import <notify.h>
+#import <xpc/xpc.h>
+#import <Foundation/Foundation.h>
+#import <wtf/Assertions.h>
+#import <wtf/MainThread.h>
+#import <wtf/text/WTFString.h>
+
+#if PLATFORM(IOS)
+#import <wtf/ios/WebCoreThread.h>
+#endif
+
+namespace Inspector {
+
+static void dispatchAsyncOnQueueSafeForAnyDebuggable(void (^block)())
+{
+#if PLATFORM(IOS)
+ if (WebCoreWebThreadIsEnabled && WebCoreWebThreadIsEnabled()) {
+ WebCoreWebThreadRun(block);
+ return;
+ }
+#endif
+
+ dispatch_async(dispatch_get_main_queue(), block);
+}
+
+RemoteInspector& RemoteInspector::shared()
+{
+ static NeverDestroyed<RemoteInspector> shared;
+
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ JSC::initializeThreading();
+ WTF::initializeMainThread();
+ shared.get().start();
+ });
+
+ return shared;
+}
+
+RemoteInspector::RemoteInspector()
+ : m_nextAvailableIdentifier(1)
+ , m_notifyToken(0)
+ , m_enabled(false)
+ , m_hasActiveDebugSession(false)
+ , m_pushScheduled(false)
+{
+}
+
+unsigned RemoteInspector::nextAvailableIdentifier()
+{
+ unsigned nextValidIdentifier;
+ do {
+ nextValidIdentifier = m_nextAvailableIdentifier++;
+ } while (!nextValidIdentifier || nextValidIdentifier == std::numeric_limits<unsigned>::max() || m_debuggableMap.contains(nextValidIdentifier));
+ return nextValidIdentifier;
+}
+
+void RemoteInspector::registerDebuggable(RemoteInspectorDebuggable* debuggable)
+{
+ MutexLocker locker(m_lock);
+
+ unsigned identifier = nextAvailableIdentifier();
+ debuggable->setIdentifier(identifier);
+
+ auto result = m_debuggableMap.set(identifier, std::make_pair(debuggable, debuggable->info()));
+ ASSERT_UNUSED(result, result.isNewEntry);
+
+ if (debuggable->remoteDebuggingAllowed())
+ pushListingSoon();
+}
+
+void RemoteInspector::unregisterDebuggable(RemoteInspectorDebuggable* debuggable)
+{
+ MutexLocker locker(m_lock);
+
+ unsigned identifier = debuggable->identifier();
+ if (!identifier)
+ return;
+
+ bool wasRemoved = m_debuggableMap.remove(identifier);
+ ASSERT_UNUSED(wasRemoved, wasRemoved);
+
+ if (RefPtr<RemoteInspectorDebuggableConnection> connection = m_connectionMap.take(identifier))
+ connection->closeFromDebuggable();
+
+ if (debuggable->remoteDebuggingAllowed())
+ pushListingSoon();
+}
+
+void RemoteInspector::updateDebuggable(RemoteInspectorDebuggable* debuggable)
+{
+ MutexLocker locker(m_lock);
+
+ unsigned identifier = debuggable->identifier();
+ if (!identifier)
+ return;
+
+ auto result = m_debuggableMap.set(identifier, std::make_pair(debuggable, debuggable->info()));
+ ASSERT_UNUSED(result, !result.isNewEntry);
+
+ if (debuggable->remoteDebuggingAllowed())
+ pushListingSoon();
+}
+
+void RemoteInspector::sendMessageToRemoteFrontend(unsigned identifier, const String& message)
+{
+ MutexLocker locker(m_lock);
+
+ if (!m_xpcConnection)
+ return;
+
+ RefPtr<RemoteInspectorDebuggableConnection> connection = m_connectionMap.get(identifier);
+ if (!connection)
+ return;
+
+ NSDictionary *userInfo = @{
+ WIRRawDataKey: [static_cast<NSString *>(message) dataUsingEncoding:NSUTF8StringEncoding],
+ WIRConnectionIdentifierKey: connection->connectionIdentifier(),
+ WIRDestinationKey: connection->destination()
+ };
+
+ m_xpcConnection->sendMessage(WIRRawDataMessage, userInfo);
+}
+
+void RemoteInspector::start()
+{
+ MutexLocker locker(m_lock);
+
+ if (m_enabled)
+ return;
+
+ m_enabled = true;
+
+ notify_register_dispatch(WIRServiceAvailableNotification, &m_notifyToken, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(int) {
+ RemoteInspector::shared().setupXPCConnectionIfNeeded();
+ });
+
+ notify_post(WIRServiceAvailabilityCheckNotification);
+}
+
+void RemoteInspector::stop()
+{
+ MutexLocker locker(m_lock);
+
+ if (!m_enabled)
+ return;
+
+ m_enabled = false;
+
+ m_pushScheduled = false;
+
+ for (auto it = m_connectionMap.begin(), end = m_connectionMap.end(); it != end; ++it)
+ it->value->close();
+ m_connectionMap.clear();
+
+ updateHasActiveDebugSession();
+
+ if (m_xpcConnection) {
+ m_xpcConnection->close();
+ m_xpcConnection = nullptr;
+ }
+
+ notify_cancel(m_notifyToken);
+}
+
+void RemoteInspector::setupXPCConnectionIfNeeded()
+{
+ MutexLocker locker(m_lock);
+
+ if (m_xpcConnection)
+ return;
+
+ xpc_connection_t connection = xpc_connection_create_mach_service(WIRXPCMachPortName, dispatch_get_main_queue(), 0);
+ if (!connection)
+ return;
+
+ m_xpcConnection = std::make_unique<RemoteInspectorXPCConnection>(connection, this);
+ m_xpcConnection->sendMessage(@"syn", nil); // Send a simple message to initialize the XPC connection.
+ xpc_release(connection);
+
+ pushListingSoon();
+}
+
+#pragma mark - RemoteInspectorXPCConnection::Client
+
+void RemoteInspector::xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo)
+{
+ MutexLocker locker(m_lock);
+
+ if ([messageName isEqualToString:WIRPermissionDenied]) {
+ stop();
+ return;
+ }
+
+ if ([messageName isEqualToString:WIRSocketDataMessage])
+ receivedDataMessage(userInfo);
+ else if ([messageName isEqualToString:WIRSocketSetupMessage])
+ receivedSetupMessage(userInfo);
+ else if ([messageName isEqualToString:WIRWebPageCloseMessage])
+ receivedDidCloseMessage(userInfo);
+ else if ([messageName isEqualToString:WIRApplicationGetListingMessage])
+ receivedGetListingMessage(userInfo);
+ else if ([messageName isEqualToString:WIRIndicateMessage])
+ receivedIndicateMessage(userInfo);
+ else if ([messageName isEqualToString:WIRConnectionDiedMessage])
+ receivedConnectionDiedMessage(userInfo);
+ else
+ NSLog(@"Unrecognized RemoteInspector XPC Message: %@", messageName);
+}
+
+void RemoteInspector::xpcConnectionFailed(RemoteInspectorXPCConnection*)
+{
+ MutexLocker locker(m_lock);
+
+ m_pushScheduled = false;
+
+ for (auto it = m_connectionMap.begin(), end = m_connectionMap.end(); it != end; ++it)
+ it->value->close();
+ m_connectionMap.clear();
+
+ updateHasActiveDebugSession();
+
+ if (m_xpcConnection) {
+ m_xpcConnection->close();
+ m_xpcConnection = nullptr;
+ }
+}
+
+void RemoteInspector::xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t)
+{
+ // Intentionally ignored.
+}
+
+#pragma mark - Listings
+
+NSDictionary *RemoteInspector::listingForDebuggable(const RemoteInspectorDebuggableInfo& debuggableInfo) const
+{
+ NSMutableDictionary *debuggableDetails = [NSMutableDictionary dictionary];
+
+ [debuggableDetails setObject:@(debuggableInfo.identifier) forKey:WIRPageIdentifierKey];
+
+ switch (debuggableInfo.type) {
+ case RemoteInspectorDebuggable::JavaScript: {
+ NSString *name = debuggableInfo.name;
+ [debuggableDetails setObject:name forKey:WIRTitleKey];
+ break;
+ }
+ case RemoteInspectorDebuggable::Web: {
+ NSString *url = debuggableInfo.url;
+ NSString *title = debuggableInfo.name;
+ [debuggableDetails setObject:url forKey:WIRURLKey];
+ [debuggableDetails setObject:title forKey:WIRTitleKey];
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ if (RefPtr<RemoteInspectorDebuggableConnection> connection = m_connectionMap.get(debuggableInfo.identifier))
+ [debuggableDetails setObject:connection->connectionIdentifier() forKey:WIRConnectionIdentifierKey];
+
+ if (debuggableInfo.hasLocalDebugger)
+ [debuggableDetails setObject:@YES forKey:WIRHasLocalDebuggerKey];
+
+ return debuggableDetails;
+}
+
+void RemoteInspector::pushListingNow()
+{
+ ASSERT(m_xpcConnection);
+ if (!m_xpcConnection)
+ return;
+
+ m_pushScheduled = false;
+
+ RetainPtr<NSMutableDictionary> response = adoptNS([[NSMutableDictionary alloc] init]);
+ for (auto it = m_debuggableMap.begin(), end = m_debuggableMap.end(); it != end; ++it) {
+ const RemoteInspectorDebuggableInfo& debuggableInfo = it->value.second;
+ if (debuggableInfo.remoteDebuggingAllowed) {
+ NSDictionary *details = listingForDebuggable(debuggableInfo);
+ [response setObject:details forKey:[NSString stringWithFormat:@"%u", debuggableInfo.identifier]];
+ }
+ }
+
+ RetainPtr<NSMutableDictionary> outgoing = adoptNS([[NSMutableDictionary alloc] init]);
+ [outgoing setObject:response.get() forKey:WIRListingKey];
+
+ m_xpcConnection->sendMessage(WIRListingMessage, outgoing.get());
+}
+
+void RemoteInspector::pushListingSoon()
+{
+ if (!m_xpcConnection)
+ return;
+
+ if (m_pushScheduled)
+ return;
+
+ m_pushScheduled = true;
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.02 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ MutexLocker locker(m_lock);
+ if (m_pushScheduled)
+ pushListingNow();
+ });
+}
+
+#pragma mark - Active Debugger Sessions
+
+void RemoteInspector::updateHasActiveDebugSession()
+{
+ bool hasActiveDebuggerSession = !m_connectionMap.isEmpty();
+ if (hasActiveDebuggerSession == m_hasActiveDebugSession)
+ return;
+
+ m_hasActiveDebugSession = hasActiveDebuggerSession;
+
+ // FIXME: Expose some way to access this state in an embedder.
+ // Legacy iOS WebKit 1 had a notification. This will need to be smarter with WebKit2.
+}
+
+#pragma mark - Received XPC Messages
+
+void RemoteInspector::receivedSetupMessage(NSDictionary *userInfo)
+{
+ NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
+ if (!pageId)
+ return;
+
+ NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
+ if (!connectionIdentifier)
+ return;
+
+ NSString *sender = [userInfo objectForKey:WIRSenderKey];
+ if (!sender)
+ return;
+
+ unsigned identifier = [pageId unsignedIntValue];
+ if (m_connectionMap.contains(identifier))
+ return;
+
+ auto it = m_debuggableMap.find(identifier);
+ if (it == m_debuggableMap.end())
+ return;
+
+ // Attempt to create a connection. This may fail if the page already has an inspector or if it disallows inspection.
+ RemoteInspectorDebuggable* debuggable = it->value.first;
+ RemoteInspectorDebuggableInfo debuggableInfo = it->value.second;
+ RefPtr<RemoteInspectorDebuggableConnection> connection = adoptRef(new RemoteInspectorDebuggableConnection(debuggable, connectionIdentifier, sender, debuggableInfo.type));
+ if (!connection->setup()) {
+ connection->close();
+ return;
+ }
+
+ m_connectionMap.set(identifier, connection.release());
+
+ updateHasActiveDebugSession();
+
+ pushListingSoon();
+}
+
+void RemoteInspector::receivedDataMessage(NSDictionary *userInfo)
+{
+ NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
+ if (!pageId)
+ return;
+
+ unsigned pageIdentifier = [pageId unsignedIntValue];
+ RefPtr<RemoteInspectorDebuggableConnection> connection = m_connectionMap.get(pageIdentifier);
+ if (!connection)
+ return;
+
+ NSData *data = [userInfo objectForKey:WIRSocketDataKey];
+ RetainPtr<NSString> message = adoptNS([[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]);
+ connection->sendMessageToBackend(message.get());
+}
+
+void RemoteInspector::receivedDidCloseMessage(NSDictionary *userInfo)
+{
+ NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
+ if (!pageId)
+ return;
+
+ NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
+ if (!connectionIdentifier)
+ return;
+
+ unsigned identifier = [pageId unsignedIntValue];
+ RefPtr<RemoteInspectorDebuggableConnection> connection = m_connectionMap.get(identifier);
+ if (!connection)
+ return;
+
+ if (![connectionIdentifier isEqualToString:connection->connectionIdentifier()])
+ return;
+
+ connection->close();
+ m_connectionMap.remove(identifier);
+
+ updateHasActiveDebugSession();
+
+ pushListingSoon();
+}
+
+void RemoteInspector::receivedGetListingMessage(NSDictionary *)
+{
+ pushListingNow();
+}
+
+void RemoteInspector::receivedIndicateMessage(NSDictionary *userInfo)
+{
+ NSNumber *pageId = [userInfo objectForKey:WIRPageIdentifierKey];
+ if (!pageId)
+ return;
+
+ unsigned identifier = [pageId unsignedIntValue];
+ BOOL indicateEnabled = [[userInfo objectForKey:WIRIndicateEnabledKey] boolValue];
+
+ dispatchAsyncOnQueueSafeForAnyDebuggable(^{
+ MutexLocker locker(m_lock);
+
+ auto it = m_debuggableMap.find(identifier);
+ if (it == m_debuggableMap.end())
+ return;
+
+ RemoteInspectorDebuggable* debuggable = it->value.first;
+ debuggable->setIndicating(indicateEnabled);
+ });
+}
+
+void RemoteInspector::receivedConnectionDiedMessage(NSDictionary *userInfo)
+{
+ NSString *connectionIdentifier = [userInfo objectForKey:WIRConnectionIdentifierKey];
+ if (!connectionIdentifier)
+ return;
+
+ auto it = m_connectionMap.begin();
+ auto end = m_connectionMap.end();
+ for (; it != end; ++it) {
+ if ([connectionIdentifier isEqualToString:it->value->connectionIdentifier()])
+ break;
+ }
+
+ if (it == end)
+ return;
+
+ RefPtr<RemoteInspectorDebuggableConnection> connection = it->value;
+ connection->close();
+ m_connectionMap.remove(it);
+
+ updateHasActiveDebugSession();
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebInspectorRelayDefinitions_h
-#define WebInspectorRelayDefinitions_h
+#ifndef RemoteInspectorConstants_h
+#define RemoteInspectorConstants_h
// WIRConstants are "Web Inspector Relay" constants shared between
-// the WebInspector framework on the debugger side, webinspectord,
-// and WebKit on the debuggable application side.
+// the WebInspector framework on the OS X side, webinspectord, and
+// iOS WebKit on the device side.
#define WIRSimulatorTCPPortNumber 27753
#define WIRXPCMachPortName "com.apple.webinspector"
/*
- * Copyright (C) 2012 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-@class WebInspectorServer;
-@class WebInspectorServerWebViewConnection;
-@class WebInspectorXPCWrapper;
+#include "config.h"
+#include "RemoteInspectorDebuggable.h"
-@interface WebInspectorServerWebViewConnectionController : NSObject {
-@private
- WebInspectorServer *_server; // weak, the server should never deallocate.
- NSMutableDictionary *_openConnections;
- BOOL _hasScheduledPush;
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include "InspectorFrontendChannel.h"
+#include "RemoteInspector.h"
+
+namespace Inspector {
+
+RemoteInspectorDebuggable::RemoteInspectorDebuggable()
+ : m_identifier(0)
+ , m_allowed(false)
+{
}
-- (id)initWithServer:(WebInspectorServer *)server;
+RemoteInspectorDebuggable::~RemoteInspectorDebuggable()
+{
+ RemoteInspector::shared().unregisterDebuggable(this);
+}
-- (void)closeAllConnections;
+void RemoteInspectorDebuggable::init()
+{
+ RemoteInspector::shared().registerDebuggable(this);
+}
-- (void)pushListing;
-- (void)receivedMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo;
+void RemoteInspectorDebuggable::update()
+{
+ RemoteInspector::shared().updateDebuggable(this);
+}
-- (void)connectionClosing:(WebInspectorServerWebViewConnection *)connection;
+void RemoteInspectorDebuggable::setRemoteDebuggingAllowed(bool allowed)
+{
+ if (m_allowed == allowed)
+ return;
+
+ m_allowed = allowed;
+
+ update();
+}
+
+RemoteInspectorDebuggableInfo RemoteInspectorDebuggable::info() const
+{
+ RemoteInspectorDebuggableInfo info;
+ info.identifier = identifier();
+ info.type = type();
+ info.name = name();
+ info.url = url();
+ info.hasLocalDebugger = hasLocalDebugger();
+ info.remoteDebuggingAllowed = remoteDebuggingAllowed();
+ return info;
+}
-- (void)sendMessageToFrontend:(NSString *)messageName userInfo:(NSDictionary *)userInfo;
+} // namespace Inspector
-@end
+#endif // ENABLE(REMOTE_INSPECTOR)
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspectorDebuggable_h
+#define RemoteInspectorDebuggable_h
+
+#include <wtf/text/WTFString.h>
+
+namespace Inspector {
+
+class InspectorFrontendChannel;
+struct RemoteInspectorDebuggableInfo;
+
+class JS_EXPORT_PRIVATE RemoteInspectorDebuggable {
+public:
+ RemoteInspectorDebuggable();
+ virtual ~RemoteInspectorDebuggable();
+
+ void init();
+ void update();
+
+ unsigned identifier() const { return m_identifier; }
+ void setIdentifier(unsigned identifier) { m_identifier = identifier; }
+
+ bool remoteDebuggingAllowed() const { return m_allowed; }
+ void setRemoteDebuggingAllowed(bool);
+
+ RemoteInspectorDebuggableInfo info() const;
+
+ enum DebuggableType { JavaScript, Web };
+ virtual DebuggableType type() const = 0;
+ virtual String name() const { return String(); } // JavaScript and Web
+ virtual String url() const { return String(); } // Web
+ virtual bool hasLocalDebugger() const = 0;
+
+ virtual void connect(InspectorFrontendChannel*) = 0;
+ virtual void disconnect() = 0;
+ virtual void dispatchMessageFromRemoteFrontend(const String& message) = 0;
+ virtual void setIndicating(bool) { } // Default is to do nothing.
+
+private:
+ unsigned m_identifier;
+ bool m_allowed;
+};
+
+struct RemoteInspectorDebuggableInfo {
+ RemoteInspectorDebuggableInfo()
+ : identifier(0)
+ , type(RemoteInspectorDebuggable::JavaScript)
+ , hasLocalDebugger(false)
+ , remoteDebuggingAllowed(false)
+ {
+ }
+
+ unsigned identifier;
+ RemoteInspectorDebuggable::DebuggableType type;
+ String name;
+ String url;
+ bool hasLocalDebugger;
+ bool remoteDebuggingAllowed;
+};
+
+} // namespace Inspector
+
+#endif // RemoteInspectorDebuggable_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspectorDebuggableConnection_h
+#define RemoteInspectorDebuggableConnection_h
+
+#import "InspectorFrontendChannel.h"
+#import "RemoteInspectorDebuggable.h"
+#import <dispatch/dispatch.h>
+#import <wtf/RetainPtr.h>
+#import <wtf/Threading.h>
+#import <wtf/ThreadSafeRefCounted.h>
+
+OBJC_CLASS NSString;
+
+namespace Inspector {
+
+class RemoteInspectorDebuggableConnection FINAL : public ThreadSafeRefCounted<RemoteInspectorDebuggableConnection>, public InspectorFrontendChannel {
+public:
+ RemoteInspectorDebuggableConnection(RemoteInspectorDebuggable*, NSString *connectionIdentifier, NSString *destination, RemoteInspectorDebuggable::DebuggableType);
+ virtual ~RemoteInspectorDebuggableConnection();
+
+ NSString *destination() const;
+ NSString *connectionIdentifier() const;
+ unsigned identifier() const { return m_identifier; }
+
+ bool setup();
+
+ void close();
+ void closeFromDebuggable();
+
+ void sendMessageToBackend(NSString *);
+ virtual bool sendMessageToFrontend(const String&) OVERRIDE;
+
+private:
+ void dispatchSyncOnDebuggable(void (^block)());
+ void dispatchAsyncOnDebuggable(void (^block)());
+
+ // This connection from the RemoteInspector singleton to the Debuggable
+ // can be used on multiple threads. So any access to the debuggable
+ // itself must take this lock to ensure m_debuggable is valid.
+ Mutex m_debuggableLock;
+
+ RemoteInspectorDebuggable* m_debuggable;
+ dispatch_queue_t m_queueForDebuggable;
+ RetainPtr<NSString> m_connectionIdentifier;
+ RetainPtr<NSString> m_destination;
+ unsigned m_identifier;
+ bool m_connected;
+};
+
+} // namespace Inspector
+
+#endif // RemoteInspectorDebuggableConnection_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "RemoteInspectorDebuggableConnection.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import "RemoteInspector.h"
+
+#if PLATFORM(IOS)
+#import <wtf/ios/WebCoreThread.h>
+#endif
+
+namespace Inspector {
+
+RemoteInspectorDebuggableConnection::RemoteInspectorDebuggableConnection(RemoteInspectorDebuggable* debuggable, NSString *connectionIdentifier, NSString *destination, RemoteInspectorDebuggable::DebuggableType type)
+ : m_debuggable(debuggable)
+ , m_queueForDebuggable(NULL)
+ , m_connectionIdentifier(connectionIdentifier)
+ , m_destination(destination)
+ , m_identifier(debuggable->identifier())
+ , m_connected(false)
+{
+ // Web debuggables must be accessed on the main queue (or the WebThread on iOS). Signal that with a NULL m_queueForDebuggable.
+ // However, JavaScript debuggables can be accessed from any thread/queue, so we create a queue for each JavaScript debuggable.
+ if (type == RemoteInspectorDebuggable::JavaScript)
+ m_queueForDebuggable = dispatch_queue_create("com.apple.JavaScriptCore.remote-inspector-xpc-connection", DISPATCH_QUEUE_SERIAL);
+}
+
+RemoteInspectorDebuggableConnection::~RemoteInspectorDebuggableConnection()
+{
+ if (m_queueForDebuggable) {
+ dispatch_release(m_queueForDebuggable);
+ m_queueForDebuggable = NULL;
+ }
+}
+
+NSString *RemoteInspectorDebuggableConnection::destination() const
+{
+ return [[m_destination copy] autorelease];
+}
+
+NSString *RemoteInspectorDebuggableConnection::connectionIdentifier() const
+{
+ return [[m_connectionIdentifier copy] autorelease];
+}
+
+void RemoteInspectorDebuggableConnection::dispatchSyncOnDebuggable(void (^block)())
+{
+ if (m_queueForDebuggable)
+ dispatch_sync(m_queueForDebuggable, block);
+#if PLATFORM(IOS)
+ else if (WebCoreWebThreadIsEnabled && WebCoreWebThreadIsEnabled())
+ WebCoreWebThreadRunSync(block);
+#endif
+ else
+ dispatch_sync(dispatch_get_main_queue(), block);
+}
+
+void RemoteInspectorDebuggableConnection::dispatchAsyncOnDebuggable(void (^block)())
+{
+ if (m_queueForDebuggable)
+ dispatch_async(m_queueForDebuggable, block);
+#if PLATFORM(IOS)
+ else if (WebCoreWebThreadIsEnabled && WebCoreWebThreadIsEnabled())
+ WebCoreWebThreadRun(block);
+#endif
+ else
+ dispatch_async(dispatch_get_main_queue(), block);
+}
+
+bool RemoteInspectorDebuggableConnection::setup()
+{
+ MutexLocker locker(m_debuggableLock);
+
+ if (!m_debuggable)
+ return false;
+
+ dispatchSyncOnDebuggable(^{
+ if (!m_debuggable->remoteDebuggingAllowed())
+ return;
+
+ if (m_debuggable->hasLocalDebugger())
+ return;
+
+ m_debuggable->connect(this);
+ m_connected = true;
+ });
+
+ return m_connected;
+}
+
+void RemoteInspectorDebuggableConnection::closeFromDebuggable()
+{
+ MutexLocker locker(m_debuggableLock);
+
+ m_debuggable = nullptr;
+}
+
+void RemoteInspectorDebuggableConnection::close()
+{
+ ref();
+ dispatchAsyncOnDebuggable(^{
+ {
+ MutexLocker locker(m_debuggableLock);
+
+ if (m_debuggable) {
+ if (m_connected)
+ m_debuggable->disconnect();
+
+ m_debuggable = nullptr;
+ }
+ }
+ deref();
+ });
+}
+
+void RemoteInspectorDebuggableConnection::sendMessageToBackend(NSString *message)
+{
+ ref();
+ dispatchAsyncOnDebuggable(^{
+ {
+ MutexLocker locker(m_debuggableLock);
+
+ if (m_debuggable)
+ m_debuggable->dispatchMessageFromRemoteFrontend(message);
+ }
+ deref();
+ });
+}
+
+bool RemoteInspectorDebuggableConnection::sendMessageToFrontend(const String& message)
+{
+ RemoteInspector::shared().sendMessageToRemoteFrontend(identifier(), message);
+
+ return true;
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#ifndef RemoteInspectorXPCConnection_h
+#define RemoteInspectorXPCConnection_h
+
+#import <dispatch/dispatch.h>
+#import <wtf/Noncopyable.h>
+#import <xpc/xpc.h>
+
+OBJC_CLASS NSString;
+OBJC_CLASS NSDictionary;
+
+namespace Inspector {
+
+class RemoteInspectorXPCConnection {
+ WTF_MAKE_NONCOPYABLE(RemoteInspectorXPCConnection);
+
+public:
+ class Client {
+ public:
+ virtual ~Client() { }
+ virtual void xpcConnectionReceivedMessage(RemoteInspectorXPCConnection*, NSString *messageName, NSDictionary *userInfo) = 0;
+ virtual void xpcConnectionFailed(RemoteInspectorXPCConnection*) = 0;
+ virtual void xpcConnectionUnhandledMessage(RemoteInspectorXPCConnection*, xpc_object_t) = 0;
+ };
+
+ RemoteInspectorXPCConnection(xpc_connection_t, Client*);
+ virtual ~RemoteInspectorXPCConnection();
+
+ void close();
+ void sendMessage(NSString *messageName, NSDictionary *userInfo);
+
+private:
+ NSDictionary *deserializeMessage(xpc_object_t);
+ void handleEvent(xpc_object_t);
+
+ xpc_connection_t m_connection;
+ dispatch_queue_t m_queue;
+ Client* m_client;
+};
+
+} // namespace Inspector
+
+#endif // RemoteInspectorXPCConnection_h
+
+#endif // ENABLE(REMOTE_INSPECTOR)
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "RemoteInspectorXPCConnection.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#import <Foundation/Foundation.h>
+#import <wtf/Assertions.h>
+
+#if __has_include(<CoreFoundation/CFXPCBridge.h>)
+#import <CoreFoundation/CFXPCBridge.h>
+#else
+extern "C" xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef);
+extern "C" CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t);
+#endif
+
+namespace Inspector {
+
+// Constants private to this file for message serialization on both ends.
+#define RemoteInspectorXPCConnectionMessageNameKey @"messageName"
+#define RemoteInspectorXPCConnectionUserInfoKey @"userInfo"
+#define RemoteInspectorXPCConnectionSerializedMessageKey "msgData"
+
+RemoteInspectorXPCConnection::RemoteInspectorXPCConnection(xpc_connection_t connection, Client* client)
+ : m_connection(connection)
+ , m_queue(dispatch_queue_create("com.apple.JavaScriptCore.remote-inspector-xpc-connection", DISPATCH_QUEUE_SERIAL))
+ , m_client(client)
+{
+ xpc_retain(m_connection);
+ xpc_connection_set_target_queue(m_connection, m_queue);
+ RemoteInspectorXPCConnection* weakThis = this;
+ xpc_connection_set_event_handler(m_connection, ^(xpc_object_t object) {
+ weakThis->handleEvent(object);
+ });
+ xpc_connection_resume(m_connection);
+}
+
+RemoteInspectorXPCConnection::~RemoteInspectorXPCConnection()
+{
+ ASSERT(!m_client);
+ ASSERT(!m_connection);
+}
+
+void RemoteInspectorXPCConnection::close()
+{
+ if (!m_connection)
+ return;
+
+ xpc_connection_cancel(m_connection);
+ xpc_release(m_connection);
+ m_connection = NULL;
+
+ dispatch_release(m_queue);
+ m_queue = NULL;
+
+ m_client = nullptr;
+}
+
+NSDictionary *RemoteInspectorXPCConnection::deserializeMessage(xpc_object_t object)
+{
+ if (xpc_get_type(object) != XPC_TYPE_DICTIONARY)
+ return nil;
+
+ xpc_object_t xpcDictionary = xpc_dictionary_get_value(object, RemoteInspectorXPCConnectionSerializedMessageKey);
+ if (!xpcDictionary || xpc_get_type(xpcDictionary) != XPC_TYPE_DICTIONARY) {
+ if (m_client)
+ m_client->xpcConnectionUnhandledMessage(this, object);
+ return nil;
+ }
+
+ NSDictionary *dictionary = static_cast<NSDictionary *>(_CFXPCCreateCFObjectFromXPCMessage(xpcDictionary));
+ ASSERT_WITH_MESSAGE(dictionary, "Unable to deserialize xpc message");
+ return [dictionary autorelease];
+}
+
+void RemoteInspectorXPCConnection::handleEvent(xpc_object_t object)
+{
+ if (!m_connection)
+ return;
+
+ if (xpc_get_type(object) == XPC_TYPE_ERROR) {
+ if (m_client)
+ m_client->xpcConnectionFailed(this);
+ return;
+ }
+
+ NSDictionary *dataDictionary = deserializeMessage(object);
+ if (!dataDictionary)
+ return;
+
+ NSString *message = [dataDictionary objectForKey:RemoteInspectorXPCConnectionMessageNameKey];
+ NSDictionary *userInfo = [dataDictionary objectForKey:RemoteInspectorXPCConnectionUserInfoKey];
+ if (m_client)
+ m_client->xpcConnectionReceivedMessage(this, message, userInfo);
+}
+
+void RemoteInspectorXPCConnection::sendMessage(NSString *messageName, NSDictionary *userInfo)
+{
+ if (!m_connection)
+ return;
+
+ NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObject:messageName forKey:RemoteInspectorXPCConnectionMessageNameKey];
+ if (userInfo)
+ [dictionary setObject:userInfo forKey:RemoteInspectorXPCConnectionUserInfoKey];
+
+ xpc_object_t xpcDictionary = _CFXPCCreateXPCMessageWithCFObject((CFDictionaryRef)dictionary);
+ ASSERT_WITH_MESSAGE(xpcDictionary && xpc_get_type(xpcDictionary) == XPC_TYPE_DICTIONARY, "Unable to serialize xpc message");
+ if (!xpcDictionary)
+ return;
+
+ xpc_object_t msg = xpc_dictionary_create(NULL, NULL, 0);
+ xpc_dictionary_set_value(msg, RemoteInspectorXPCConnectionSerializedMessageKey, xpcDictionary);
+ xpc_release(xpcDictionary);
+
+ xpc_connection_send_message(m_connection, msg);
+
+ xpc_release(msg);
+}
+
+} // namespace Inspector
+
+#endif // ENABLE(REMOTE_INSPECTOR)
#include "JSPromiseResolverPrototype.h"
#endif // ENABLE(PROMISES)
+#if ENABLE(REMOTE_INSPECTOR)
+#include "JSGlobalObjectDebuggable.h"
+#include "RemoteInspector.h"
+#endif
+
#include "JSGlobalObject.lut.h"
namespace JSC {
m_debugger = 0;
+#if ENABLE(REMOTE_INSPECTOR)
+ m_inspectorDebuggable = std::make_unique<JSGlobalObjectDebuggable>(*this);
+ m_inspectorDebuggable->init();
+ m_inspectorDebuggable->setRemoteDebuggingAllowed(true);
+#endif
+
reset(prototype());
}
return unlinkedCodeBlock;
}
+void JSGlobalObject::setRemoteDebuggingEnabled(bool enabled)
+{
+#if ENABLE(REMOTE_INSPECTOR)
+ m_inspectorDebuggable->setRemoteDebuggingAllowed(enabled);
+#else
+ UNUSED_PARAM(enabled);
+#endif
+}
+
+bool JSGlobalObject::remoteDebuggingEnabled() const
+{
+#if ENABLE(REMOTE_INSPECTOR)
+ return m_inspectorDebuggable->remoteDebuggingAllowed();
+#else
+ return false;
+#endif
+}
+
+void JSGlobalObject::setName(const String& name)
+{
+ m_name = name;
+
+#if ENABLE(REMOTE_INSPECTOR)
+ m_inspectorDebuggable->update();
+#endif
+}
+
} // namespace JSC
class FunctionPrototype;
class GetterSetter;
class GlobalCodeBlock;
+class JSGlobalObjectDebuggable;
class JSPromisePrototype;
class JSPromiseResolverPrototype;
class JSStack;
void* m_specialPointers[Special::TableSize]; // Special pointers used by the LLInt and JIT.
+ String m_name;
+
Debugger* m_debugger;
+#if ENABLE(REMOTE_INSPECTOR)
+ std::unique_ptr<JSGlobalObjectDebuggable> m_inspectorDebuggable;
+#endif
+
RefPtr<WatchpointSet> m_masqueradesAsUndefinedWatchpoint;
RefPtr<WatchpointSet> m_havingABadTimeWatchpoint;
RefPtr<WatchpointSet> m_varInjectionWatchpoint;
Structure* promiseWrapperCallbackStructure() const { return m_promiseWrapperCallbackStructure.get(); }
#endif // ENABLE(PROMISES)
+ JS_EXPORT_PRIVATE void setRemoteDebuggingEnabled(bool);
+ JS_EXPORT_PRIVATE bool remoteDebuggingEnabled() const;
+
+ void setName(const String&);
+ const String& name() const { return m_name; }
+
JSArrayBufferPrototype* arrayBufferPrototype() const { return m_arrayBufferPrototype.get(); }
#define DEFINE_ACCESSORS_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Foundation/Foundation.h>
-#import <xpc/xpc.h>
+#include "config.h"
+#include "JSGlobalObjectDebuggable.h"
-@class WebInspectorXPCWrapper;
+#if ENABLE(REMOTE_INSPECTOR)
-@protocol WebInspectorXPCWrapperDelegate <NSObject>
-- (void)xpcConnection:(WebInspectorXPCWrapper *)connection receivedMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo;
-- (void)xpcConnectionFailed:(WebInspectorXPCWrapper *)connection;
-@optional
-- (void)xpcConnection:(WebInspectorXPCWrapper *)connection unhandledMessage:(xpc_object_t)message;
-@end
+#include "InspectorFrontendChannel.h"
+#include "JSGlobalObject.h"
+#include "RemoteInspector.h"
-@interface WebInspectorXPCWrapper : NSObject
+using namespace Inspector;
+
+namespace JSC {
+
+JSGlobalObjectDebuggable::JSGlobalObjectDebuggable(JSGlobalObject& globalObject)
+ : m_globalObject(globalObject)
{
- id <WebInspectorXPCWrapperDelegate> _delegate;
- xpc_connection_t _connection;
- NSString *_tag;
}
-- (WebInspectorXPCWrapper *)initWithConnection:(xpc_connection_t)connection;
-- (void)close;
-- (void)sendMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo;
+String JSGlobalObjectDebuggable::name() const
+{
+ String name = m_globalObject.name();
+ return name.isEmpty() ? ASCIILiteral("JSContext") : name;
+}
+
+void JSGlobalObjectDebuggable::connect(InspectorFrontendChannel*)
+{
+ // FIXME: Implement.
+ // Create an InspectorController, InspectorFrontend, InspectorBackend, and Agents.
+ // "InspectorController::connectFrontend".
+}
+
+void JSGlobalObjectDebuggable::disconnect()
+{
+ // FIXME: Implement.
+ // "InspectorController::disconnectFrontend".
+}
+
+void JSGlobalObjectDebuggable::dispatchMessageFromRemoteFrontend(const String&)
+{
+ // FIXME: Implement.
+ // "InspectorController::dispatchMessageFromFrontend"
+}
-@property (nonatomic, assign) id <WebInspectorXPCWrapperDelegate> delegate;
-@property (nonatomic, readonly) xpc_connection_t connection;
-@property (nonatomic, readonly) BOOL available;
-@property (nonatomic, copy) NSString *tag;
+} // namespace JSC
-@end
+#endif // ENABLE(REMOTE_INSPECTOR)
/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <wtf/HashMap.h>
+#ifndef JSGlobalObjectDebuggable_h
+#define JSGlobalObjectDebuggable_h
-class WebInspectorClient;
+#if ENABLE(REMOTE_INSPECTOR)
-@protocol WebInspectorClientRegistryDelegate
-- (void)didRegisterClient:(WebInspectorClient*)client;
-- (void)didUnregisterClient:(WebInspectorClient*)client;
-@end
+#include "RemoteInspectorDebuggable.h"
+#include <wtf/Noncopyable.h>
-@interface WebInspectorClientRegistry : NSObject {
-@private
- unsigned _nextAvailablePageId;
- HashMap<unsigned, WebInspectorClient*> _pageClientMap;
- id <WebInspectorClientRegistryDelegate> _delegate;
-}
+namespace JSC {
-@property (nonatomic, assign) id <WebInspectorClientRegistryDelegate> delegate;
+class JSGlobalObject;
-+ (WebInspectorClientRegistry *)sharedRegistry;
+class JSGlobalObjectDebuggable FINAL : public Inspector::RemoteInspectorDebuggable {
+ WTF_MAKE_NONCOPYABLE(JSGlobalObjectDebuggable);
+public:
+ JSGlobalObjectDebuggable(JSGlobalObject&);
+ ~JSGlobalObjectDebuggable() { }
-- (void)registerClient:(WebInspectorClient*)client;
-- (void)unregisterClient:(WebInspectorClient*)client;
-- (WebInspectorClient*)clientForPageId:(unsigned)pageId;
-- (NSDictionary *)inspectableWebViews;
+ virtual Inspector::RemoteInspectorDebuggable::DebuggableType type() const OVERRIDE { return Inspector::RemoteInspectorDebuggable::JavaScript; }
-@end
+ virtual String name() const OVERRIDE;
+ virtual bool hasLocalDebugger() const OVERRIDE { return false; }
+
+ virtual void connect(Inspector::InspectorFrontendChannel*) OVERRIDE;
+ virtual void disconnect() OVERRIDE;
+ virtual void dispatchMessageFromRemoteFrontend(const String& message) OVERRIDE;
+
+private:
+ JSGlobalObject& m_globalObject;
+};
+
+} // namespace JSC
+
+#endif // ENABLE(REMOTE_INSPECTOR)
+
+#endif // !defined(JSGlobalObjectDebuggable_h)
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * wtf/ios/WebCoreThread.cpp:
+ * wtf/ios/WebCoreThread.h:
+ Expose WebThreadRun/WebThreadRunSync iOS methods defined in WebCore through
+ WTF so that JavaScriptCore can use it. Another such method already existed.
+
2013-12-03 Mark Lam <mark.lam@apple.com>
testapi test crashes on Windows in WTF::Vector<wchar_t,64,WTF::UnsafeVectorOverflow>::size().
#if USE(WEB_THREAD)
WTF_EXPORT_PRIVATE bool (*WebCoreWebThreadIsLockedOrDisabled)(void);
+WTF_EXPORT_PRIVATE bool (*WebCoreWebThreadIsEnabled)(void);
+WTF_EXPORT_PRIVATE void (*WebCoreWebThreadRun)(void (^block)());
+WTF_EXPORT_PRIVATE void (*WebCoreWebThreadRunSync)(void (^block)());
#endif
#endif
extern bool (*WebCoreWebThreadIsLockedOrDisabled)(void);
+extern bool (*WebCoreWebThreadIsEnabled)(void);
+extern void (*WebCoreWebThreadRun)(void (^block)());
+extern void (*WebCoreWebThreadRunSync)(void (^block)());
#ifdef __cplusplus
}
2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ Make a WebCore::Page a "Web" Remote Debuggable.
+
+ * bindings/js/JSDOMGlobalObject.cpp:
+ Disable JavaScript context inspection on JSGlobalObjects inside WebCore::Page's.
+
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ (WebCore::Page::remoteInspectionAllowed):
+ (WebCore::Page::setRemoteInspectionAllowed):
+ (WebCore::Page::remoteInspectorInformationDidChange):
+ * page/Page.h:
+ * page/PageDebuggable.h:
+ * page/PageDebuggable.cpp: Added.
+ (WebCore::PageDebuggable::PageDebuggable):
+ (WebCore::PageDebuggable::name):
+ (WebCore::PageDebuggable::url):
+ (WebCore::PageDebuggable::hasLocalDebugger):
+ (WebCore::PageDebuggable::connect):
+ (WebCore::PageDebuggable::disconnect):
+ (WebCore::PageDebuggable::dispatchMessageFromRemoteFrontend):
+ (WebCore::PageDebuggable::setIndicating):
+ Make a page a "Web" debuggable.
+
+ * GNUmakefile.list.am:
+ * WebCore.exp.in:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ Misc.
+
+ * inspector/InspectorClient.h:
+ (WebCore::InspectorClient::indicate):
+ (WebCore::InspectorClient::hideIndicate):
+ Forward indicate methods to WebKit clients.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::didChangeTitle):
+ (WebCore::FrameLoader::dispatchDidCommitLoad):
+ Push updates when remote debuggable information like the Page's
+ URL or title change.
+
+ * ForwardingHeaders/inspector/InspectorFrontendChannel.h:
+ * inspector/InspectorForwarding.h:
+ Re-export Inspector::InspectorFrontendChannel as WebCore::InspectorFrontendChannel
+ to avoid needlessly updating code all over the place.
+
+ * inspector/CodeGeneratorInspectorStrings.py:
+ * inspector/InspectorWorkerAgent.cpp:
+ * inspector/WorkerInspectorController.cpp:
+ * testing/Internals.cpp:
+ Update include names.
+
+ * page/ContextMenuController.cpp:
+ (WebCore::ContextMenuController::populate):
+ Make the "Inspect Element" context menu work correctly when there is a
+ remote inspector instead of a local inspector.
+
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
Web Inspector: Add missing folders and files to Xcode project
https://bugs.webkit.org/show_bug.cgi?id=124802
--- /dev/null
+#ifndef WebCore_FWD_InspectorFrontendChannel_h
+#define WebCore_FWD_InspectorFrontendChannel_h
+#include <JavaScriptCore/InspectorFrontendChannel.h>
+#endif
Source/WebCore/inspector/InspectorDOMDebuggerAgent.h \
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp \
Source/WebCore/inspector/InspectorDOMStorageAgent.h \
- Source/WebCore/inspector/InspectorFrontendChannel.h \
+ Source/WebCore/inspector/InspectorForwarding.h \
Source/WebCore/inspector/InspectorFrontendClient.h \
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp \
Source/WebCore/inspector/InspectorFrontendClientLocal.h \
#endif
#if ENABLE(REMOTE_INSPECTOR)
+__ZN7WebCore4Page26setRemoteInspectionAllowedEb
__ZN7WebCore19InspectorController27dispatchMessageFromFrontendERKN3WTF6StringE
#endif
<ClInclude Include="..\inspector\InspectorDOMAgent.h" />
<ClInclude Include="..\inspector\InspectorDOMDebuggerAgent.h" />
<ClInclude Include="..\inspector\InspectorDOMStorageAgent.h" />
- <ClInclude Include="..\inspector\InspectorFrontendChannel.h" />
+ <ClInclude Include="..\inspector\InspectorForwarding.h" />
<ClInclude Include="..\inspector\InspectorFrontendClient.h" />
<ClInclude Include="..\inspector\InspectorFrontendClientLocal.h" />
<ClInclude Include="..\inspector\InspectorFrontendHost.h" />
<Filter Include="ForwardingHeaders\heap">
<UniqueIdentifier>{82ba9bb4-eaa0-4973-9bb3-a27667a1c167}</UniqueIdentifier>
</Filter>
+ <Filter Include="ForwardingHeaders\inspector">
+ <UniqueIdentifier>{132bade2-0aab-6274-0adff-ae8aed5aed4}</UniqueIdentifier>
+ </Filter>
<Filter Include="history">
<UniqueIdentifier>{6f39dedf-2d3a-414e-83fe-7bf64f911cfb}</UniqueIdentifier>
</Filter>
<ClInclude Include="..\ForwardingHeaders\heap\Strong.h">
<Filter>ForwardingHeaders\heap</Filter>
</ClInclude>
+ <ClInclude Include="..\ForwardingHeaders\inspector\InspectorForwarding.h">
+ <Filter>ForwardingHeaders\inspector</Filter>
+ </ClInclude>
<ClInclude Include="..\history\BackForwardClient.h">
<Filter>history</Filter>
</ClInclude>
<ClInclude Include="..\inspector\InspectorDOMStorageAgent.h">
<Filter>inspector</Filter>
</ClInclude>
- <ClInclude Include="..\inspector\InspectorFrontendChannel.h">
+ <ClInclude Include="..\inspector\InspectorForwarding.h">
<Filter>inspector</Filter>
</ClInclude>
<ClInclude Include="..\inspector\InspectorFrontendClient.h">
209B456B16796A7E00E54E4E /* JSCryptoCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 209B456A16796A7E00E54E4E /* JSCryptoCustom.cpp */; };
20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20D629241253690B00081543 /* InspectorInstrumentation.cpp */; };
20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; };
- 227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 227777601345DEA9008EA455 /* InspectorForwarding.h in Headers */ = {isa = PBXBuildFile; fileRef = 2277775F1345DEA9008EA455 /* InspectorForwarding.h */; settings = {ATTRIBUTES = (Private, ); }; };
228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */ = {isa = PBXBuildFile; fileRef = 228C284410D82500009D0D0E /* ScriptWrappable.h */; settings = {ATTRIBUTES = (Private, ); }; };
2292B27C1356669400CF11EF /* ImageBufferDataCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2292B27B1356669400CF11EF /* ImageBufferDataCG.cpp */; };
22BD9F7F1353625C009BD102 /* ImageBufferData.h in Headers */ = {isa = PBXBuildFile; fileRef = 22BD9F7D1353625C009BD102 /* ImageBufferData.h */; };
A556C289183206A8008CB720 /* InspectorAgentRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = A556C287183206A8008CB720 /* InspectorAgentRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
A5732B0A136A161D005C8D7C /* DateComponents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5732B08136A161D005C8D7C /* DateComponents.cpp */; };
A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */ = {isa = PBXBuildFile; fileRef = A5732B09136A161D005C8D7C /* DateComponents.h */; };
+ A5A2AF0B1829734300DE1729 /* PageDebuggable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5A2AF091829734300DE1729 /* PageDebuggable.cpp */; };
+ A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */ = {isa = PBXBuildFile; fileRef = A5A2AF0A1829734300DE1729 /* PageDebuggable.h */; };
A5ABB78713B904BC00F197E3 /* LineBreakIteratorPoolICU.h in Headers */ = {isa = PBXBuildFile; fileRef = A5ABB78613B904BC00F197E3 /* LineBreakIteratorPoolICU.h */; };
A5AC4AEF18336975007114E0 /* InspectorBackendDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AC4AED18336975007114E0 /* InspectorBackendDispatcher.cpp */; };
A5AC4AF018336975007114E0 /* InspectorBackendDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AC4AEE18336975007114E0 /* InspectorBackendDispatcher.h */; settings = {ATTRIBUTES = (Private, ); }; };
209B456A16796A7E00E54E4E /* JSCryptoCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCryptoCustom.cpp; sourceTree = "<group>"; };
20D629241253690B00081543 /* InspectorInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentation.cpp; sourceTree = "<group>"; };
20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; };
- 2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontendChannel.h; sourceTree = "<group>"; };
+ 2277775F1345DEA9008EA455 /* InspectorForwarding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorForwarding.h; sourceTree = "<group>"; };
228C284410D82500009D0D0E /* ScriptWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappable.h; sourceTree = "<group>"; };
2292B27B1356669400CF11EF /* ImageBufferDataCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferDataCG.cpp; sourceTree = "<group>"; };
22BD9F7D1353625C009BD102 /* ImageBufferData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferData.h; sourceTree = "<group>"; };
A593CF7318402D4B00BFCE27 /* CodeGeneratorInspector.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = CodeGeneratorInspector.py; sourceTree = "<group>"; };
A593CF7418402D4B00BFCE27 /* CodeGeneratorInspectorStrings.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = CodeGeneratorInspectorStrings.py; sourceTree = "<group>"; };
A593CF7518402D4B00BFCE27 /* combine-javascript-resources.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = "combine-javascript-resources.pl"; sourceTree = "<group>"; };
+ A5A2AF091829734300DE1729 /* PageDebuggable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageDebuggable.cpp; sourceTree = "<group>"; };
+ A5A2AF0A1829734300DE1729 /* PageDebuggable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageDebuggable.h; sourceTree = "<group>"; };
A5ABB78613B904BC00F197E3 /* LineBreakIteratorPoolICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineBreakIteratorPoolICU.h; sourceTree = "<group>"; };
A5AC4AED18336975007114E0 /* InspectorBackendDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcher.cpp; sourceTree = "<group>"; };
A5AC4AEE18336975007114E0 /* InspectorBackendDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackendDispatcher.h; sourceTree = "<group>"; };
504AACCC1834455900E3D9BC /* InspectorNodeFinder.h */,
7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */,
7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */,
- 2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */,
+ 2277775F1345DEA9008EA455 /* InspectorForwarding.h */,
F344C7121125B82C00F26EEE /* InspectorFrontendClient.h */,
F344C75711294FF600F26EEE /* InspectorFrontendClientLocal.cpp */,
F344C75211294D9D00F26EEE /* InspectorFrontendClientLocal.h */,
CD08285B1757250800EC5FB7 /* PageActivityAssertionToken.h */,
DAACB3D916F2416400666135 /* PageConsole.cpp */,
DAACB3DA16F2416400666135 /* PageConsole.h */,
+ A5A2AF091829734300DE1729 /* PageDebuggable.cpp */,
+ A5A2AF0A1829734300DE1729 /* PageDebuggable.h */,
9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */,
9302B0BE0D79F82C00C7EE83 /* PageGroup.h */,
7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */,
D000EBA311BDAFD400C47726 /* FrameLoaderStateMachine.h in Headers */,
E4D58EBB17B8F12800CBDCA8 /* ElementTraversal.h in Headers */,
93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */,
+ A5A2AF0C1829734300DE1729 /* PageDebuggable.h in Headers */,
658436860AE01B7400E53753 /* FrameLoadRequest.h in Headers */,
628D214E12131EF40055DCFC /* FrameNetworkingContext.h in Headers */,
E172AF70180F289500FBADB9 /* CryptoKeyUsage.h in Headers */,
7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */,
0705853417FDE6D9005F2BCB /* JSMediaTrackConstraints.h in Headers */,
578DA20E1520EB8C006141C1 /* InspectorFrontend.h in Headers */,
- 227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */,
+ 227777601345DEA9008EA455 /* InspectorForwarding.h in Headers */,
F344C7141125B82C00F26EEE /* InspectorFrontendClient.h in Headers */,
F344C75311294D9D00F26EEE /* InspectorFrontendClientLocal.h in Headers */,
7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */,
B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */,
C5A1EA7C152BCF04004D00B6 /* SimplifyMarkupCommand.cpp in Sources */,
FD00D7A414A3F61900734011 /* SincResampler.cpp in Sources */,
+ A5A2AF0B1829734300DE1729 /* PageDebuggable.cpp in Sources */,
51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */,
49E911CC0EF86D47009D0CAF /* SkewTransformOperation.cpp in Sources */,
4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */,
{
Base::finishCreation(vm);
ASSERT(inherits(info()));
+
+#if ENABLE(REMOTE_INSPECTOR)
+ setRemoteDebuggingEnabled(false);
+#endif
}
void JSDOMGlobalObject::finishCreation(VM& vm, JSObject* thisValue)
{
Base::finishCreation(vm, thisValue);
ASSERT(inherits(info()));
+
+#if ENABLE(REMOTE_INSPECTOR)
+ setRemoteDebuggingEnabled(false);
+#endif
}
ScriptExecutionContext* JSDOMGlobalObject::scriptExecutionContext() const
#include "InspectorAgent.h"
#include "InspectorValues.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
#include "InspectorFrontend.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
#if ENABLE(INSPECTOR)
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include "InspectorValues.h"
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
virtual void highlight() = 0;
virtual void hideHighlight() = 0;
+ virtual void indicate() { }
+ virtual void hideIndication() { }
+
virtual bool canClearBrowserCache() { return false; }
virtual void clearBrowserCache() { }
virtual bool canClearBrowserCookies() { return false; }
, m_page(page)
, m_inspectorClient(inspectorClient)
, m_isUnderTest(false)
+#if ENABLE(REMOTE_INSPECTOR)
+ , m_hasRemoteFrontend(false)
+#endif
{
OwnPtr<InspectorAgent> inspectorAgentPtr(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get()));
m_inspectorAgent = inspectorAgentPtr.get();
m_agents.append(profilerAgentPtr.release());
m_agents.append(InspectorHeapProfilerAgent::create(m_instrumentingAgents.get(), m_injectedScriptManager.get()));
-
#endif
m_agents.append(InspectorWorkerAgent::create(m_instrumentingAgents.get()));
m_inspectorFrontendClient = inspectorFrontendClient;
}
+bool InspectorController::hasLocalFrontend() const
+{
+#if ENABLE(REMOTE_INSPECTOR)
+ return hasFrontend() && !m_hasRemoteFrontend;
+#else
+ return hasFrontend();
+#endif
+}
+
+bool InspectorController::hasRemoteFrontend() const
+{
+#if ENABLE(REMOTE_INSPECTOR)
+ return m_hasRemoteFrontend;
+#else
+ return false;
+#endif
+}
+
bool InspectorController::hasInspectorFrontendClient() const
{
return m_inspectorFrontendClient;
InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents.get());
InspectorInstrumentation::frontendCreated();
+
+#if ENABLE(REMOTE_INSPECTOR)
+ if (!m_hasRemoteFrontend)
+ m_page->remoteInspectorInformationDidChange();
+#endif
}
void InspectorController::disconnectFrontend()
m_overlay->freePage();
InspectorInstrumentation::frontendDeleted();
InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgents.get());
+
+#if ENABLE(REMOTE_INSPECTOR)
+ if (!m_hasRemoteFrontend)
+ m_page->remoteInspectorInformationDidChange();
+#endif
}
void InspectorController::show()
{
+ ASSERT(!hasRemoteFrontend());
+
if (!enabled())
return;
if (!enabled())
return;
- show();
+ if (!hasRemoteFrontend())
+ show();
m_domAgent->inspect(node);
}
return m_overlay->highlightedNode();
}
+void InspectorController::setIndicating(bool indicating)
+{
+ // FIXME: For non-iOS clients, we should have InspectorOverlay do something here.
+ if (indicating)
+ m_inspectorClient->indicate();
+ else
+ m_inspectorClient->hideIndication();
+}
+
#if ENABLE(JAVASCRIPT_DEBUGGER)
bool InspectorController::profilerEnabled() const
{
void dispatchMessageFromFrontend(const String& message);
+ bool hasFrontend() const { return !!m_inspectorFrontendChannel; }
+ bool hasLocalFrontend() const;
+ bool hasRemoteFrontend() const;
+
void connectFrontend(InspectorFrontendChannel*);
void disconnectFrontend();
void setProcessId(long);
+#if ENABLE(REMOTE_INSPECTOR)
+ void setHasRemoteFrontend(bool hasRemote) { m_hasRemoteFrontend = hasRemote; }
+#endif
+
void inspect(Node*);
void drawHighlight(GraphicsContext&) const;
void getHighlight(Highlight*) const;
void hideHighlight();
Node* highlightedNode() const;
+ void setIndicating(bool);
+
PassRefPtr<InspectorObject> buildObjectForHighlightedNode() const;
bool isUnderTest();
InspectorClient* m_inspectorClient;
InspectorAgentRegistry m_agents;
bool m_isUnderTest;
+
+#if ENABLE(REMOTE_INSPECTOR)
+ bool m_hasRemoteFrontend;
+#endif
};
}
/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-class WebInspectorClient;
-@class WebInspectorServerWebViewConnection;
+#ifndef InspectorForwarding_h
+#define InspectorForwarding_h
-@interface WebInspectorRemoteChannel : NSObject {
-@private
- WebInspectorServerWebViewConnection *_remote;
- WebInspectorClient* _local;
-}
-
-+ (WebInspectorRemoteChannel *)createChannelForPageId:(unsigned)pageId connection:(WebInspectorServerWebViewConnection *)connection;
+#include <inspector/InspectorFrontendChannel.h>
-- (void)closeFromLocalSide;
-- (void)closeFromRemoteSide;
-- (void)sendMessageToFrontend:(NSString *)message;
-- (void)sendMessageToBackend:(NSString *)message;
+namespace WebCore {
+class InspectorFrontendChannel : public Inspector::InspectorFrontendChannel { };
+}
-@end
+#endif // !defined(InspectorForwarding_h)
#include "InspectorWorkerAgent.h"
+#include "InspectorForwarding.h"
#include "InspectorFrontend.h"
-#include "InspectorFrontendChannel.h"
#include "InspectorValues.h"
#include "InstrumentingAgents.h"
#include "URL.h"
#include "InspectorBackendDispatchers.h"
#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
+#include "InspectorForwarding.h"
#include "InspectorFrontend.h"
-#include "InspectorFrontendChannel.h"
#include "InspectorHeapProfilerAgent.h"
#include "InspectorProfilerAgent.h"
#include "InspectorTimelineAgent.h"
m_client.setMainFrameDocumentReady(true); // update observers with new DOMDocument
m_client.dispatchDidReceiveTitle(loader->title());
}
+
+#if ENABLE(REMOTE_INSPECTOR)
+ if (m_frame.isMainFrame())
+ m_frame.page()->remoteInspectorInformationDidChange();
+#endif
}
void FrameLoader::didChangeIcons(IconType type)
InspectorInstrumentation::didCommitLoad(&m_frame, m_documentLoader.get());
- if (m_frame.isMainFrame())
+ if (m_frame.isMainFrame()) {
m_frame.page()->featureObserver()->didCommitLoad();
-
+#if ENABLE(REMOTE_INSPECTOR)
+ m_frame.page()->remoteInspectorInformationDidChange();
+#endif
+ }
}
void FrameLoader::tellClientAboutPastMemoryCacheLoads()
#endif
} else {
#if ENABLE(INSPECTOR)
- if (!(frame->page() && frame->page()->inspectorController()->hasInspectorFrontendClient())) {
+ if (!(frame->page() && (frame->page()->inspectorController()->hasInspectorFrontendClient() || frame->page()->inspectorController()->hasRemoteFrontend()))) {
#endif
// In GTK+ unavailable items are not hidden but insensitive.
#include "PageActivityAssertionToken.h"
#include "PageCache.h"
#include "PageConsole.h"
+#include "PageDebuggable.h"
#include "PageGroup.h"
#include "PageThrottler.h"
#include "PlugInClient.h"
, m_scriptedAnimationsSuspended(false)
, m_pageThrottler(std::make_unique<PageThrottler>(*this))
, m_console(std::make_unique<PageConsole>(*this))
+#if ENABLE(REMOTE_INSPECTOR)
+ , m_inspectorDebuggable(std::make_unique<PageDebuggable>(*this))
+#endif
, m_lastSpatialNavigationCandidatesCount(0) // NOTE: Only called from Internals for Spatial Navigation testing.
, m_framesHandlingBeforeUnloadEvent(0)
{
#ifndef NDEBUG
pageCounter.increment();
#endif
+
+#if ENABLE(REMOTE_INSPECTOR)
+ m_inspectorDebuggable->init();
+#endif
}
Page::~Page()
}
#endif
+#if ENABLE(REMOTE_INSPECTOR)
+bool Page::remoteInspectionAllowed() const
+{
+ return m_inspectorDebuggable->remoteDebuggingAllowed();
+}
+
+void Page::setRemoteInspectionAllowed(bool allowed)
+{
+ m_inspectorDebuggable->setRemoteDebuggingAllowed(allowed);
+}
+
+void Page::remoteInspectorInformationDidChange() const
+{
+ m_inspectorDebuggable->update();
+}
+#endif
+
void Page::addLayoutMilestones(LayoutMilestones milestones)
{
// In the future, we may want a function that replaces m_layoutMilestones instead of just adding to it.
class Node;
class PageActivityAssertionToken;
class PageConsole;
+class PageDebuggable;
class PageGroup;
class PageThrottler;
class PlugInClient;
void decrementSubframeCount() { ASSERT(m_subframeCount); --m_subframeCount; }
int subframeCount() const { checkSubframeCountConsistency(); return m_subframeCount; }
+#if ENABLE(REMOTE_INSPECTOR)
+ bool remoteInspectionAllowed() const;
+ void setRemoteInspectionAllowed(bool);
+ void remoteInspectorInformationDidChange() const;
+#endif
+
Chrome& chrome() const { return *m_chrome; }
DragCaretController& dragCaretController() const { return *m_dragCaretController; }
#if ENABLE(DRAG_SUPPORT)
const std::unique_ptr<PageThrottler> m_pageThrottler;
const std::unique_ptr<PageConsole> m_console;
+#if ENABLE(REMOTE_INSPECTOR)
+ const std::unique_ptr<PageDebuggable> m_inspectorDebuggable;
+#endif
+
HashSet<String> m_seenPlugins;
HashSet<String> m_seenMediaEngines;
--- /dev/null
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PageDebuggable.h"
+
+#if ENABLE(REMOTE_INSPECTOR)
+
+#include "Document.h"
+#include "InspectorController.h"
+#include "InspectorForwarding.h"
+#include "MainFrame.h"
+#include "Page.h"
+
+using namespace Inspector;
+
+namespace WebCore {
+
+PageDebuggable::PageDebuggable(Page& page)
+ : m_page(page)
+{
+}
+
+String PageDebuggable::name() const
+{
+ if (!m_page.mainFrame().document())
+ return String();
+
+ return m_page.mainFrame().document()->title();
+}
+
+String PageDebuggable::url() const
+{
+ if (!m_page.mainFrame().document())
+ return String();
+
+ String url = m_page.mainFrame().document()->url().string();
+ return url.isEmpty() ? ASCIILiteral("about:blank") : url;
+}
+
+bool PageDebuggable::hasLocalDebugger() const
+{
+ return m_page.inspectorController()->hasLocalFrontend();
+}
+
+void PageDebuggable::connect(Inspector::InspectorFrontendChannel* channel)
+{
+ InspectorController* inspectorController = m_page.inspectorController();
+ inspectorController->setHasRemoteFrontend(true);
+ inspectorController->connectFrontend(reinterpret_cast<WebCore::InspectorFrontendChannel*>(channel));
+}
+
+void PageDebuggable::disconnect()
+{
+ InspectorController* inspectorController = m_page.inspectorController();
+ inspectorController->disconnectFrontend();
+ inspectorController->setHasRemoteFrontend(false);
+}
+
+void PageDebuggable::dispatchMessageFromRemoteFrontend(const String& message)
+{
+ m_page.inspectorController()->dispatchMessageFromFrontend(message);
+}
+
+void PageDebuggable::setIndicating(bool indicating)
+{
+ m_page.inspectorController()->setIndicating(indicating);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(REMOTE_INSPECTOR)
/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-@class WebInspectorRemoteChannel;
-@class WebInspectorServerWebViewConnectionController;
+#ifndef PageDebuggable_h
+#define PageDebuggable_h
-@interface WebInspectorServerWebViewConnection : NSObject {
-@private
- WebInspectorRemoteChannel *_channel;
+#if ENABLE(REMOTE_INSPECTOR)
- WebInspectorServerWebViewConnectionController *_controller; // weak, the controller owns us.
- NSString *_connectionIdentifier;
- NSString *_destination;
- NSNumber *_identifier;
-}
+#include <JavaScriptCore/RemoteInspectorDebuggable.h>
+#include <wtf/Noncopyable.h>
-- (id)initWithController:(WebInspectorServerWebViewConnectionController *)controller connectionIdentifier:(NSString *)connectionIdentifier destination:(NSString *)destination identifier:(NSNumber *)identifier;
-- (BOOL)setupChannel;
-- (NSString *)connectionIdentifier;
-- (NSNumber *)identifier;
+namespace WebCore {
-// Messages from the InspectorServer.
-- (void)receivedData:(NSDictionary *)dictionary;
-- (void)receivedDidClose:(NSDictionary *)dictionary;
+class Page;
-// Messages from the Channel.
-- (void)clearChannel;
-- (void)sendMessageToFrontend:(NSString *)message;
+class PageDebuggable FINAL : public Inspector::RemoteInspectorDebuggable {
+ WTF_MAKE_NONCOPYABLE(PageDebuggable);
+public:
+ PageDebuggable(Page&);
+ ~PageDebuggable() { }
-// Messages to the Channel.
-- (void)sendMessageToBackend:(NSString *)message;
+ virtual Inspector::RemoteInspectorDebuggable::DebuggableType type() const OVERRIDE { return Inspector::RemoteInspectorDebuggable::Web; }
-@end
+ virtual String name() const OVERRIDE;
+ virtual String url() const OVERRIDE;
+ virtual bool hasLocalDebugger() const OVERRIDE;
+
+ virtual void connect(Inspector::InspectorFrontendChannel*) OVERRIDE;
+ virtual void disconnect() OVERRIDE;
+ virtual void dispatchMessageFromRemoteFrontend(const String& message) OVERRIDE;
+ virtual void setIndicating(bool) OVERRIDE;
+
+private:
+ Page& m_page;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(REMOTE_INSPECTOR)
+
+#endif // !defined(PageDebuggable_h)
#include "InspectorConsoleAgent.h"
#include "InspectorController.h"
#include "InspectorCounters.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include "InspectorFrontendClientLocal.h"
#include "InspectorInstrumentation.h"
#include "InspectorOverlay.h"
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebKit.xcodeproj/project.pbxproj:
+
2013-12-03 Brent Fulgham <bfulgham@apple.com>
[Win] WebKit.make Makefile doesn't copy resource bundle to DSTROOT
A10C1D8D1820305E0036883A /* WebPDFViewPlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D881820305E0036883A /* WebPDFViewPlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; };
A10C1D8E1820305E0036883A /* WebPDFViewPlaceholder.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D891820305E0036883A /* WebPDFViewPlaceholder.mm */; };
A17A11B1180DC84800E5498C /* WebPluginPackagePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A17A11B0180DC84800E5498C /* WebPluginPackagePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A5214FC713B975C8000015EF /* WebInspectorRemoteChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = A5214FC113B975C8000015EF /* WebInspectorRemoteChannel.h */; };
- A5214FC813B975C8000015EF /* WebInspectorRemoteChannel.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5214FC213B975C8000015EF /* WebInspectorRemoteChannel.mm */; };
- A52209F813C53E75004BA7B1 /* WebInspectorRelayDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = A52209F713C53E75004BA7B1 /* WebInspectorRelayDefinitions.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A55E20FF14D7264C0031549E /* WebInspectorServerWebViewConnectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = A55E20FD14D7264C0031549E /* WebInspectorServerWebViewConnectionController.h */; };
- A55E210014D7264C0031549E /* WebInspectorServerWebViewConnectionController.mm in Sources */ = {isa = PBXBuildFile; fileRef = A55E20FE14D7264C0031549E /* WebInspectorServerWebViewConnectionController.mm */; };
A560946614D8AD2600799A8A /* WebIndicateLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = A560946414D8AD2600799A8A /* WebIndicateLayer.h */; };
A560946714D8AD2600799A8A /* WebIndicateLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A560946514D8AD2600799A8A /* WebIndicateLayer.mm */; };
A5687BDA135B791A0074CBCB /* WebNodeHighlighter.h in Headers */ = {isa = PBXBuildFile; fileRef = A5687BD8135B791A0074CBCB /* WebNodeHighlighter.h */; };
A5687BDB135B791A0074CBCB /* WebNodeHighlighter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5687BD9135B791A0074CBCB /* WebNodeHighlighter.mm */; };
- A57C28A713BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = A57C28A113BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.h */; };
- A57C28A813BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.mm in Sources */ = {isa = PBXBuildFile; fileRef = A57C28A213BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.mm */; };
- A57C28A913BAA5AD0070ACAB /* WebInspectorServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A57C28A313BAA5AD0070ACAB /* WebInspectorServer.h */; };
- A57C28AA13BAA5AD0070ACAB /* WebInspectorServer.mm in Sources */ = {isa = PBXBuildFile; fileRef = A57C28A413BAA5AD0070ACAB /* WebInspectorServer.mm */; };
- A57C28AB13BAA5AD0070ACAB /* WebInspectorXPCWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A57C28A513BAA5AD0070ACAB /* WebInspectorXPCWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A57C28AC13BAA5AD0070ACAB /* WebInspectorXPCWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = A57C28A613BAA5AD0070ACAB /* WebInspectorXPCWrapper.m */; };
A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A57E2F22120749E600048DF3 /* WebQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
- A57EB78F13B97A4E008D691D /* WebInspectorClientRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = A57EB78D13B97A4E008D691D /* WebInspectorClientRegistry.h */; };
- A57EB79013B97A4E008D691D /* WebInspectorClientRegistry.mm in Sources */ = {isa = PBXBuildFile; fileRef = A57EB78E13B97A4E008D691D /* WebInspectorClientRegistry.mm */; };
A58A5799143E727000125F50 /* WebOpenPanelResultListener.h in Headers */ = {isa = PBXBuildFile; fileRef = A58A5797143E727000125F50 /* WebOpenPanelResultListener.h */; };
A58A579A143E727000125F50 /* WebOpenPanelResultListener.mm in Sources */ = {isa = PBXBuildFile; fileRef = A58A5798143E727000125F50 /* WebOpenPanelResultListener.mm */; };
A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */; };
A10C1D891820305E0036883A /* WebPDFViewPlaceholder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPDFViewPlaceholder.mm; path = ios/WebView/WebPDFViewPlaceholder.mm; sourceTree = SOURCE_ROOT; };
A10C1D8F1820307D0036883A /* WebKit.iOS.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; name = WebKit.iOS.exp; path = ios/WebKit.iOS.exp; sourceTree = "<group>"; };
A17A11B0180DC84800E5498C /* WebPluginPackagePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginPackagePrivate.h; sourceTree = "<group>"; };
- A5214FC113B975C8000015EF /* WebInspectorRemoteChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorRemoteChannel.h; path = remote/WebInspectorRemoteChannel.h; sourceTree = "<group>"; };
- A5214FC213B975C8000015EF /* WebInspectorRemoteChannel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorRemoteChannel.mm; path = remote/WebInspectorRemoteChannel.mm; sourceTree = "<group>"; };
- A52209F713C53E75004BA7B1 /* WebInspectorRelayDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorRelayDefinitions.h; path = remote/WebInspectorRelayDefinitions.h; sourceTree = "<group>"; };
- A55E20FD14D7264C0031549E /* WebInspectorServerWebViewConnectionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorServerWebViewConnectionController.h; path = remote/WebInspectorServerWebViewConnectionController.h; sourceTree = "<group>"; };
- A55E20FE14D7264C0031549E /* WebInspectorServerWebViewConnectionController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorServerWebViewConnectionController.mm; path = remote/WebInspectorServerWebViewConnectionController.mm; sourceTree = "<group>"; };
A560946414D8AD2600799A8A /* WebIndicateLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebIndicateLayer.h; sourceTree = "<group>"; };
A560946514D8AD2600799A8A /* WebIndicateLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebIndicateLayer.mm; sourceTree = "<group>"; };
A5687BD8135B791A0074CBCB /* WebNodeHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNodeHighlighter.h; sourceTree = "<group>"; };
A5687BD9135B791A0074CBCB /* WebNodeHighlighter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNodeHighlighter.mm; sourceTree = "<group>"; };
- A57C28A113BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorServerWebViewConnection.h; path = remote/WebInspectorServerWebViewConnection.h; sourceTree = "<group>"; };
- A57C28A213BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorServerWebViewConnection.mm; path = remote/WebInspectorServerWebViewConnection.mm; sourceTree = "<group>"; };
- A57C28A313BAA5AD0070ACAB /* WebInspectorServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorServer.h; path = remote/WebInspectorServer.h; sourceTree = "<group>"; };
- A57C28A413BAA5AD0070ACAB /* WebInspectorServer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorServer.mm; path = remote/WebInspectorServer.mm; sourceTree = "<group>"; };
- A57C28A513BAA5AD0070ACAB /* WebInspectorXPCWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorXPCWrapper.h; path = remote/WebInspectorXPCWrapper.h; sourceTree = "<group>"; };
- A57C28A613BAA5AD0070ACAB /* WebInspectorXPCWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebInspectorXPCWrapper.m; path = remote/WebInspectorXPCWrapper.m; sourceTree = "<group>"; };
A57E2F22120749E600048DF3 /* WebQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebQuotaManager.h; sourceTree = "<group>"; };
- A57EB78D13B97A4E008D691D /* WebInspectorClientRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebInspectorClientRegistry.h; path = remote/WebInspectorClientRegistry.h; sourceTree = "<group>"; };
- A57EB78E13B97A4E008D691D /* WebInspectorClientRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorClientRegistry.mm; path = remote/WebInspectorClientRegistry.mm; sourceTree = "<group>"; };
A58A5797143E727000125F50 /* WebOpenPanelResultListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebOpenPanelResultListener.h; sourceTree = "<group>"; };
A58A5798143E727000125F50 /* WebOpenPanelResultListener.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebOpenPanelResultListener.mm; sourceTree = "<group>"; };
A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; };
1C68F63F095B5F9C00C2984E /* WebInspector */ = {
isa = PBXGroup;
children = (
- A5214FBF13B97596000015EF /* remote */,
5D7BF8120C2A1D90008CE06D /* WebInspector.h */,
5D7BF8130C2A1D90008CE06D /* WebInspector.mm */,
B804176D1217A83100466BAE /* WebInspectorFrontend.h */,
name = ios;
sourceTree = "<group>";
};
- A5214FBF13B97596000015EF /* remote */ = {
- isa = PBXGroup;
- children = (
- A57EB78D13B97A4E008D691D /* WebInspectorClientRegistry.h */,
- A57EB78E13B97A4E008D691D /* WebInspectorClientRegistry.mm */,
- A52209F713C53E75004BA7B1 /* WebInspectorRelayDefinitions.h */,
- A5214FC113B975C8000015EF /* WebInspectorRemoteChannel.h */,
- A5214FC213B975C8000015EF /* WebInspectorRemoteChannel.mm */,
- A57C28A313BAA5AD0070ACAB /* WebInspectorServer.h */,
- A57C28A413BAA5AD0070ACAB /* WebInspectorServer.mm */,
- A57C28A113BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.h */,
- A57C28A213BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.mm */,
- A55E20FD14D7264C0031549E /* WebInspectorServerWebViewConnectionController.h */,
- A55E20FE14D7264C0031549E /* WebInspectorServerWebViewConnectionController.mm */,
- A57C28A513BAA5AD0070ACAB /* WebInspectorXPCWrapper.h */,
- A57C28A613BAA5AD0070ACAB /* WebInspectorXPCWrapper.m */,
- );
- name = remote;
- sourceTree = "<group>";
- };
F52CA6BD02DF9D0F018635CA /* HTML */ = {
isa = PBXGroup;
children = (
A10C1D641820300E0036883A /* WebChromeClientIOS.h in Headers */,
5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */,
06693DDC0BFBA85200216072 /* WebInspectorClient.h in Headers */,
- A57EB78F13B97A4E008D691D /* WebInspectorClientRegistry.h in Headers */,
B804176F1217A83100466BAE /* WebInspectorFrontend.h in Headers */,
7A8FF0D11075024A00A80A08 /* WebInspectorPrivate.h in Headers */,
- A52209F813C53E75004BA7B1 /* WebInspectorRelayDefinitions.h in Headers */,
- A5214FC713B975C8000015EF /* WebInspectorRemoteChannel.h in Headers */,
- A57C28A913BAA5AD0070ACAB /* WebInspectorServer.h in Headers */,
- A57C28A713BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.h in Headers */,
- A55E20FF14D7264C0031549E /* WebInspectorServerWebViewConnectionController.h in Headers */,
- A57C28AB13BAA5AD0070ACAB /* WebInspectorXPCWrapper.h in Headers */,
939810420824BF01008DF038 /* WebJavaScriptTextInputPanel.h in Headers */,
37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */,
939810850824BF01008DF038 /* WebKeyGenerator.h in Headers */,
5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */,
06693DDD0BFBA85200216072 /* WebInspectorClient.mm in Sources */,
1C7B0C660EB2464D00A28502 /* WebInspectorClientCF.cpp in Sources */,
- A57EB79013B97A4E008D691D /* WebInspectorClientRegistry.mm in Sources */,
B80417701217A83100466BAE /* WebInspectorFrontend.mm in Sources */,
- A5214FC813B975C8000015EF /* WebInspectorRemoteChannel.mm in Sources */,
- A57C28AA13BAA5AD0070ACAB /* WebInspectorServer.mm in Sources */,
- A57C28A813BAA5AD0070ACAB /* WebInspectorServerWebViewConnection.mm in Sources */,
- A55E210014D7264C0031549E /* WebInspectorServerWebViewConnectionController.mm in Sources */,
- A57C28AC13BAA5AD0070ACAB /* WebInspectorXPCWrapper.m in Sources */,
A10C1D1918202F9C0036883A /* WebDefaultFormDelegate.m in Sources */,
939810E40824BF01008DF038 /* WebJavaScriptTextInputPanel.m in Sources */,
A10C1D8B1820305E0036883A /* WebPDFViewIOS.mm in Sources */,
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/InspectorClientBlackBerry.h:
+
2013-12-03 Nick Diego Yamane <nick.yamane@openbossa.org>
Remove some CSS Variables leftovers
#define InspectorClientBlackBerry_h
#include "InspectorClient.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include "InspectorOverlay.h"
#include "InspectorOverlayBlackBerry.h"
#include <wtf/HashMap.h>
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/WebInspectorClientCF.cpp:
+ (WebInspectorClient::sendMessageToFrontend):
+
2013-10-25 Joseph Pecoraro <pecoraro@apple.com>
Upstream ENABLE(REMOTE_INSPECTOR) and enable on iOS and Mac
CFPreferencesSetAppValue(createKeyForPreferences(key).get(), setting.createCFString().get(), kCFPreferencesCurrentApplication);
}
-#if !ENABLE(REMOTE_INSPECTOR)
bool WebInspectorClient::sendMessageToFrontend(const String& message)
{
return doDispatchMessageOnFrontendPage(m_frontendPage, message);
}
-#endif
bool WebInspectorClient::inspectorAttachDisabled()
{
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/InspectorClientEfl.h:
+
2013-11-23 Xabier Rodriguez Calvar <calvaris@igalia.com>
[GStreamer] Remove 0.10 codepath
#if ENABLE(INSPECTOR)
#include "InspectorClient.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include "InspectorFrontendClientLocal.h"
#include <Evas.h>
#include <wtf/Forward.h>
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/InspectorClientGtk.h:
+
2013-12-02 Gustavo Noronha Silva <gustavo.noronha@collabora.com>
[GTK] GTK2 paint code path does not render AC layers
#define InspectorClientGtk_h
#include "InspectorClient.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
#include "InspectorFrontendClientLocal.h"
#include "webkitwebinspector.h"
#include "webkitwebview.h"
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/WebInspectorClientIOS.mm:
+ (WebInspectorClient::WebInspectorClient):
+ (WebInspectorClient::inspectorDestroyed):
+
2013-12-03 Ralph Thomas <ralpht@gmail.com>
Typo: FixedPositionConstaint -> FixedPositionConstraint
#import <WebCore/WebCoreThread.h>
#import <wtf/PassOwnPtr.h>
-#if ENABLE(REMOTE_INSPECTOR)
-#import "WebInspectorClientRegistry.h"
-#import "WebInspectorRemoteChannel.h"
-#endif
-
using namespace WebCore;
WebInspectorClient::WebInspectorClient(WebView *webView)
, m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView])
, m_frontendPage(0)
, m_frontendClient(0)
-#if ENABLE(REMOTE_INSPECTOR)
- , m_remoteChannel(0)
- , m_pageId(0)
-#endif
{
-#if ENABLE(REMOTE_INSPECTOR)
- [[WebInspectorClientRegistry sharedRegistry] registerClient:this];
-#endif
}
void WebInspectorClient::inspectorDestroyed()
{
-#if ENABLE(REMOTE_INSPECTOR)
- [[WebInspectorClientRegistry sharedRegistry] unregisterClient:this];
- teardownRemoteConnection(true);
-#endif
-
delete this;
}
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:WebInspectorDidStopSearchingForNode object:inspector];
}
-#pragma mark -
-#pragma mark Remote Web Inspector Implementation
-
-#if ENABLE(REMOTE_INSPECTOR)
-bool WebInspectorClient::sendMessageToFrontend(const String& message)
-{
- if (m_remoteChannel) {
- [m_remoteChannel sendMessageToFrontend:message];
- return true;
- }
-
- // iOS does not have a local inspector. There should be no way to reach this.
- ASSERT_NOT_REACHED();
- notImplemented();
-
- return doDispatchMessageOnFrontendPage(m_frontendPage, message);
-}
-
-void WebInspectorClient::sendMessageToBackend(const String& message)
-{
- ASSERT(m_remoteChannel);
-
- Page* page = core(m_webView);
- page->inspectorController()->dispatchMessageFromFrontend(message);
-}
-
-bool WebInspectorClient::setupRemoteConnection(WebInspectorRemoteChannel *remoteChannel)
-{
- // There is already a local session, do not allow a remote session.
- if (hasLocalSession())
- return false;
-
- // There is already a remote session, do not allow a new remote session.
- if (m_remoteChannel)
- return false;
-
- m_remoteChannel = remoteChannel;
-
- Page* page = core(m_webView);
- page->inspectorController()->connectFrontend(this);
-
- // Force developer extras to be enabled in WebCore when a remote connection starts.
- if (page->settings())
- page->settings()->setDeveloperExtrasEnabled(true);
-
- return true;
-}
-
-void WebInspectorClient::teardownRemoteConnection(bool fromLocalSide)
-{
- ASSERT(WebThreadIsLockedOrDisabled());
- if (!m_remoteChannel)
- return;
-
- if (fromLocalSide)
- [m_remoteChannel closeFromLocalSide];
-
- Page* page = core(m_webView);
- if (page) {
- page->inspectorController()->disconnectFrontend();
-
- // Restore developer extras setting in WebCore.
- if (page && page->settings())
- page->settings()->setDeveloperExtrasEnabled([[m_webView preferences] developerExtrasEnabled]);
- }
-
- if (fromLocalSide)
- [m_remoteChannel release];
-
- m_remoteChannel = 0;
-}
-
-bool WebInspectorClient::hasLocalSession() const
-{
- return m_frontendPage != 0;
-}
-
-bool WebInspectorClient::canBeRemotelyInspected() const
-{
- return [m_webView canBeRemotelyInspected];
-}
-
-WebView *WebInspectorClient::inspectedWebView()
-{
- return m_webView;
-}
-#endif
-
#pragma mark -
#pragma mark WebInspectorFrontendClient Implementation
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ Remove the old ENABLE(REMOTE_INSPECTOR) connection management implementation.
+
+ * WebCoreSupport/WebInspectorClient.h:
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::indicate):
+ (WebInspectorClient::hideIndicate):
+ Hook up WebView indication through this new path.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::dispatchDidReceiveTitle):
+ * WebCoreSupport/WebInspectorClient.h:
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::WebInspectorClient):
+ (WebInspectorClient::inspectorDestroyed):
+ * WebInspector/remote/WebInspectorClientRegistry.h: Removed.
+ * WebInspector/remote/WebInspectorClientRegistry.mm: Removed.
+ * WebInspector/remote/WebInspectorRelayDefinitions.h: Removed.
+ * WebInspector/remote/WebInspectorRemoteChannel.h: Removed.
+ * WebInspector/remote/WebInspectorRemoteChannel.mm: Removed.
+ * WebInspector/remote/WebInspectorServer.h: Removed.
+ * WebInspector/remote/WebInspectorServer.mm: Removed.
+ * WebInspector/remote/WebInspectorServerWebViewConnection.h: Removed.
+ * WebInspector/remote/WebInspectorServerWebViewConnection.mm: Removed.
+ * WebInspector/remote/WebInspectorServerWebViewConnectionController.h: Removed.
+ * WebInspector/remote/WebInspectorServerWebViewConnectionController.mm: Removed.
+ * WebInspector/remote/WebInspectorXPCWrapper.h: Removed.
+ * WebInspector/remote/WebInspectorXPCWrapper.m: Removed.
+ * WebKit.exp:
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (+[WebView _enableRemoteInspector]):
+ (+[WebView _disableRemoteInspector]):
+ (+[WebView _disableAutoStartRemoteInspector]):
+ (+[WebView _isRemoteInspectorEnabled]):
+ (+[WebView _hasRemoteInspectorSession]):
+ (-[WebView allowsRemoteInspection]):
+ (-[WebView setAllowsRemoteInspection:]):
+ (-[WebView setIndicatingForRemoteInspector:]):
+ (-[WebView setHostApplicationBundleId:name:]):
+ (-[WebView _didCommitLoadForFrame:]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ (-[WebViewPrivate init]):
+ (-[WebViewPrivate dealloc]):
+ * WebView/WebViewInternal.h:
+ * WebView/WebViewPrivate.h:
+ Remove old REMOTE_INSPECTOR.
+
2013-12-02 Chris Fleizach <cfleizach@apple.com>
AX: Crash in accessibilityRoot when Document goes away
#import "WebHostedNetscapePluginView.h"
#endif
-#if ENABLE(REMOTE_INSPECTOR)
-#import "WebInspectorServer.h"
-#endif
-
using namespace WebCore;
using namespace HTMLNames;
if (implementations->didReceiveTitleForFrameFunc)
// FIXME: use direction of title.
CallFrameLoadDelegate(implementations->didReceiveTitleForFrameFunc, webView, @selector(webView:didReceiveTitle:forFrame:), (NSString *)title.string(), m_webFrame.get());
-
-#if ENABLE(REMOTE_INSPECTOR)
- BOOL isMainFrame = [webView mainFrame] == m_webFrame.get();
- if (isMainFrame)
- [[WebView sharedWebInspectorServer] pushListing];
-#endif
}
void WebFrameLoaderClient::dispatchDidChangeIcons(WebCore::IconType)
*/
#import <WebCore/InspectorClient.h>
-#import <WebCore/InspectorFrontendChannel.h>
+#import <WebCore/InspectorForwarding.h>
#import <WebCore/InspectorFrontendClientLocal.h>
#import <wtf/Forward.h>
virtual void highlight() OVERRIDE;
virtual void hideHighlight() OVERRIDE;
+ virtual void indicate() OVERRIDE;
+ virtual void hideIndication() OVERRIDE;
+
virtual void didSetSearchingForNode(bool) OVERRIDE;
virtual bool sendMessageToFrontend(const String&) OVERRIDE;
void releaseFrontend();
-#if ENABLE(REMOTE_INSPECTOR)
- void sendMessageToBackend(const String&);
-
- bool setupRemoteConnection(WebInspectorRemoteChannel *remoteChannel);
- void teardownRemoteConnection(bool fromLocalSide);
-
- unsigned pageId() const { return m_pageId; }
- void setPageId(unsigned pageId) { m_pageId = pageId; }
-
- bool hasLocalSession() const;
-
- bool canBeRemotelyInspected() const;
-
- WebView *inspectedWebView();
-#endif
-
private:
PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings();
RetainPtr<WebNodeHighlighter> m_highlighter;
WebCore::Page* m_frontendPage;
WebInspectorFrontendClient* m_frontendClient;
-
-#if ENABLE(REMOTE_INSPECTOR)
- WebInspectorRemoteChannel *m_remoteChannel;
- unsigned m_pageId;
-#endif
};
#import <wtf/PassOwnPtr.h>
#import <wtf/text/Base64.h>
-#if ENABLE(REMOTE_INSPECTOR)
-#import "WebInspectorClientRegistry.h"
-#import "WebInspectorRemoteChannel.h"
-#endif
-
SOFT_LINK_STAGED_FRAMEWORK(WebInspectorUI, PrivateFrameworks, A)
// The margin from the top and right of the dock button (same as the full screen button).
, m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:webView]))
, m_frontendPage(0)
, m_frontendClient(0)
-#if ENABLE(REMOTE_INSPECTOR)
- , m_remoteChannel(0)
- , m_pageId(0)
-#endif
{
-#if ENABLE(REMOTE_INSPECTOR)
- [[WebInspectorClientRegistry sharedRegistry] registerClient:this];
-#endif
}
void WebInspectorClient::inspectorDestroyed()
{
-#if ENABLE(REMOTE_INSPECTOR)
- [[WebInspectorClientRegistry sharedRegistry] unregisterClient:this];
- teardownRemoteConnection(true);
-#endif
-
closeInspectorFrontend();
delete this;
}
[m_highlighter.get() hideHighlight];
}
+void WebInspectorClient::indicate()
+{
+ [m_webView setIndicatingForRemoteInspector:YES];
+}
+
+void WebInspectorClient::hideIndication()
+{
+ [m_webView setIndicatingForRemoteInspector:NO];
+}
+
void WebInspectorClient::didSetSearchingForNode(bool enabled)
{
WebInspector *inspector = [m_webView inspector];
m_frontendPage = 0;
}
-#if ENABLE(REMOTE_INSPECTOR)
-bool WebInspectorClient::sendMessageToFrontend(const String& message)
-{
- if (m_remoteChannel) {
- [m_remoteChannel sendMessageToFrontend:message];
- return true;
- }
-
- return doDispatchMessageOnFrontendPage(m_frontendPage, message);
-}
-
-void WebInspectorClient::sendMessageToBackend(const String& message)
-{
- ASSERT(m_remoteChannel);
-
- Page* page = core(m_webView);
- page->inspectorController()->dispatchMessageFromFrontend(message);
-}
-
-bool WebInspectorClient::setupRemoteConnection(WebInspectorRemoteChannel *remoteChannel)
-{
- // There is already a local session, do not allow a remote session.
- if (hasLocalSession())
- return false;
-
- // There is already a remote session, do not allow a new remote session.
- if (m_remoteChannel)
- return false;
-
- ASSERT([[m_webView preferences] developerExtrasEnabled]);
-
- m_remoteChannel = remoteChannel;
-
- Page* page = core(m_webView);
- page->inspectorController()->connectFrontend(this);
-
- return true;
-}
-
-void WebInspectorClient::teardownRemoteConnection(bool fromLocalSide)
-{
- if (!m_remoteChannel)
- return;
-
- if (fromLocalSide)
- [m_remoteChannel closeFromLocalSide];
-
- if (Page* page = core(m_webView))
- page->inspectorController()->disconnectFrontend();
-
- if (fromLocalSide)
- [m_remoteChannel release];
-
- m_remoteChannel = 0;
-}
-
-bool WebInspectorClient::hasLocalSession() const
-{
- return m_frontendPage != 0;
-}
-
-bool WebInspectorClient::canBeRemotelyInspected() const
-{
- return [m_webView canBeRemotelyInspected];
-}
-
-WebView *WebInspectorClient::inspectedWebView()
-{
- return m_webView;
-}
-#endif
-
WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* windowController, InspectorController* inspectorController, Page* frontendPage, WTF::PassOwnPtr<Settings> settings)
: InspectorFrontendClientLocal(inspectorController, frontendPage, settings)
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import "WebInspectorClientRegistry.h"
-
-#import "WebInspectorClient.h"
-#import "WebViewPrivate.h"
-
-@implementation WebInspectorClientRegistry
-
-@synthesize delegate = _delegate;
-
-+ (WebInspectorClientRegistry *)sharedRegistry
-{
- static WebInspectorClientRegistry *sharedRegistry = [[WebInspectorClientRegistry alloc] init];
- return sharedRegistry;
-}
-
-- (id)init
-{
- self = [super init];
- if (!self)
- return nil;
-
- _nextAvailablePageId = 1;
-
- return self;
-}
-
-- (unsigned)_getNextAvailablePageId
-{
- // Boundary values, 0 and UINT_MAX, are invalid HashMap keys.
- unsigned nextValidPageId;
- do {
- nextValidPageId = _nextAvailablePageId++;
- } while (!nextValidPageId || nextValidPageId == UINT_MAX || _pageClientMap.contains(nextValidPageId));
- return nextValidPageId;
-}
-
-- (void)registerClient:(WebInspectorClient*)client
-{
- unsigned pageId = [self _getNextAvailablePageId];
- _pageClientMap.set(pageId, client);
- client->setPageId(pageId);
- [_delegate didRegisterClient:client];
-}
-
-- (void)unregisterClient:(WebInspectorClient*)client
-{
- unsigned pageId = client->pageId();
- _pageClientMap.remove(pageId);
- [_delegate didUnregisterClient:client];
-}
-
-- (WebInspectorClient*)clientForPageId:(unsigned)pageId
-{
- return _pageClientMap.get(pageId);
-}
-
-- (NSDictionary *)inspectableWebViews
-{
- NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:_pageClientMap.size()];
-
- HashMap<unsigned, WebInspectorClient*>::iterator end = _pageClientMap.end();
- for (HashMap<unsigned, WebInspectorClient*>::iterator it = _pageClientMap.begin(); it != end; ++it) {
- WebView *webView = it->value->inspectedWebView();
- if (![webView canBeRemotelyInspected])
- continue;
-
- NSNumber *pageId = [NSNumber numberWithUnsignedInt:it->key];
- [dictionary setObject:webView forKey:pageId];
- }
-
- return dictionary;
-}
-
-@end
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import "WebInspectorRemoteChannel.h"
-
-#import "WebInspectorClient.h"
-#import "WebInspectorClientRegistry.h"
-#import "WebInspectorServerWebViewConnection.h"
-#import "WebKitLogging.h"
-#import <wtf/text/CString.h>
-
-@interface WebInspectorRemoteChannel ()
-- (id)initWithRemote:(WebInspectorServerWebViewConnection *)remote local:(WebInspectorClient*)local;
-@end
-
-@implementation WebInspectorRemoteChannel
-
-+ (WebInspectorRemoteChannel *)createChannelForPageId:(unsigned)pageId connection:(WebInspectorServerWebViewConnection *)connection
-{
- // Get the Inspector client. Its possible the page closed before the remote client requested it.
- WebInspectorClient *inspectorClient = [[WebInspectorClientRegistry sharedRegistry] clientForPageId:pageId];
- if (!inspectorClient) {
- LOG(RemoteInspector, "WebInspectorRemoteChannel: Page requested no longer exists: (%u)", pageId);
- return nil;
- }
-
- // The WebView does not allow remote inspection.
- if (!inspectorClient->canBeRemotelyInspected()) {
- LOG(RemoteInspector, "WebInspectorRemoteChannel: WebView for Page (%u) does not allow remote inspection.", pageId);
- return nil;
- }
-
- // The channel is released by whichever side closes the channel. The channel could be closed
- // remotely by the socket closing (the user navigating away from the remote inspector page).
- // It could be closed locally by the Page being destroyed, like the browser or tab being closed.
- // Setting up the connection can fail if there is already an existing session.
- WebInspectorRemoteChannel *channel = [[WebInspectorRemoteChannel alloc] initWithRemote:connection local:inspectorClient];
- if (!inspectorClient->setupRemoteConnection(channel)) {
- LOG(RemoteInspector, "WebInspectorRemoteChannel: Setting up a remote session failed. Probably already a local session.");
- [channel release];
- channel = nil;
- return nil;
- }
-
- return channel;
-}
-
-- (id)initWithRemote:(WebInspectorServerWebViewConnection *)remote local:(WebInspectorClient*)local
-{
- self = [super init];
- if (!self)
- return nil;
-
- _remote = remote;
- _local = local;
-
- return self;
-}
-
-- (void)closeFromLocalSide
-{
- // Local side will release. Make sure the remote side clears its reference to the channel.
- [_remote clearChannel];
-}
-
-- (void)closeFromRemoteSide
-{
- // Remote side will release. Make sure the local side clears its reference to the channel.
- _local->teardownRemoteConnection(false);
-}
-
-- (void)sendMessageToFrontend:(NSString *)message
-{
- [_remote sendMessageToFrontend:message];
-}
-
-- (void)sendMessageToBackend:(NSString *)message
-{
- _local->sendMessageToBackend(message);
-}
-
-@end
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WebInspectorClientRegistry.h"
-
-@class WebInspectorServerWebViewConnectionController;
-@class WebInspectorXPCWrapper;
-
-@interface WebInspectorServer : NSObject <WebInspectorClientRegistryDelegate> {
-@private
- BOOL _isEnabled;
- BOOL _hasActiveDebugSession;
- int _notifyToken;
- WebInspectorXPCWrapper *_xpcConnection;
- WebInspectorServerWebViewConnectionController *_connectionController;
-}
-
-- (void)start;
-- (void)stop;
-- (BOOL)isEnabled;
-- (void)pushListing;
-
-- (BOOL)hasActiveDebugSession;
-- (void)setHasActiveDebugSession:(BOOL)hasSession;
-
-- (WebInspectorXPCWrapper *)xpcConnection;
-
-@end
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import "WebInspectorServer.h"
-
-#import "WebInspectorClient.h"
-#import "WebInspectorRelayDefinitions.h"
-#import "WebInspectorServerWebViewConnectionController.h"
-#import "WebInspectorXPCWrapper.h"
-#import "WebViewPrivate.h"
-#import <notify.h>
-#import <xpc/xpc.h>
-
-
-#pragma mark -
-#pragma mark Private Class Details
-
-@interface WebInspectorServer () <WebInspectorXPCWrapperDelegate>
-- (void)setupXPCConnectionIfNeeded;
-- (void)xpcConnection:(WebInspectorXPCWrapper *)connection receivedMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo;
-- (void)xpcConnectionFailed:(WebInspectorXPCWrapper *)connection;
-@end
-
-
-#pragma mark -
-#pragma mark Server Implementation
-
-@implementation WebInspectorServer
-
-- (id)init
-{
- self = [super init];
- if (!self)
- return nil;
-
- _connectionController = [[WebInspectorServerWebViewConnectionController alloc] initWithServer:self];
-
- [[WebInspectorClientRegistry sharedRegistry] setDelegate:self];
-
- return self;
-}
-
-- (void)dealloc
-{
- // Singleton is not expected to be released.
-
- [self stop];
-
- ASSERT(!_xpcConnection);
- [_connectionController release];
-
- [[WebInspectorClientRegistry sharedRegistry] setDelegate:nil];
-
- [super dealloc];
-}
-
-- (void)start
-{
- if (_isEnabled)
- return;
-
- _isEnabled = YES;
-
- notify_register_dispatch(WIRServiceAvailableNotification, &_notifyToken, dispatch_get_main_queue(), ^(int token) {
- [self setupXPCConnectionIfNeeded];
- });
-
- notify_post(WIRServiceAvailabilityCheckNotification);
-}
-
-- (void)stop
-{
- if (!_isEnabled)
- return;
-
- _isEnabled = NO;
-
- [_connectionController closeAllConnections];
-
- if (_xpcConnection) {
- [_xpcConnection close];
- _xpcConnection.delegate = nil;
- [_xpcConnection release];
- _xpcConnection = nil;
- }
-
- notify_cancel(_notifyToken);
-}
-
-- (BOOL)isEnabled
-{
- return _isEnabled;
-}
-
-- (WebInspectorXPCWrapper *)xpcConnection
-{
- return _xpcConnection;
-}
-
-- (void)setupXPCConnectionIfNeeded
-{
- if (_xpcConnection)
- return;
-
- xpc_connection_t connection = xpc_connection_create_mach_service(WIRXPCMachPortName, dispatch_get_main_queue(), 0);
- if (connection) {
- _xpcConnection = [[WebInspectorXPCWrapper alloc] initWithConnection:connection];
- _xpcConnection.delegate = self;
- [_xpcConnection sendMessage:@"syn" userInfo:nil];
- xpc_release(connection);
- }
-}
-
-- (void)pushListing
-{
- if (!_isEnabled || !_xpcConnection)
- return;
-
- [_connectionController pushListing];
-}
-
-- (BOOL)hasActiveDebugSession
-{
- return _hasActiveDebugSession;
-}
-
-- (void)setHasActiveDebugSession:(BOOL)hasSession
-{
- if (_hasActiveDebugSession == hasSession)
- return;
-
- _hasActiveDebugSession = hasSession;
-
- [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewRemoteInspectorHasSessionChangedNotification object:nil];
-}
-
-
-#pragma mark -
-#pragma mark WebInspectorXPCWrapperDelegate Implementation
-
-- (void)xpcConnection:(WebInspectorXPCWrapper *)xpcConnection receivedMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo
-{
- ASSERT(xpcConnection == _xpcConnection);
-
- if ([messageName isEqualToString:WIRPermissionDenied])
- [self stop];
- else
- [_connectionController receivedMessage:messageName userInfo:userInfo];
-}
-
-- (void)xpcConnectionFailed:(WebInspectorXPCWrapper *)connection
-{
- [_connectionController closeAllConnections];
-
- if (_xpcConnection) {
- _xpcConnection.delegate = nil;
- [_xpcConnection release];
- _xpcConnection = nil;
- }
-}
-
-
-#pragma mark -
-#pragma mark WebInspectorClientRegistryDelegate implementation
-
-- (void)didRegisterClient:(WebInspectorClient*)client
-{
- // When a WebView is registered it has no content. But some WebViews
- // never load content from a URL, such as UITextFields on iOS.
- [self pushListing];
-}
-
-- (void)didUnregisterClient:(WebInspectorClient*)client
-{
- [self pushListing];
-}
-
-@end
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import "WebInspectorServerWebViewConnection.h"
-
-#import "WebInspectorClient.h"
-#import "WebInspectorRelayDefinitions.h"
-#import "WebInspectorRemoteChannel.h"
-#import "WebInspectorServer.h"
-#import "WebInspectorServerWebViewConnectionController.h"
-#import "WebInspectorXPCWrapper.h"
-#import "WebKitLogging.h"
-#import <wtf/text/CString.h>
-
-@implementation WebInspectorServerWebViewConnection
-
-- (id)initWithController:(WebInspectorServerWebViewConnectionController *)controller connectionIdentifier:(NSString *)connectionIdentifier destination:(NSString *)destination identifier:(NSNumber *)identifier
-{
- self = [super init];
- if (!self)
- return nil;
-
- _controller = controller;
- _connectionIdentifier = [connectionIdentifier copy];
- _destination = [destination copy];
- _identifier = [identifier copy];
-
- return self;
-}
-
-- (BOOL)setupChannel
-{
- ASSERT(!_channel);
- unsigned pageId = [_identifier unsignedIntValue];
- _channel = [WebInspectorRemoteChannel createChannelForPageId:pageId connection:self];
- return _channel != nil;
-}
-
-- (void)dealloc
-{
- ASSERT(!_channel);
- [_connectionIdentifier release];
- [_destination release];
- [_identifier release];
- [super dealloc];
-}
-
-- (NSString *)connectionIdentifier
-{
- return [[_connectionIdentifier copy] autorelease];
-}
-
-- (NSNumber *)identifier
-{
- return [[_identifier copy] autorelease];
-}
-
-
-#pragma mark -
-#pragma mark Interaction with the channel to the local inspector backend
-
-- (void)clearChannel
-{
- _channel = nil;
- [_controller connectionClosing:self];
-}
-
-- (void)sendMessageToFrontend:(NSString *)message
-{
- NSData *data = [message dataUsingEncoding:NSUTF8StringEncoding];
- NSDictionary *outgoing = [NSDictionary dictionaryWithObjectsAndKeys:
- data, WIRRawDataKey,
- _connectionIdentifier, WIRConnectionIdentifierKey,
- _destination, WIRDestinationKey,
- nil];
-
- [_controller sendMessageToFrontend:WIRRawDataMessage userInfo:outgoing];
-}
-
-- (void)sendMessageToBackend:(NSString *)message
-{
- ASSERT(_channel);
- LOG(RemoteInspector, "WebInspectorServerConnection: Received: |%s|", String(message).utf8().data());
-
- [_channel sendMessageToBackend:message];
-}
-
-
-#pragma mark -
-#pragma mark Interaction with the server to the remote inspector frontend
-
-- (void)receivedData:(NSDictionary *)dictionary
-{
- NSData *data = [dictionary objectForKey:WIRSocketDataKey];
- NSString *message = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- [self sendMessageToBackend:message];
- [message release];
-}
-
-- (void)receivedDidClose:(NSDictionary *)dictionary
-{
- if (_channel) {
- [_channel closeFromRemoteSide];
- [_channel release];
- _channel = nil;
- }
-}
-
-@end
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2012 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import "WebInspectorServerWebViewConnectionController.h"
-
-#import "WebInspectorClient.h"
-#import "WebInspectorClientRegistry.h"
-#import "WebInspectorRelayDefinitions.h"
-#import "WebInspectorServer.h"
-#import "WebInspectorServerWebViewConnection.h"
-#import "WebInspectorXPCWrapper.h"
-#import "WebView.h"
-#import "WebViewPrivate.h"
-
-#if PLATFORM(IOS)
-#import <WebCore/WebCoreThread.h>
-#import <WebCore/WebCoreThreadRun.h>
-#endif
-
-
-@implementation WebInspectorServerWebViewConnectionController
-
-- (id)initWithServer:(WebInspectorServer *)server
-{
- self = [super init];
- if (!self)
- return nil;
-
- _server = server;
-
- return self;
-}
-
-- (void)dealloc
-{
- ASSERT(![_openConnections count]);
- [_openConnections release];
-
- [super dealloc];
-}
-
-- (void)closeAllConnections
-{
-#if PLATFORM(IOS)
- WebThreadRun(^{
-#endif
-
- for (NSNumber *key in _openConnections) {
- WebInspectorServerWebViewConnection *connection = [_openConnections objectForKey:key];
- [connection receivedDidClose:nil];
- }
- [_openConnections removeAllObjects];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [_server setHasActiveDebugSession:NO];
- });
-
-#if PLATFORM(IOS)
- });
-#endif
-}
-
-- (NSDictionary *)_listingForWebView:(WebView *)webView pageId:(NSNumber *)pageId registry:(WebInspectorClientRegistry *)registry
-{
- NSMutableDictionary *webViewDetails = [NSMutableDictionary dictionary];
-
- // Page ID.
- [webViewDetails setObject:pageId forKey:WIRPageIdentifierKey];
-
- // URL.
- NSString *url = [webView mainFrameURL];
- if (!url)
- url = @"about:blank";
- [webViewDetails setObject:url forKey:WIRURLKey];
-
- // Title.
- NSString *title = [webView mainFrameTitle];
- [webViewDetails setObject:title forKey:WIRTitleKey];
-
- // [Optional] Connection Identifier (Remote Debugger UUID).
- // [Optional] Has Local Debugger Session.
- WebInspectorServerWebViewConnection *connection = [_openConnections objectForKey:pageId];
- if (connection)
- [webViewDetails setObject:connection.connectionIdentifier forKey:WIRConnectionIdentifierKey];
- else {
- WebInspectorClient* inspectorClient = [registry clientForPageId:[pageId unsignedIntValue]];
- if (inspectorClient->hasLocalSession())
- [webViewDetails setObject:[NSNumber numberWithBool:YES] forKey:WIRHasLocalDebuggerKey];
- }
-
-#if PLATFORM(IOS)
- // [Optional] Host Application ID.
- NSString *hostApplicationId = [webView hostApplicationBundleId];
- if (hostApplicationId)
- [webViewDetails setObject:hostApplicationId forKey:WIRHostApplicationIdentifierKey];
-
- // [Optional] Host Application Name.
- NSString *hostApplicationName = [webView hostApplicationName];
- if (hostApplicationName)
- [webViewDetails setObject:hostApplicationName forKey:WIRHostApplicationNameKey];
-#endif
-
- // [Optional] Remote Inspector WebView User Info Dictionary.
- NSDictionary *remoteInspectorUserInfo = [webView remoteInspectorUserInfo];
- if (remoteInspectorUserInfo)
- [webViewDetails setObject:remoteInspectorUserInfo forKey:WIRUserInfoKey];
-
- return webViewDetails;
-}
-
-- (void)_pushListing:(NSString *)optionalConnectionIdentifier
-{
-#if PLATFORM(IOS)
- ASSERT(WebThreadIsCurrent());
-#endif
-
- _hasScheduledPush = NO;
-
- NSMutableDictionary *response = [[NSMutableDictionary alloc] init];
- WebInspectorClientRegistry *webInspectorClientRegistry = [WebInspectorClientRegistry sharedRegistry];
- NSDictionary *registeredViews = [webInspectorClientRegistry inspectableWebViews];
- for (NSNumber *pageId in registeredViews) {
- WebView *webView = [registeredViews objectForKey:pageId];
- NSDictionary *webViewDetails = [self _listingForWebView:webView pageId:pageId registry:webInspectorClientRegistry];
- [response setObject:webViewDetails forKey:[pageId stringValue]];
- }
-
- NSMutableDictionary *outgoing = [[NSMutableDictionary alloc] init];
- [outgoing setObject:response forKey:WIRListingKey];
- if (optionalConnectionIdentifier)
- [outgoing setObject:optionalConnectionIdentifier forKey:WIRConnectionIdentifierKey];
-
- [self sendMessageToFrontend:WIRListingMessage userInfo:outgoing];
-
- [outgoing release];
- [response release];
-}
-
-- (void)pushListing:(NSString *)optionalConnectionIdentifier
-{
-#if PLATFORM(IOS)
- ASSERT(WebThreadIsCurrent());
-#endif
-
- if (_hasScheduledPush)
- return;
-
- if (optionalConnectionIdentifier) {
- [self _pushListing:optionalConnectionIdentifier];
- return;
- }
-
-#if PLATFORM(IOS)
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.2 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
- WebThreadRun(^{
- [self _pushListing:nil];
- });
- });
-#else
- [self performSelector:@selector(_pushListing:) withObject:nil afterDelay:0.2];
-#endif
-
- _hasScheduledPush = YES;
-}
-
-- (void)pushListing
-{
-#if PLATFORM(IOS)
- WebThreadRun(^{
-#endif
-
- [self pushListing:nil];
-
-#if PLATFORM(IOS)
- });
-#endif
-}
-
-- (void)_receivedSetup:(NSDictionary *)dictionary
-{
- NSNumber *pageId = [dictionary objectForKey:WIRPageIdentifierKey];
- if (!pageId)
- return;
-
- NSString *connectionIdentifier = [dictionary objectForKey:WIRConnectionIdentifierKey];
- if (!connectionIdentifier)
- return;
-
- NSString *sender = [dictionary objectForKey:WIRSenderKey];
- if (!sender)
- return;
-
- if (!_openConnections)
- _openConnections = [[NSMutableDictionary alloc] init];
-
- WebInspectorServerWebViewConnection *connection = [[WebInspectorServerWebViewConnection alloc] initWithController:self connectionIdentifier:connectionIdentifier destination:sender identifier:pageId];
- if ([connection setupChannel])
- [_openConnections setObject:connection forKey:pageId];
- [connection release];
-
- if ([_openConnections count] == 1) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [_server setHasActiveDebugSession:YES];
- });
- }
-
- [self pushListing];
-}
-
-- (void)_receivedData:(NSDictionary *)dictionary
-{
- NSNumber *pageId = [dictionary objectForKey:WIRPageIdentifierKey];
- if (!pageId)
- return;
-
- WebInspectorServerWebViewConnection *connection = [_openConnections objectForKey:pageId];
- ASSERT(!connection || [connection isKindOfClass:[WebInspectorServerWebViewConnection class]]);
- if (!connection)
- return;
-
- [connection receivedData:dictionary];
-}
-
-- (void)_receivedDidClose:(NSDictionary *)dictionary
-{
- NSNumber *pageId = [dictionary objectForKey:WIRPageIdentifierKey];
- if (!pageId)
- return;
-
- NSString *connectionIdentifier = [dictionary objectForKey:WIRConnectionIdentifierKey];
- if (!connectionIdentifier)
- return;
-
- WebInspectorServerWebViewConnection *connection = [_openConnections objectForKey:pageId];
- ASSERT(!connection || [connection isKindOfClass:[WebInspectorServerWebViewConnection class]]);
- if (!connection)
- return;
-
- if (![connectionIdentifier isEqualToString:connection.connectionIdentifier])
- return;
-
- [connection receivedDidClose:dictionary];
- [_openConnections removeObjectForKey:pageId];
-
- if (![_openConnections count]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [_server setHasActiveDebugSession:NO];
- });
- }
-
- [self pushListing];
-}
-
-- (void)_receivedGetListing:(NSDictionary *)dictionary
-{
- [self pushListing:[dictionary objectForKey:WIRConnectionIdentifierKey]];
-}
-
-- (void)_receivedIndicate:(NSDictionary *)dictionary
-{
- NSNumber *pageId = [dictionary objectForKey:WIRPageIdentifierKey];
- if (!pageId)
- return;
-
- WebView *webView = [[[WebInspectorClientRegistry sharedRegistry] inspectableWebViews] objectForKey:pageId];
- if (!webView)
- return;
-
- BOOL indicateEnabled = [[dictionary objectForKey:WIRIndicateEnabledKey] boolValue];
- [webView setIndicatingForRemoteInspector:indicateEnabled];
-}
-
-- (void)_receivedConnectionDied:(NSDictionary *)dictionary
-{
- NSString *connectionIdentifier = [dictionary objectForKey:WIRConnectionIdentifierKey];
- if (!connectionIdentifier)
- return;
-
- NSDictionary *connectionsCopy = [[_openConnections copy] autorelease];
- for (NSNumber *key in connectionsCopy) {
- WebInspectorServerWebViewConnection *connection = [connectionsCopy objectForKey:key];
- if ([connection.connectionIdentifier isEqualToString:connectionIdentifier]) {
- [connection receivedDidClose:nil];
- [_openConnections removeObjectForKey:key];
- }
- }
-
- if (![_openConnections count]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [_server setHasActiveDebugSession:NO];
- });
- }
-}
-
-- (void)receivedMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo
-{
-#if PLATFORM(IOS)
- WebThreadRun(^{
-#endif
-
- if ([messageName isEqualToString:WIRSocketSetupMessage])
- [self _receivedSetup:userInfo];
- else if ([messageName isEqualToString:WIRSocketDataMessage])
- [self _receivedData:userInfo];
- else if ([messageName isEqualToString:WIRWebPageCloseMessage])
- [self _receivedDidClose:userInfo];
- else if ([messageName isEqualToString:WIRApplicationGetListingMessage])
- [self _receivedGetListing:userInfo];
- else if ([messageName isEqualToString:WIRIndicateMessage])
- [self _receivedIndicate:userInfo];
- else if ([messageName isEqualToString:WIRConnectionDiedMessage])
- [self _receivedConnectionDied:userInfo];
- else
- NSLog(@"Unrecognized Message: %@", messageName);
-
-#if PLATFORM(IOS)
- });
-#endif
-}
-
-
-#pragma mark -
-#pragma mark WebInspectorServerWebViewConnection interface
-
-- (void)connectionClosing:(WebInspectorServerWebViewConnection *)connection
-{
-#if PLATFORM(IOS)
- WebThreadRun(^{
-#endif
-
- [_openConnections removeObjectForKey:[connection identifier]];
-
- if (![_openConnections count]) {
- dispatch_async(dispatch_get_main_queue(), ^{
- [_server setHasActiveDebugSession:NO];
- });
- }
-
-#if PLATFORM(IOS)
- });
-#endif
-}
-
-
-#pragma mark -
-#pragma mark Thread Safe send message to frontend
-
-- (void)sendMessageToFrontend:(NSString *)messageName userInfo:(NSDictionary *)userInfo
-{
- // This may be called from either the WebThread or the MainThread. This
- // requires access to the WebInspectorServer's XPC Connection, which
- // is managed on the main thread. So, dispatch to the main thread to
- // safely use the xpc connection.
- dispatch_async(dispatch_get_main_queue(), ^{
- [[_server xpcConnection] sendMessage:messageName userInfo:userInfo];
- });
-}
-
-@end
-
-#endif
+++ /dev/null
-/*
- * Copyright (C) 2011 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if ENABLE(REMOTE_INSPECTOR)
-
-#import "WebInspectorXPCWrapper.h"
-
-#import <wtf/Assertions.h>
-
-#if __has_include(<CoreFoundation/CFXPCBridge.h>)
-#include <CoreFoundation/CFXPCBridge.h>
-#else
-extern xpc_object_t _CFXPCCreateXPCMessageWithCFObject(CFTypeRef);
-extern CFTypeRef _CFXPCCreateCFObjectFromXPCMessage(xpc_object_t);
-#endif
-
-// Constants private to this file for message serialization on both ends.
-#define WebInspectorXPCWrapperMessageNameKey @"messageName"
-#define WebInspectorXPCWrapperUserInfoKey @"userInfo"
-#define WebInspectorXPCWrapperSerializedMessageKey "msgData"
-
-@interface WebInspectorXPCWrapper ()
-- (void)_handleEvent:(xpc_object_t)object;
-@end
-
-
-@implementation WebInspectorXPCWrapper
-
-@dynamic available;
-
-@synthesize delegate = _delegate;
-@synthesize connection = _connection;
-@synthesize tag = _tag;
-
-- (WebInspectorXPCWrapper *)initWithConnection:(xpc_connection_t)connection
-{
- self = [super init];
- if (!self)
- return nil;
-
- _connection = xpc_retain(connection);
- xpc_connection_set_target_queue(_connection, dispatch_get_main_queue());
- xpc_connection_set_event_handler(_connection, ^(xpc_object_t object) { [self _handleEvent:object]; });
- xpc_connection_resume(_connection);
-
- return self;
-}
-
-- (void)close
-{
- if (_connection) {
- xpc_connection_cancel(_connection);
- xpc_release(_connection);
- _connection = NULL;
- }
-}
-
-- (void)dealloc
-{
- [self close];
- [_tag release];
- [super dealloc];
-}
-
-- (NSDictionary *)_deserializeMessage:(xpc_object_t)object
-{
- ASSERT_WITH_MESSAGE(xpc_get_type(object) == XPC_TYPE_DICTIONARY, "Got unexpected object from an xpc connection");
- if (xpc_get_type(object) != XPC_TYPE_DICTIONARY)
- return nil;
-
- xpc_object_t xpcDictionary = xpc_dictionary_get_value(object, WebInspectorXPCWrapperSerializedMessageKey);
- if (!xpcDictionary || xpc_get_type(xpcDictionary) != XPC_TYPE_DICTIONARY) {
- // This isn't a message type that we know how to deserialize, so we let our delegate worry about it.
- if ([_delegate respondsToSelector:@selector(xpcConnection:unhandledMessage:)])
- [_delegate xpcConnection:self unhandledMessage:object];
- return nil;
- }
-
- NSDictionary *dictionary = _CFXPCCreateCFObjectFromXPCMessage(xpcDictionary);
- ASSERT_WITH_MESSAGE(dictionary, "Unable to deserialize xpc message");
- if (!dictionary)
- return nil;
-
- return [dictionary autorelease];
-}
-
-- (void)_handleEvent:(xpc_object_t)object
-{
- if (!_connection)
- return;
-
- if (xpc_get_type(object) == XPC_TYPE_ERROR) {
- [_delegate xpcConnectionFailed:self];
- [self close];
- return;
- }
-
- if (!_delegate)
- return;
-
- NSDictionary *dataDictionary = [self _deserializeMessage:object];
- if (!dataDictionary)
- return;
-
- NSString *message = [dataDictionary objectForKey:WebInspectorXPCWrapperMessageNameKey];
- NSDictionary *userInfo = [dataDictionary objectForKey:WebInspectorXPCWrapperUserInfoKey];
- [_delegate xpcConnection:self receivedMessage:message userInfo:userInfo];
-}
-
-- (void)sendMessage:(NSString *)messageName userInfo:(NSDictionary *)userInfo
-{
- if (!_connection)
- return;
-
- NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithObject:messageName forKey:WebInspectorXPCWrapperMessageNameKey];
- if (userInfo)
- [dictionary setObject:userInfo forKey:WebInspectorXPCWrapperUserInfoKey];
-
- xpc_object_t xpcDictionary = _CFXPCCreateXPCMessageWithCFObject((CFDictionaryRef)dictionary);
- ASSERT_WITH_MESSAGE(xpcDictionary && xpc_get_type(xpcDictionary) == XPC_TYPE_DICTIONARY, "Unable to serialize xpc message");
- if (!xpcDictionary)
- return;
-
- xpc_object_t msg = xpc_dictionary_create(NULL, NULL, 0);
- xpc_dictionary_set_value(msg, WebInspectorXPCWrapperSerializedMessageKey, xpcDictionary);
- xpc_release(xpcDictionary);
-
- xpc_connection_send_message(_connection, msg);
-
- xpc_release(msg);
-}
-
-- (BOOL)available
-{
- return _connection != NULL;
-}
-
-@end
-
-#endif
.objc_class_name_WebHistoryItem
.objc_class_name_WebIconDatabase
.objc_class_name_WebInspector
-.objc_class_name_WebInspectorXPCWrapper
.objc_class_name_WebJavaScriptTextInputPanel
.objc_class_name_WebKeyGenerator
.objc_class_name_WebKitStatistics
#endif
#if ENABLE(REMOTE_INSPECTOR)
-#import "WebInspectorServer.h"
#if PLATFORM(IOS)
#import "WebIndicateLayer.h"
#endif
static const char webViewIsOpen[] = "At least one WebView is still open.";
#endif
-#if ENABLE(REMOTE_INSPECTOR)
-static BOOL autoStartRemoteInspector = YES;
-#endif
-
@interface NSObject (WebValidateWithoutDelegate)
- (BOOL)validateUserInterfaceItemWithoutDelegate:(id <NSValidatedUserInterfaceItem>)item;
@end
NSString * const WebViewWillCloseNotification = @"WebViewWillCloseNotification";
#if ENABLE(REMOTE_INSPECTOR)
+// FIXME: Legacy, remove this, switch to something from JavaScriptCore Inspector::RemoteInspectorServer.
NSString *_WebViewRemoteInspectorHasSessionChangedNotification = @"_WebViewRemoteInspectorHasSessionChangedNotification";
#endif
Settings::setShouldRespectPriorityInCSSAttributeSetters(shouldRespectPriorityInCSSAttributeSetters());
-#if ENABLE(REMOTE_INSPECTOR)
- if (autoStartRemoteInspector)
- [WebView _enableRemoteInspector];
-#endif
-
didOneTimeInitialization = true;
}
WebCore::provideUserMediaTo(_private->page, new WebUserMediaClient(self));
#endif
+#if ENABLE(REMOTE_INSPECTOR)
+ _private->page->setRemoteInspectionAllowed(true);
+#endif
+
_private->page->setCanStartMedia([self window]);
_private->page->settings().setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
_private->page->settings().setUseLegacyBackgroundSizeShorthandBehavior(shouldUseLegacyBackgroundSizeShorthandBehavior());
}
#if ENABLE(REMOTE_INSPECTOR)
-+ (WebInspectorServer *)sharedWebInspectorServer
-{
- static WebInspectorServer *sharedServer = [[WebInspectorServer alloc] init];
- return sharedServer;
-}
-
+ (void)_enableRemoteInspector
{
- [[WebView sharedWebInspectorServer] start];
+ // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
}
+ (void)_disableRemoteInspector
{
- [[WebView sharedWebInspectorServer] stop];
+ // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
}
+ (void)_disableAutoStartRemoteInspector
{
- autoStartRemoteInspector = NO;
+ // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
}
+ (BOOL)_isRemoteInspectorEnabled
{
- return [[WebView sharedWebInspectorServer] isEnabled];
+ // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
+ return NO;
}
+ (BOOL)_hasRemoteInspectorSession
{
- return [[WebView sharedWebInspectorServer] hasActiveDebugSession];
-}
-
-- (BOOL)canBeRemotelyInspected
-{
-#if !PLATFORM(IOS)
- if (![[self preferences] developerExtrasEnabled])
- return NO;
-#endif
-
- return [self allowsRemoteInspection];
+ // FIXME: Move this to a new Inspector::RemoteInspectorServer interface or remove it.
+ return NO;
}
- (BOOL)allowsRemoteInspection
{
- return _private->allowsRemoteInspection;
+ // FIXME: Move this to a new API.
+ return NO;
}
- (void)setAllowsRemoteInspection:(BOOL)allow
{
- if (_private->allowsRemoteInspection == allow)
- return;
-
- _private->allowsRemoteInspection = allow;
-
- [[WebView sharedWebInspectorServer] pushListing];
+ // FIXME: Move this to a new API.
}
- (void)setIndicatingForRemoteInspector:(BOOL)enabled
_private->indicateLayer = nil;
}
#else
- // FIXME: Needs implementation.
+ // FIXME: Needs implementation or put an implementation in WebCore::InspectorOverlay.
#endif
}
-- (void)setRemoteInspectorUserInfo:(NSDictionary *)userInfo
-{
- if ([_private->remoteInspectorUserInfo isEqualToDictionary:userInfo])
- return;
-
- [_private->remoteInspectorUserInfo release];
- _private->remoteInspectorUserInfo = [userInfo copy];
-
- [[WebView sharedWebInspectorServer] pushListing];
-}
-
-- (NSDictionary *)remoteInspectorUserInfo
-{
- return _private->remoteInspectorUserInfo;
-}
-
#if PLATFORM(IOS)
- (void)setHostApplicationBundleId:(NSString *)bundleId name:(NSString *)name
{
+ // FIXME: This has not yet been ported to Inspector::RemoteInspectorServer.
+
if (![_private->hostApplicationBundleId isEqualToString:bundleId]) {
[_private->hostApplicationBundleId release];
_private->hostApplicationBundleId = [bundleId copy];
if (frame == [self mainFrame])
[self _didChangeValueForKey: _WebMainFrameURLKey];
[NSApp setWindowsNeedUpdate:YES];
-#if ENABLE(REMOTE_INSPECTOR)
- [[WebView sharedWebInspectorServer] pushListing];
-#endif
}
- (void)_didFinishLoadForFrame:(WebFrame *)frame
#endif
#if ENABLE(REMOTE_INSPECTOR)
- BOOL allowsRemoteInspection;
- NSDictionary *remoteInspectorUserInfo;
#if PLATFORM(IOS)
WebIndicateLayer *indicateLayer;
NSString *hostApplicationBundleId;
dashboardBehaviorAllowWheelScrolling = YES;
#endif
-#if ENABLE(REMOTE_INSPECTOR)
- allowsRemoteInspection = YES;
-#endif
-
shouldCloseWithWindow = objc_collectingEnabled();
pluginDatabaseClientCount++;
[mediaStyle release];
#if ENABLE(REMOTE_INSPECTOR)
- [remoteInspectorUserInfo release];
#if PLATFORM(IOS)
[indicateLayer release];
[hostApplicationBundleId release];
@class WebBasePluginPackage;
@class WebDownload;
@class WebNodeHighlight;
-#if ENABLE(REMOTE_INSPECTOR)
-@class WebInspectorServer;
-#endif
#ifdef __cplusplus
- (void)_fullScreenRendererChanged:(WebCore::RenderBox*)renderer;
#endif
-#if ENABLE(REMOTE_INSPECTOR)
-+ (WebInspectorServer *)sharedWebInspectorServer;
-#endif
-
// Conversion functions between WebCore root view coordinates and web view coordinates.
- (NSPoint)_convertPointFromRootView:(NSPoint)point;
- (NSRect)_convertRectFromRootView:(NSRect)rect;
extern NSString *_WebViewDidStartAcceleratedCompositingNotification;
#if ENABLE_REMOTE_INSPECTOR
+// FIXME: Legacy, remove this, switch to something from JavaScriptCore Inspector::RemoteInspectorServer.
// Notification when the number of inspector sessions becomes non-zero or returns to 0.
// Check the current state via -[WebView _hasRemoteInspectorSession].
extern NSString *_WebViewRemoteInspectorHasSessionChangedNotification;
+ (BOOL)_hasRemoteInspectorSession;
/*!
- @method canBeRemotelyInspected
- @result Looks at all the factors of this WebView and returns whether or not
- this WebView should allow a Remote Web Inspector to attach to it. This takes
- into account -allowsRemoteInspection, Private Browsing, and potentially other
- factors.
-*/
-- (BOOL)canBeRemotelyInspected;
-
-/*!
@method allowsRemoteInspection
@result Returns whether or not this WebView will allow a Remote Web Inspector
to attach to it.
@abstract indicate this WebView on screen for a remote inspector.
*/
- (void)setIndicatingForRemoteInspector:(BOOL)enabled;
-
-/*
- @method setRemoteInspectorUserInfo
- @param tag The dictionary to be associated with the WebView.
- @abstract Developer specified dictionary for the WebView that will be
- sent to the Remote Debugger. The dictionary must contain property
- list serializable values.
-*/
-- (void)setRemoteInspectorUserInfo:(NSDictionary *)userInfo;
-
-/*!
- @method remoteInspectorUserInfo
- @result Returns the dictionary associated with this WebView.
-*/
-- (NSDictionary *)remoteInspectorUserInfo;
#endif
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/WebInspectorClient.h:
+
2013-11-25 peavo@outlook.com <peavo@outlook.com>
[Win] WebKit version in user agent string is incorrect.
#include <WebCore/COMPtr.h>
#include <WebCore/InspectorClient.h>
-#include <WebCore/InspectorFrontendChannel.h>
+#include <WebCore/InspectorForwarding.h>
#include <WebCore/InspectorFrontendClientLocal.h>
#include <WebCore/WindowMessageListener.h>
#include <windows.h>
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/InspectorClientWinCE.h:
+
2013-11-04 Zhuang Zhigang <zhuangzg@cn.fujitsu.com>
Change structure of frame tree in WINCE port.
#define InspectorClientWinCE_h
#include "InspectorClient.h"
-#include "InspectorFrontendChannel.h"
+#include "InspectorForwarding.h"
class WebView;
+2013-12-03 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Push Remote Inspector debugging connection management into JavaScriptCore
+ https://bugs.webkit.org/show_bug.cgi?id=124613
+
+ Reviewed by Timothy Hatcher.
+
+ * WebProcess/WebCoreSupport/WebInspectorClient.h:
+ * WebProcess/WebPage/WebInspector.cpp:
+ Updated includes.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ * WebProcess/com.apple.WebProcess.sb.in:
+ Allow the WebProcess to access the "com.apple.webinspector" named
+ XPC service to expose its WebCore::Page's to remote debuggers.
+
2013-12-04 David Farler <dfarler@apple.com>
Use All-iOS target when building WK2 on iOS
#include "PageOverlay.h"
#include <WebCore/InspectorClient.h>
-#include <WebCore/InspectorFrontendChannel.h>
+#include <WebCore/InspectorForwarding.h>
namespace WebCore {
class GraphicsContext;
#include "WebPageCreationParameters.h"
#include "WebProcess.h"
#include <WebCore/InspectorController.h>
-#include <WebCore/InspectorFrontendChannel.h>
+#include <WebCore/InspectorForwarding.h>
#include <WebCore/InspectorFrontendClient.h>
#include <WebCore/MainFrame.h>
#include <WebCore/Page.h>
WebCore::provideDeviceProximityTo(m_page.get(), new WebDeviceProximityClient(this));
#endif
+#if ENABLE(REMOTE_INSPECTOR)
+ m_page->setRemoteInspectionAllowed(true);
+#endif
+
m_page->setCanStartMedia(false);
m_mayStartMediaWhenInWindow = parameters.mayStartMediaWhenInWindow;
#endif
+;; Remote Web Inspector
+(allow mach-lookup
+ (global-name "com.apple.webinspector"))
+
;; Various services required by AppKit and other frameworks
(allow mach-lookup
(global-name "com.apple.DiskArbitration.diskarbitrationd")