New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against rapid changes #139

Merged
merged 19 commits into from Jan 19, 2018

Conversation

1 participant
@matatk
Owner

matatk commented Jan 14, 2018

This implements an adaptive performance adjustment to mitigate against many mutations happening within a short space of time on a page. Details on how this works can be found in #127.

This guards against any changes to the DOM, not just those that get checked and ultimately trigger a scan for landmarks. The reason is that if there are many changes that are not related to landmarks, that could still slow things down.

In support of this, a lot of refactoring and simplification of the content script has occurred.

matatk added some commits Jan 5, 2018

Improve mutation observer performance
* Back off exponentially when getting more mutation events.
* After events stop, decrease the pause linearly.
* Factor out the handling of this into PauseHandler.
* Minor tidy-ups in LandmarksFinder.
Add debugging info option
* Add option to the options page.
* Tweak spacing on optoins page.
* Add a message for the option name.
* Hook up PauseHandler to the option and changes to it.
Remove unnecessary compatibility short-circuit
* Opera supports the storage.sync object, even though it does not support synching.
* Fixes #132.
README tweaks
* Seems GitHub doesn't render "---" as an em-dash, so revert to the HTML
  character code.
* Update info on the mutation guarding changes.
* Use bold text for the "definition" parts of the keyboard shortcuts,
  and re-word slightly for generality of input devices :-).
* Add notes about the more minor PRs that went into this release.
Rename content scripts; Errors
* To keep the naming consistent.
* To keep alphabetical order matching logical order.
* Use just Error instead of "new Error".
Simplify content script bootstrapping (closes #137)
* Remove unused translation message.
* Simplify LandmarksFinder API and rename functions for clarity (they
  are getters). This fixes a bug that was there for ages whereby it was
  not calling the function to check the number of landmarks found (in
  checkFocusElement()).
* Vastly simplify the bootstrapping code in content.overall.js.
* Move Logger to content.overall.js from content.pausing.js and
  generalise.
* Remove Logger from content.pausing.js.
* Disconnect observer if content script has been retired (fixes #131).
Complete guarding (fixes #127)
* Remove magic numbers in all setTimeout() calls.
* If landmarks might be out-of-date, re-scan when using the button or
  keyboard shortcuts.
* Make injected landmarks test page less verbose.
Rename content.overall.js
Oops; had failed to do this right last time :-).
Improve logging
Bind the logging function to the console so that it can correctly work
out where the log message originated.

@matatk matatk merged commit 2200824 into master Jan 19, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@matatk matatk deleted the guard-against-rapid-changes branch Jan 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment