Skip to content

Commit

Permalink
Changing CLEAR_PERMISSIONS and adding CLEAR_SHUTDOWN_EXCEPTIONS and C…
Browse files Browse the repository at this point in the history
…LEAR_SITE_PERMISSIONS
  • Loading branch information
david-dick committed Jun 25, 2024
1 parent fcf6cda commit 449fc29
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions lib/Firefox/Marionette/Cache.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ our @EXPORT_OK = qw(
CLEAR_FINGERPRINTING_PROTECTION_STATE
CLEAR_BOUNCE_TRACKING_PROTECTION_STATE
CLEAR_STORAGE_PERMISSIONS
CLEAR_SHUTDOWN_EXCEPTIONS
CLEAR_ALL
CLEAR_ALL_CACHES
CLEAR_DOM_STORAGES
Expand All @@ -59,7 +60,7 @@ sub CLEAR_HISTORY { return 1024 }
sub CLEAR_SESSION_HISTORY { return 2048 }
sub CLEAR_AUTH_TOKENS { return 4096 }
sub CLEAR_AUTH_CACHE { return 8192 }
sub CLEAR_PERMISSIONS { return 16_384 }
sub CLEAR_SITE_PERMISSIONS { return 16_384 }
sub CLEAR_CONTENT_PREFERENCES { return 32_768 }
sub CLEAR_HSTS { return 65_536 }
sub CLEAR_EME { return 131_072 }
Expand All @@ -76,8 +77,13 @@ sub CLEAR_COOKIE_BANNER_EXECUTED_RECORD { return 134_217_728 }
sub CLEAR_FINGERPRINTING_PROTECTION_STATE { return 268_435_456 }
sub CLEAR_BOUNCE_TRACKING_PROTECTION_STATE { return 536_870_912 }
sub CLEAR_STORAGE_PERMISSIONS { return 1_073_741_824 }
sub CLEAR_SHUTDOWN_EXCEPTIONS { return 2_147_483_648 }
sub CLEAR_ALL { return 0xFFFFFFFF }

sub CLEAR_PERMISSIONS {
return CLEAR_SITE_PERMISSIONS() | CLEAR_SHUTDOWN_EXCEPTIONS();
}

sub CLEAR_ALL_CACHES {
return CLEAR_NETWORK_CACHE() | CLEAR_IMAGE_CACHE() | CLEAR_CSS_CACHE() |
CLEAR_PREFLIGHT_CACHE() | CLEAR_HSTS();
Expand Down Expand Up @@ -133,6 +139,8 @@ Version 1.58
This module handles the implementation of the Firefox cache constants. This is sourced from L<toolkit/components/cleardata/nsIClearDataService.idl|https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/cleardata/nsIClearDataService.idl>
Cache settings in Firefox have changed a lot and are still changing in 2024. The ones that have been historically available AND stable (they have at least retained the same number) have been L<CLEAR_COOKIES|/CLEAR_COOKIES>, L<CLEAR_NETWORK_CACHE|/CLEAR_NETWORK_CACHE> and L<CLEAR_IMAGE_CACHE|/CLEAR_IMAGE_CACHE>. For the other variables, YMMV.
=head1 CONSTANTS
=head2 CLEAR_COOKIES
Expand Down Expand Up @@ -187,9 +195,9 @@ returns the value of CLEAR_AUTH_TOKENS, which is 1 << 12 = 4096
returns the value of CLEAR_AUTH_CACHE, which is 1 << 13 = 8192 (Login cache)
=head2 CLEAR_PERMISSIONS
=head2 CLEAR_SITE_PERMISSIONS
returns the value of CLEAR_PERMISSIONS, which is 1 << 14 = 16384
returns the value of CLEAR_SITE_PERMISSIONS, which is 1 << 14 = 16384
=head2 CLEAR_CONTENT_PREFERENCES
Expand Down Expand Up @@ -255,10 +263,18 @@ returns the value of CLEAR_BOUNCE_TRACKING_PROTECTION_STATE, which is 1 << 29 =
returns the value of CLEAR_STORAGE_PERMISSIONS, which is 1 << 30 = 1073741824
=head2 CLEAR_SHUTDOWN_EXCEPTIONS
returns the value of CLEAR_SHUTDOWN_EXCEPTIONS, which is 1 << 31 = 2147483648
=head2 CLEAR_ALL
returns the value of CLEAR_ALL, which is 4294967295 (0xFFFFFFFF)
=head2 CLEAR_PERMISSIONS
returns the value of CLEAR_PERMISSIONS, which is 2147500032 (L<CLEAR_SITE_PERMISSIONS|/CLEAR_SITE_PERMISSIONS> | L<CLEAR_SHUTDOWN_EXCEPTIONS|/CLEAR_SHUTDOWN_EXCEPTIONS>)
=head2 CLEAR_ALL_CACHES
returns the value of CLEAR_ALL_CACHES, which is 12648454 (L<CLEAR_NETWORK_CACHE|/CLEAR_NETWORK_CACHE> | L<CLEAR_IMAGE_CACHE|/CLEAR_IMAGE_CACHE> | L<CLEAR_CSS_CACHE|/CLEAR_CSS_CACHE> | L<CLEAR_PREFLIGHT_CACHE|/CLEAR_PREFLIGHT_CACHE> | L<CLEAR_HSTS|/CLEAR_HSTS>)
Expand Down
1 change: 1 addition & 0 deletions t/01-marionette.t
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,7 @@ SKIP: {
TODO: {
local $TODO = ($major_version < 113 && $name !~ /^(CLEAR_COOKIES|CLEAR_NETWORK_CACHE|CLEAR_IMAGE_CACHE)$/smx) ? "Older firefox (less than 113) can have different values for Firefox::Marionette::Cache constants" : q[];
local $TODO = $TODO || ($major_version < 128 && $name =~ /^(?:CLEAR_CREDENTIAL_MANAGER_STATE|CLEAR_COOKIE_BANNER_EXCEPTION|CLEAR_COOKIE_BANNER_EXECUTED_RECORD|CLEAR_FINGERPRINTING_PROTECTION_STATE|CLEAR_BOUNCE_TRACKING_PROTECTION_STATE|CLEAR_FORGET_ABOUT_SITE|CLEAR_STORAGE_PERMISSIONS|CLEAR_COOKIES_AND_SITE_DATA)$/) ? "Old firefox (less than 128) can have different values for Firefox::Marionette::Cache constants" : q[];
local $TODO = $TODO || ($major_version < 129 && $name =~ /^(?:CLEAR_PERMISSIONS|CLEAR_FORGET_ABOUT_SITE)$/) ? "Old firefox (less than 129) can have different values for Firefox::Marionette::Cache constants" : q[];
my $result = $firefox->check_cache_key($name);
if (($name eq 'CLEAR_FORGET_ABOUT_SITE') && ($major_version < 124)) {
ok($result <= &$name(), "\$firefox->check_cache_key($name) eq Firefox::Marionette::Cache::${name} which should less than or equal to $result and is " . &$name());
Expand Down

0 comments on commit 449fc29

Please sign in to comment.