Commit Graph

8 Commits

Author SHA1 Message Date
Raymond Hill 5d60df4b1b
Fix bad eslint rule + minor code review
`webext.js` module needs to be explicitly imported.

Added time-based heuristic to decide when a webpage loses
communication with background process.
2024-03-22 14:46:57 -04:00
Raymond Hill 38b325ecce
Raise the limit for detection of stale content scripts 2024-03-17 13:03:19 -04:00
Raymond Hill a969a672e0
Change official description in source code top comment 2023-12-04 12:10:34 -05:00
Raymond Hill ee83a4304a
Isolate DOM inspector layers from page context
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1411

Additionally, refactored communication mechanism between content
script contexts and uBO contexts by using MessageChannel/BroadcastChannel
web APIs.
2023-12-03 16:21:32 -05:00
Raymond Hill 67fb969572
Refactoring: Replace DOM events with broadcast channels
Broadcast channels are more suited to uBO than DOM events to dispatch
notifications to different parts of uBO.

DOM events can only be dispatched to local context, broadcast channels
dispatch to all contexts (i.e. background process, workers, auxiliary
pages) -- this last behavior is better suited to uBO to communicate
internal changes to all potential listeners, not just those in the local
context.

Additionally, broadcasting to content scripts is now done through
tabs.sendMessage() instead of through potentially opened message
ports, this simplifies broadcasting to content scripts, and this
doesn't require to have long-lived message ports in content
scripts.
2023-12-01 14:35:28 -05:00
Raymond Hill b1a338681b
Shield against possible case of invalid attribute name
Not sure this can really happen, but if ever Math.random() would
return `0.9999999999999999`, the attribute name would start with
`{`, i.e. an invalid attribute name.
2021-10-26 08:55:05 -04:00
Raymond Hill 2eb02c5adc
Fix spurious error message in dev console
Ports can be disconnected under certain conditions,
and in such case runtime.lastError must be accessed
to avoid the extensions framework from emitting
error messages in the console.
2021-07-31 07:20:38 -04:00
Raymond Hill a4aced69dc
Reorganize platform directory to avoid Chromium-centric appearance
Though Firefox shares a lot of WebExtensions code with Chromium,
these platforms have their own specific code paths, for various
reasons.

The reorganization here makes it clear that Chromium platform is
just one flavor of WebExtensions, and as such all Chromium-specific
code paths should no longer be automatically pulled by other
platforms where these code paths are not needed.

Given that the filepath of many files changed, here is the
parent commit to quickly browse back to the previous directory
layout:

ec7db30b2f
2021-07-16 10:06:58 -04:00