Skip to content

Commit ede33e4

Browse files
committed
update protocol.json to support the Page domain
clean up Page agent implementation change .js and .ts resource files' type to 'script', this means that scripts that have not been parsed by the javascript engine will not be displayed in the Sources Tab. Users who wish to place breakpoints in files that are yet to be parsed should use `debugger` statements instead
1 parent 8a68a06 commit ede33e4

7 files changed

Lines changed: 1427 additions & 1777 deletions

File tree

runtime/src/main/jni/v8_inspector/src/inspector/js_protocol.json

Lines changed: 1425 additions & 993 deletions
Large diffs are not rendered by default.

runtime/src/main/jni/v8_inspector/src/inspector/protocol/GenericTypes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace GenericTypes {
1616

1717
const char Metainfo::domainName[] = "GenericTypes";
1818
const char Metainfo::commandPrefix[] = "GenericTypes.";
19-
const char Metainfo::version[] = "1.1";
19+
const char Metainfo::version[] = "1.2";
2020

2121
std::unique_ptr<SearchMatch> SearchMatch::parse(protocol::Value* value, ErrorSupport* errors) {
2222
if (!value || value->type() != protocol::Value::TypeObject) {

runtime/src/main/jni/v8_inspector/src/inspector/protocol/Page.cpp

Lines changed: 0 additions & 483 deletions
Large diffs are not rendered by default.

runtime/src/main/jni/v8_inspector/src/inspector/protocol/Page.h

Lines changed: 0 additions & 218 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class FrameResource;
2929
class FrameResourceTree;
3030
// Search result for resource.
3131
class SearchResult;
32-
// Cookie object
33-
class Cookie;
3432
// Unique script identifier.
3533
using ScriptIdentifier = String;
3634

@@ -50,14 +48,6 @@ extern const char* Viewport;
5048
extern const char* Page;
5149
} // namespace CoordinateSystemEnum
5250

53-
namespace GetScriptExecutionStatus {
54-
namespace ResultEnum {
55-
extern const char* Allowed;
56-
extern const char* Disabled;
57-
extern const char* Forbidden;
58-
} // ResultEnum
59-
} // GetScriptExecutionStatus
60-
6151
// ------------- Type and builder declarations.
6252

6353
// Information about the Frame on the page.
@@ -556,193 +546,6 @@ class SearchResult {
556546
};
557547

558548

559-
// Cookie object
560-
class Cookie {
561-
PROTOCOL_DISALLOW_COPY(Cookie);
562-
public:
563-
static std::unique_ptr<Cookie> parse(protocol::Value* value, ErrorSupport* errors);
564-
565-
~Cookie() { }
566-
567-
String getName() {
568-
return m_name;
569-
}
570-
void setName(const String& value) {
571-
m_name = value;
572-
}
573-
574-
String getValue() {
575-
return m_value;
576-
}
577-
void setValue(const String& value) {
578-
m_value = value;
579-
}
580-
581-
String getDomain() {
582-
return m_domain;
583-
}
584-
void setDomain(const String& value) {
585-
m_domain = value;
586-
}
587-
588-
String getPath() {
589-
return m_path;
590-
}
591-
void setPath(const String& value) {
592-
m_path = value;
593-
}
594-
595-
double getExpires() {
596-
return m_expires;
597-
}
598-
void setExpires(double value) {
599-
m_expires = value;
600-
}
601-
602-
int getSize() {
603-
return m_size;
604-
}
605-
void setSize(int value) {
606-
m_size = value;
607-
}
608-
609-
bool getHttpOnly() {
610-
return m_httpOnly;
611-
}
612-
void setHttpOnly(bool value) {
613-
m_httpOnly = value;
614-
}
615-
616-
bool getSecure() {
617-
return m_secure;
618-
}
619-
void setSecure(bool value) {
620-
m_secure = value;
621-
}
622-
623-
bool getSession() {
624-
return m_session;
625-
}
626-
void setSession(bool value) {
627-
m_session = value;
628-
}
629-
630-
std::unique_ptr<protocol::DictionaryValue> serialize() const;
631-
std::unique_ptr<Cookie> clone() const;
632-
633-
template<int STATE>
634-
class CookieBuilder {
635-
public:
636-
enum {
637-
NoFieldsSet = 0,
638-
NameSet = 1 << 1,
639-
ValueSet = 1 << 2,
640-
DomainSet = 1 << 3,
641-
PathSet = 1 << 4,
642-
ExpiresSet = 1 << 5,
643-
SizeSet = 1 << 6,
644-
HttpOnlySet = 1 << 7,
645-
SecureSet = 1 << 8,
646-
SessionSet = 1 << 9,
647-
AllFieldsSet = (NameSet | ValueSet | DomainSet | PathSet | ExpiresSet | SizeSet | HttpOnlySet | SecureSet | SessionSet | 0)
648-
};
649-
650-
651-
CookieBuilder<STATE | NameSet>& setName(const String& value) {
652-
static_assert(!(STATE & NameSet), "property name should not be set yet");
653-
m_result->setName(value);
654-
return castState<NameSet>();
655-
}
656-
657-
CookieBuilder<STATE | ValueSet>& setValue(const String& value) {
658-
static_assert(!(STATE & ValueSet), "property value should not be set yet");
659-
m_result->setValue(value);
660-
return castState<ValueSet>();
661-
}
662-
663-
CookieBuilder<STATE | DomainSet>& setDomain(const String& value) {
664-
static_assert(!(STATE & DomainSet), "property domain should not be set yet");
665-
m_result->setDomain(value);
666-
return castState<DomainSet>();
667-
}
668-
669-
CookieBuilder<STATE | PathSet>& setPath(const String& value) {
670-
static_assert(!(STATE & PathSet), "property path should not be set yet");
671-
m_result->setPath(value);
672-
return castState<PathSet>();
673-
}
674-
675-
CookieBuilder<STATE | ExpiresSet>& setExpires(double value) {
676-
static_assert(!(STATE & ExpiresSet), "property expires should not be set yet");
677-
m_result->setExpires(value);
678-
return castState<ExpiresSet>();
679-
}
680-
681-
CookieBuilder<STATE | SizeSet>& setSize(int value) {
682-
static_assert(!(STATE & SizeSet), "property size should not be set yet");
683-
m_result->setSize(value);
684-
return castState<SizeSet>();
685-
}
686-
687-
CookieBuilder<STATE | HttpOnlySet>& setHttpOnly(bool value) {
688-
static_assert(!(STATE & HttpOnlySet), "property httpOnly should not be set yet");
689-
m_result->setHttpOnly(value);
690-
return castState<HttpOnlySet>();
691-
}
692-
693-
CookieBuilder<STATE | SecureSet>& setSecure(bool value) {
694-
static_assert(!(STATE & SecureSet), "property secure should not be set yet");
695-
m_result->setSecure(value);
696-
return castState<SecureSet>();
697-
}
698-
699-
CookieBuilder<STATE | SessionSet>& setSession(bool value) {
700-
static_assert(!(STATE & SessionSet), "property session should not be set yet");
701-
m_result->setSession(value);
702-
return castState<SessionSet>();
703-
}
704-
705-
std::unique_ptr<Cookie> build() {
706-
static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
707-
return std::move(m_result);
708-
}
709-
710-
private:
711-
friend class Cookie;
712-
CookieBuilder() : m_result(new Cookie()) { }
713-
714-
template<int STEP> CookieBuilder<STATE | STEP>& castState() {
715-
return *reinterpret_cast<CookieBuilder<STATE | STEP>*>(this);
716-
}
717-
718-
std::unique_ptr<protocol::Page::Cookie> m_result;
719-
};
720-
721-
static CookieBuilder<0> create() {
722-
return CookieBuilder<0>();
723-
}
724-
725-
private:
726-
Cookie() {
727-
m_expires = 0;
728-
m_size = 0;
729-
m_httpOnly = false;
730-
m_secure = false;
731-
m_session = false;
732-
}
733-
734-
String m_name;
735-
String m_value;
736-
String m_domain;
737-
String m_path;
738-
double m_expires;
739-
int m_size;
740-
bool m_httpOnly;
741-
bool m_secure;
742-
bool m_session;
743-
};
744-
745-
746549
// ------------- Backend interface.
747550

748551
class Backend {
@@ -754,25 +557,11 @@ class Backend {
754557
virtual void addScriptToEvaluateOnLoad(ErrorString*, const String& in_scriptSource, String* out_identifier) = 0;
755558
virtual void removeScriptToEvaluateOnLoad(ErrorString*, const String& in_identifier) = 0;
756559
virtual void reload(ErrorString*, const Maybe<bool>& in_ignoreCache, const Maybe<String>& in_scriptToEvaluateOnLoad) = 0;
757-
virtual void navigate(ErrorString*, const String& in_url) = 0;
758-
virtual void getCookies(ErrorString*, std::unique_ptr<protocol::Array<protocol::Page::Cookie>>* out_cookies) = 0;
759-
virtual void deleteCookie(ErrorString*, const String& in_cookieName, const String& in_url) = 0;
760560
virtual void getResourceTree(ErrorString*, std::unique_ptr<protocol::Page::FrameResourceTree>* out_frameTree) = 0;
761561
virtual void getResourceContent(ErrorString*, const String& in_frameId, const String& in_url, String* out_content, bool* out_base64Encoded) = 0;
762562
virtual void searchInResource(ErrorString*, const String& in_frameId, const String& in_url, const String& in_query, const Maybe<bool>& in_caseSensitive, const Maybe<bool>& in_isRegex, const Maybe<String>& in_requestId, std::unique_ptr<protocol::Array<protocol::GenericTypes::SearchMatch>>* out_result) = 0;
763563
virtual void searchInResources(ErrorString*, const String& in_text, const Maybe<bool>& in_caseSensitive, const Maybe<bool>& in_isRegex, std::unique_ptr<protocol::Array<protocol::Page::SearchResult>>* out_result) = 0;
764564
virtual void setDocumentContent(ErrorString*, const String& in_frameId, const String& in_html) = 0;
765-
virtual void setShowPaintRects(ErrorString*, bool in_result) = 0;
766-
virtual void getScriptExecutionStatus(ErrorString*, String* out_result) = 0;
767-
virtual void setScriptExecutionDisabled(ErrorString*, bool in_value) = 0;
768-
virtual void setTouchEmulationEnabled(ErrorString*, bool in_enabled) = 0;
769-
virtual void setEmulatedMedia(ErrorString*, const String& in_media) = 0;
770-
virtual void getCompositingBordersVisible(ErrorString*, bool* out_result) = 0;
771-
virtual void setCompositingBordersVisible(ErrorString*, bool in_visible) = 0;
772-
virtual void snapshotNode(ErrorString*, int in_nodeId, String* out_dataURL) = 0;
773-
virtual void snapshotRect(ErrorString*, int in_x, int in_y, int in_width, int in_height, const String& in_coordinateSystem, String* out_dataURL) = 0;
774-
virtual void handleJavaScriptDialog(ErrorString*, bool in_accept, const Maybe<String>& in_promptText) = 0;
775-
virtual void archive(ErrorString*, String* out_data) = 0;
776565

777566
};
778567

@@ -781,17 +570,10 @@ class Backend {
781570
class Frontend {
782571
public:
783572
Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { }
784-
void domContentEventFired(double timestamp);
785573
void loadEventFired(double timestamp);
786-
void frameNavigated(std::unique_ptr<protocol::Page::Frame> frame);
787574
void frameDetached(const String& frameId);
788575
void frameStartedLoading(const String& frameId);
789576
void frameStoppedLoading(const String& frameId);
790-
void frameScheduledNavigation(const String& frameId, double delay);
791-
void frameClearedScheduledNavigation(const String& frameId);
792-
void javascriptDialogOpening(const String& message);
793-
void javascriptDialogClosed();
794-
void scriptsEnabled(bool isEnabled);
795577

796578
void flush();
797579
private:

runtime/src/main/jni/v8_inspector/src/inspector/utils/v8-page-resources.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,10 @@ std::map<std::string, const char*> PageResource::s_mimeTypeMap = {
112112
{ "application/xml", v8_inspector::protocol::Page::ResourceTypeEnum::Document },
113113
// text/css mime type is regarded as document so as to display in the Sources tab
114114
{ "text/css", v8_inspector::protocol::Page::ResourceTypeEnum::Document },
115-
// regarding javascript files as Scripts will prevent them from being displayed in the Sources
116-
// tab of DevTools, at least according to the FrontEnd implementation
117115
{ "text/javascript", v8_inspector::protocol::Page::ResourceTypeEnum::Script },
118116
{ "application/javascript", v8_inspector::protocol::Page::ResourceTypeEnum::Script },
119117
{ "application/json", v8_inspector::protocol::Page::ResourceTypeEnum::Document },
120-
// regarding typescript files as Scripts will prevent them from being displayed in the Sources
121-
// tab of DevTools, at least according to the FrontEnd implementation :-/
122-
// Enable typescripts as documents so that breakpoints may be set in code that has yet to be reached.
123-
// Will result in duplicate of the same typescript fiels in the Sources tab
124-
{ "text/typescript", v8_inspector::protocol::Page::ResourceTypeEnum::Document },
118+
{ "text/typescript", v8_inspector::protocol::Page::ResourceTypeEnum::Script },
125119
{ "image/jpeg", v8_inspector::protocol::Page::ResourceTypeEnum::Image },
126120
{ "image/png", v8_inspector::protocol::Page::ResourceTypeEnum::Image },
127121
{ "application/binary", v8_inspector::protocol::Page::ResourceTypeEnum::Other }

runtime/src/main/jni/v8_inspector/src/inspector/v8-page-agent-impl.cpp

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <v8_inspector/src/inspector/utils/v8-search-utils-public.h>
66
#include "v8-page-agent-impl.h"
7-
#include "v8_inspector/src/inspector/utils/v8-page-resources.h"
87
#include "search-util.h"
98

109
namespace v8_inspector {
@@ -185,71 +184,11 @@ void V8PageAgentImpl::reload(ErrorString*, const Maybe<bool>& in_ignoreCache,
185184

186185
}
187186

188-
void V8PageAgentImpl::navigate(ErrorString*, const String& in_url) {
189-
190-
}
191-
192-
void V8PageAgentImpl::getCookies(ErrorString*,
193-
std::unique_ptr<protocol::Array<protocol::Page::Cookie>>* out_cookies) {
194-
195-
}
196-
197-
void V8PageAgentImpl::deleteCookie(ErrorString*, const String& in_cookieName,
198-
const String& in_url) {
199-
200-
}
201-
202187
void V8PageAgentImpl::setDocumentContent(ErrorString*, const String& in_frameId,
203188
const String& in_html) {
204189

205190
}
206191

207-
void V8PageAgentImpl::setShowPaintRects(ErrorString*, bool in_result) {
208-
209-
}
210-
211-
void V8PageAgentImpl::getScriptExecutionStatus(ErrorString*, String* out_result) {
212-
213-
}
214-
215-
void V8PageAgentImpl::setScriptExecutionDisabled(ErrorString*, bool in_value) {
216-
217-
}
218-
219-
void V8PageAgentImpl::setTouchEmulationEnabled(ErrorString*, bool in_enabled) {
220-
221-
}
222-
223-
void V8PageAgentImpl::setEmulatedMedia(ErrorString*, const String& in_media) {
224-
225-
}
226-
227-
void V8PageAgentImpl::getCompositingBordersVisible(ErrorString*, bool* out_result) {
228-
229-
}
230-
231-
void V8PageAgentImpl::setCompositingBordersVisible(ErrorString*, bool in_visible) {
232-
233-
}
234-
235-
void V8PageAgentImpl::snapshotNode(ErrorString*, int in_nodeId, String* out_dataURL) {
236-
237-
}
238-
239-
void V8PageAgentImpl::snapshotRect(ErrorString*, int in_x, int in_y, int in_width,
240-
int in_height, const String& in_coordinateSystem,
241-
String* out_dataURL) {
242-
243-
}
244-
245-
void V8PageAgentImpl::handleJavaScriptDialog(ErrorString*, bool in_accept,
246-
const Maybe<String>& in_promptText) {
247-
248-
}
249-
250-
void V8PageAgentImpl::archive(ErrorString*, String* out_data) {
251-
252-
}
253192

254193
void V8PageAgentImpl::reset() {
255194

runtime/src/main/jni/v8_inspector/src/inspector/v8-page-agent-impl.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,7 @@ class V8PageAgentImpl : public protocol::Page::Backend {
3333
void addScriptToEvaluateOnLoad(ErrorString*, const String& in_scriptSource, String* out_identifier) override;
3434
void removeScriptToEvaluateOnLoad(ErrorString*, const String& in_identifier) override;
3535
void reload(ErrorString*, const Maybe<bool>& in_ignoreCache, const Maybe<String>& in_scriptToEvaluateOnLoad) override;
36-
void navigate(ErrorString*, const String& in_url) override;
37-
void getCookies(ErrorString*, std::unique_ptr<protocol::Array<protocol::Page::Cookie>>* out_cookies) override;
38-
void deleteCookie(ErrorString*, const String& in_cookieName, const String& in_url) override;
3936
void setDocumentContent(ErrorString*, const String& in_frameId, const String& in_html) override;
40-
void setShowPaintRects(ErrorString*, bool in_result) override;
41-
void getScriptExecutionStatus(ErrorString*, String* out_result) override;
42-
void setScriptExecutionDisabled(ErrorString*, bool in_value) override;
43-
void setTouchEmulationEnabled(ErrorString*, bool in_enabled) override;
44-
void setEmulatedMedia(ErrorString*, const String& in_media) override;
45-
void getCompositingBordersVisible(ErrorString*, bool* out_result) override;
46-
void setCompositingBordersVisible(ErrorString*, bool in_visible) override;
47-
void snapshotNode(ErrorString*, int in_nodeId, String* out_dataURL) override;
48-
void snapshotRect(ErrorString*, int in_x, int in_y, int in_width, int in_height, const String& in_coordinateSystem, String* out_dataURL) override;
49-
void handleJavaScriptDialog(ErrorString*, bool in_accept, const Maybe<String>& in_promptText) override;
50-
void archive(ErrorString*, String* out_data) override;
5137

5238
void restore();
5339
void reset();

0 commit comments

Comments
 (0)