From 9f0030ac335b75d5fd815c3fdd0a2f5f94585363 Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 27 Nov 2022 01:26:32 -0800 Subject: [PATCH 1/2] add webinspector mobile command for development --- lib/commands/execute.js | 2 ++ lib/commands/web.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/commands/execute.js b/lib/commands/execute.js index 56bbb3d3d..591d2e541 100644 --- a/lib/commands/execute.js +++ b/lib/commands/execute.js @@ -166,6 +166,8 @@ extensions.executeMobile = async function executeMobile (mobileCommand, opts = { listConditionInducers: 'mobileListConditionInducers', enableConditionInducer: 'mobileEnableConditionInducer', disableConditionInducer: 'mobileDisableConditionInducer', + + webInspector: 'mobileWebInspector', }; if (!_.has(commandMap, mobileCommand)) { diff --git a/lib/commands/web.js b/lib/commands/web.js index abe88373c..9ecb0bc7f 100644 --- a/lib/commands/web.js +++ b/lib/commands/web.js @@ -201,6 +201,23 @@ commands.deleteCookies = async function deleteCookies () { return true; }; + +commands.mobileWebInspector = async function mobileWebInspector(opts) { + // TODO: add a security flag? + + if (this.remote) { + return false; + } + + const { method, args } = opts; + await this.remote.rpcClient.send(method, { + args, + appIdKey: this.remote.appIdKey, + pageIdKey: this.remote.pageIdKey, + }); + return true; +}; + helpers._deleteCookie = async function _deleteCookie (cookieName) { this.log.debug(`Deleting cookie '${cookieName}'`); let webCookie = cookieUtils.expireCookie(cookieName, {path: '/'}); From 4f5e04021ce3cc9cc82956f7d57fe2b8f002e00e Mon Sep 17 00:00:00 2001 From: Kazuaki Matsuo Date: Sun, 27 Nov 2022 01:31:10 -0800 Subject: [PATCH 2/2] add comment --- lib/commands/web.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commands/web.js b/lib/commands/web.js index 9ecb0bc7f..d3d990d27 100644 --- a/lib/commands/web.js +++ b/lib/commands/web.js @@ -203,7 +203,7 @@ commands.deleteCookies = async function deleteCookies () { commands.mobileWebInspector = async function mobileWebInspector(opts) { - // TODO: add a security flag? + // TODO: add a security flag if we add this in the main if (this.remote) { return false;