abort-current-inline-script

abort-current-inline-script

This snippet aborts the execution of an inline script when a property is either read or written.

Parameters

Name

Description

Mandatory

api

The API function or property name to anchor on. Can be a direct child of window or a chain of properties separated by dots for sub-properties.

Yes

search

If specified, only scripts containing the given string are prevented from executing. If the string begins and ends with a slash (/), the text in between is treated as a regular expression.

No

Filter examples

Filter

Result

abort-current-inline-script setDefaultTheme

The code that calls/writes the setDefaultTheme global function throws an exception.

abort-current-inline-script document.head.appendChild

The code that calls/writes the appendChild function throws an exception.

abort-current-inline-script Object.prototype.networkListener

The code that reads/writes the networkListener property throws an exception.

abort-current-inline-script btoa BOOTLOADER_LOADED

The code that calls/writes the btoa global function throws an exception, only inside inline scripts whose text content contains BOOTLOADER_LOADED.

abort-current-inline-script document.createElement /ru-n4p\|ua-n4p\|загрузка.../

Throws an exception only inside inline scripts whose text content matches the regex.

Tradeoffs

  • The snippet is executed after all of a page's inline scripts. You should only attach properties read inside of a callback.

  • You can only attach this snippet to global properties, or properties of the window object.