From 9b6270ff72c6b387018052cad898bb7789944a01 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Wed, 18 Jun 2025 14:56:20 +0900 Subject: [PATCH] Update chrome.js --- lib/chrome.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/chrome.js b/lib/chrome.js index 5da15df..c63c35a 100644 --- a/lib/chrome.js +++ b/lib/chrome.js @@ -56,6 +56,7 @@ var ChromeObject = function() { this.pageList = []; this.title = ""; this.frameIndex = -1; + this.disableFeatures = ["ShowBookmarksBar", "Translate"]; this.isPreventEvaluate = false; this.isAppMode = false; @@ -318,6 +319,9 @@ var ChromeObject = function() { if (this.userAgent != null) { cmd.push("\"--user-agent=" + this.userAgent + "\""); } + + // disable an unwanted features + cmd.push("--disable-features=" + this.disableFeatures.join(',')); // set the URL cmd.push((this.isAppMode ? "--app=\"" : "\"") + url + "\""); @@ -1382,6 +1386,31 @@ var ChromeObject = function() { this.requestFullscreen = function() { this.evaluate('document.documentElement.requestFullscreen();'); }; + + this.getDisableFeatureIndex = function(feature) { + return this.disableFeatures.indexOf(feature); + }; + + this.isFeatureDisabled = function(feature) { + return this.getDisableFeatureIndex(feature) > -1; + }; + + this.addDisableFeature = function(feature) { + if (!this.isFeatureDisabled(feature)) { + this.disableFeatures.push(feature); + } + + return this; + }; + + this.removeDisableFeature = function(feature) { + var index = this.getDisableFeatureIndex(feature); + if (index > -1) { + this.disableFeatures.splice(index, 1); + } + + return this; + }; this.create(); }; @@ -1453,7 +1482,7 @@ exports.startDebugInPrivate = function(url, proxy, profileName, debuggingPort, i exports.publisherName = publisherName; -exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.22"; +exports.VERSIONINFO = "Chrome Web Browser Debugging Interface (chrome.js) version 0.4.23"; exports.AUTHOR = "abuse@catswords.net"; exports.global = global; exports.require = global.require;