Skip to content

Commit

Permalink
blocking console.clear statements to help debug efforts
Browse files Browse the repository at this point in the history
  • Loading branch information
david-dick committed Jun 7, 2024
1 parent 3e5215b commit 4ddb38a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Firefox/Marionette/Extension/Stealth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ sub user_agent_contents {
my ( $definition_name, $function_definition ) =
$class->_get_js_function_definition( $to_browser_type, 'webdriver',
'return false' );
my $contents = <<"_JS_";
my $native_code_body = $class->_native_code_body($to_browser_type);
my $contents = <<"_JS_";
{
if (("console" in window) && ("log" in window.console)) {
console.log("Loading Firefox::Marionette::Extension::Stealth");
Expand All @@ -155,11 +156,12 @@ sub user_agent_contents {
let winProto = Object.getPrototypeOf(window);
$function_definition
Object.defineProperty(navProto, "webdriver", {get: $definition_name, enumerable: false, configurable: true});
console.clear = function() { console.log("$class blocked an attempt at clearing the console...") };
console.clear.toString = function clear_def() { return "function clear() $native_code_body" };
let getUserMedia = navProto.mozGetUserMedia;
_JS_
my ( $from_browser_type, $from_browser_version );
if ( defined $to_browser_type ) {
my $native_code_body = $class->_native_code_body($to_browser_type);
( $from_browser_type, $from_browser_version ) =
$class->_get_browser_type_and_version( $parameters{from} );
if ( ( defined $from_browser_type )
Expand Down

0 comments on commit 4ddb38a

Please sign in to comment.