Skip to content

Commit 1d8c802

Browse files
Web Inspector: Expose private APIs to interact with RemoteInspector instead of going through WebKit
https://bugs.webkit.org/show_bug.cgi?id=143729 Reviewed by Timothy Hatcher. * API/JSRemoteInspector.h: Added. * API/JSRemoteInspector.cpp: Added. (JSRemoteInspectorDisableAutoStart): (JSRemoteInspectorStart): (JSRemoteInspectorSetParentProcessInformation): Add the new SPIs for basic remote inspection behavior. * JavaScriptCore.xcodeproj/project.pbxproj: Add the new files to Mac only, since remote inspection is only enabled there anyways. Canonical link: https://commits.webkit.org/161764@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182816 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 8ac99c7 commit 1d8c802

4 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (C) 2015 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#include "config.h"
27+
#include "JSRemoteInspector.h"
28+
29+
#if ENABLE(REMOTE_INSPECTOR)
30+
#include "RemoteInspector.h"
31+
#endif
32+
33+
using namespace Inspector;
34+
35+
void JSRemoteInspectorDisableAutoStart(void)
36+
{
37+
#if ENABLE(REMOTE_INSPECTOR)
38+
RemoteInspector::startDisabled();
39+
#endif
40+
}
41+
42+
void JSRemoteInspectorStart(void)
43+
{
44+
#if ENABLE(REMOTE_INSPECTOR)
45+
RemoteInspector::singleton();
46+
#endif
47+
}
48+
49+
void JSRemoteInspectorSetParentProcessInformation(pid_t pid, const UInt8* auditData, size_t auditLength)
50+
{
51+
#if ENABLE(REMOTE_INSPECTOR)
52+
RetainPtr<CFDataRef> auditDataRef = adoptCF(CFDataCreate(kCFAllocatorDefault, auditData, auditLength));
53+
RemoteInspector::singleton().setParentProcessInformation(pid, auditDataRef);
54+
#else
55+
UNUSED_PARAM(pid);
56+
UNUSED_PARAM(auditData);
57+
UNUSED_PARAM(auditLength);
58+
#endif
59+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (C) 2015 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21+
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#ifndef JSRemoteInspector_h
27+
#define JSRemoteInspector_h
28+
29+
#include <JavaScriptCore/JSBase.h>
30+
#include <JavaScriptCore/WebKitAvailability.h>
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
JS_EXPORT void JSRemoteInspectorDisableAutoStart(void) CF_AVAILABLE(10_11, 9_0);
37+
JS_EXPORT void JSRemoteInspectorStart(void) CF_AVAILABLE(10_11, 9_0);
38+
JS_EXPORT void JSRemoteInspectorSetParentProcessInformation(pid_t, const uint8_t* auditData, size_t auditLength) CF_AVAILABLE(10_11, 9_0);
39+
40+
#ifdef __cplusplus
41+
}
42+
#endif
43+
44+
#endif /* JSRemoteInspector_h */

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2015-04-14 Joseph Pecoraro <pecoraro@apple.com>
2+
3+
Web Inspector: Expose private APIs to interact with RemoteInspector instead of going through WebKit
4+
https://bugs.webkit.org/show_bug.cgi?id=143729
5+
6+
Reviewed by Timothy Hatcher.
7+
8+
* API/JSRemoteInspector.h: Added.
9+
* API/JSRemoteInspector.cpp: Added.
10+
(JSRemoteInspectorDisableAutoStart):
11+
(JSRemoteInspectorStart):
12+
(JSRemoteInspectorSetParentProcessInformation):
13+
Add the new SPIs for basic remote inspection behavior.
14+
15+
* JavaScriptCore.xcodeproj/project.pbxproj:
16+
Add the new files to Mac only, since remote inspection is only
17+
enabled there anyways.
18+
119
2015-04-14 Mark Lam <mark.lam@apple.com>
220

321
Rename JSC_dfgFunctionWhitelistFile to JSC_dfgWhitelist.

‎Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,8 @@
11991199
A54CF2FA184EAEDA00237F19 /* ScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A54CF2F8184EAEDA00237F19 /* ScriptObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
12001200
A54E8EB018BFFBBB00556D28 /* GCSegmentedArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A343F7418A1748B0039B085 /* GCSegmentedArray.h */; settings = {ATTRIBUTES = (Private, ); }; };
12011201
A54E8EB118BFFBBE00556D28 /* GCSegmentedArrayInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A343F7718A1749D0039B085 /* GCSegmentedArrayInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
1202+
A552C37F1ADDB8FE00139726 /* JSRemoteInspector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A552C37D1ADDB8FE00139726 /* JSRemoteInspector.cpp */; };
1203+
A552C3801ADDB8FE00139726 /* JSRemoteInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = A552C37E1ADDB8FE00139726 /* JSRemoteInspector.h */; settings = {ATTRIBUTES = (Private, ); }; };
12021204
A55D93A5185012A800400DED /* ScriptFunctionCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A55D93A3185012A800400DED /* ScriptFunctionCall.cpp */; };
12031205
A55D93A6185012A800400DED /* ScriptFunctionCall.h in Headers */ = {isa = PBXBuildFile; fileRef = A55D93A4185012A800400DED /* ScriptFunctionCall.h */; settings = {ATTRIBUTES = (Private, ); }; };
12041206
A55D93AC18514F7900400DED /* InspectorProtocolTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A55D93AB18514F7900400DED /* InspectorProtocolTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2949,6 +2951,8 @@
29492951
A54CF2F3184EAB2400237F19 /* ScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptValue.h; sourceTree = "<group>"; };
29502952
A54CF2F7184EAEDA00237F19 /* ScriptObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptObject.cpp; sourceTree = "<group>"; };
29512953
A54CF2F8184EAEDA00237F19 /* ScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptObject.h; sourceTree = "<group>"; };
2954+
A552C37D1ADDB8FE00139726 /* JSRemoteInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRemoteInspector.cpp; sourceTree = "<group>"; };
2955+
A552C37E1ADDB8FE00139726 /* JSRemoteInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRemoteInspector.h; sourceTree = "<group>"; };
29522956
A55D93A3185012A800400DED /* ScriptFunctionCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptFunctionCall.cpp; sourceTree = "<group>"; };
29532957
A55D93A4185012A800400DED /* ScriptFunctionCall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptFunctionCall.h; sourceTree = "<group>"; };
29542958
A55D93AB18514F7900400DED /* InspectorProtocolTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorProtocolTypes.h; sourceTree = "<group>"; };
@@ -4083,6 +4087,8 @@
40834087
A72028B41797601E0098028C /* JSCTestRunnerUtils.cpp */,
40844088
A72028B51797601E0098028C /* JSCTestRunnerUtils.h */,
40854089
86E3C60A167BAB87006D760A /* JSExport.h */,
4090+
A552C37D1ADDB8FE00139726 /* JSRemoteInspector.cpp */,
4091+
A552C37E1ADDB8FE00139726 /* JSRemoteInspector.h */,
40864092
C25D709A16DE99F400FCA6BC /* JSManagedValue.h */,
40874093
C25D709916DE99F400FCA6BC /* JSManagedValue.mm */,
40884094
2A4BB7F218A41179008A0FCD /* JSManagedValueInternal.h */,
@@ -6003,6 +6009,7 @@
60036009
70113D4C1A8DB093003848C4 /* IteratorOperations.h in Headers */,
60046010
BC18C4130E16F5CD00B34460 /* JavaScript.h in Headers */,
60056011
0F2B9CF519D0BAC100B1D1B5 /* FTLExitPropertyValue.h in Headers */,
6012+
A552C3801ADDB8FE00139726 /* JSRemoteInspector.h in Headers */,
60066013
A503FA1A188E0FB000110F14 /* JavaScriptCallFrame.h in Headers */,
60076014
BC18C4140E16F5CD00B34460 /* JavaScriptCore.h in Headers */,
60086015
BC18C4150E16F5CD00B34460 /* JavaScriptCorePrefix.h in Headers */,
@@ -7308,6 +7315,7 @@
73087315
95F6E6950E5B5F970091E860 /* JSProfilerPrivate.cpp in Sources */,
73097316
7C184E1A17BEDBD3007CB63A /* JSPromise.cpp in Sources */,
73107317
7C184E2217BEE240007CB63A /* JSPromiseConstructor.cpp in Sources */,
7318+
A552C37F1ADDB8FE00139726 /* JSRemoteInspector.cpp in Sources */,
73117319
0F893BDB1936E23C001211F4 /* DFGStructureAbstractValue.cpp in Sources */,
73127320
7C008CDA187124BB00955C24 /* JSPromiseDeferred.cpp in Sources */,
73137321
7C008CD2186F8A9300955C24 /* JSPromiseFunctions.cpp in Sources */,

0 commit comments

Comments
 (0)