Commit graph

81 commits

Author SHA1 Message Date
Oliver Blanthorn
dd482087ed
Remove now unused locks 2020-05-09 12:36:03 +01:00
Oliver Blanthorn
1c4722f4db
Fix #2352: update tri.contentLocation on navigation
I think 'forgetting that people navigate to web pages without changing tab' is
probably the funniest root-cause of a bug we've had in a while.
2020-05-04 13:25:28 +01:00
Oliver Blanthorn
7705ebf5d8
Fix #1538: synchronise repeat between tabs and bg 2020-02-28 09:40:01 +00:00
Oliver Blanthorn
27572a5914
Revert "Merge branch 'config_no_onchanged'"
This reverts commit fe39c3e43a, reversing
changes made to 9ceb56595c.
2020-02-20 10:23:56 +00:00
Oliver Blanthorn
051c1085f2
Hic erant errata 2020-02-19 11:55:22 +00:00
Oliver Blanthorn
6031001dcb
Unbreak Tridactyl by importing locks earlier
This is the most mad bug I've had in a while. O_o
2020-02-18 19:06:10 +00:00
Oliver Blanthorn
acae10a8cd
Add locks library 2020-02-16 20:19:26 +00:00
Oliver Blanthorn
56f69a7814
Fix #2158: add R to tri object 2020-02-16 16:06:28 +00:00
Jakub Okoński
0fba6a338f Don't export background message handler definitions 2019-10-27 12:16:24 +01:00
Jakub Okoński
a8b740b1bd Add strong typing to background messages 2019-10-26 21:55:59 +02:00
Oliver Blanthorn
d3ae60c8f3
Merge pull request #1879 from tridactyl/remove_csp
Remove `set csp clobber`
2019-10-03 00:59:48 +08:00
glacambre
a4040102f5
Remove set csp clobber
This just removes the background.ts code that detects whether the user
wants to clobber their csp and adds an error message if the user tries
to `set csp clobber`.
The `csp` setting is marked as deprecated but left untouched in case we
find a way to edit CSP in a way that complies with Mozilla's policies.
The csp-editing code in `requests.ts` is left untouched for the same
reason.
2019-10-02 10:25:03 +02:00
glacambre
6759bd235d
Implement changes required by Mozilla.
More information in #1800.
2019-10-02 08:31:37 +02:00
glacambre
f050f68740
Turn hint mode into a real mode
This commit turns hint mode into a real mode. This required several
changes:
- In `src/content/hinting.ts`: create a function named getHintCommands
  which returns an object containing functions that can be used as ex
  commands.
- In `src/content/hinting.ts`: rewriting the `parser` function to have
  it check the `hintmaps` object in the config and trigger these if
  they're bound to anything. We can't use a generic parser because
  vimperator hints need to catch every single keypress, even the ones
  that aren't bound to anything and act on them.
- Creating `src/background/hinting.ts`, which just wraps ex commands
  from src/content/hintings.ts in a proxy which will forward calls to the
  content script.
2019-05-28 12:41:40 +02:00
Saul Reynolds-Haertle
0c63944b15 Add tri omnibox keyword as another escape hatch
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/omnibox
2019-05-05 13:42:07 -07:00
glacambre
eda244b75a
Make text.* excmds work in the command line on the newtab page again 2019-04-23 19:56:10 +02:00
Saul Reynolds-Haertle
25d64258e2 Move all of the update* configs to an update namespace
updatenag => update.nag, etc.
2019-04-22 22:03:17 -07:00
Saul Reynolds-Haertle
ec48314d7c Refactor update-checking logic so we can check more frequently
We couldn't have just invoked "check for updates" on every single
operation because it would've gone out to the RSS every time. This
refactor permits it to cache a highest known version for a
configurable interval. It should be safe to invoke this new
update-checking logic as frequently as desired.
2019-04-22 22:01:58 -07:00
Saul Reynolds-Haertle
2e5fdfb63c Run excmds in content. 2019-04-21 02:42:59 -07:00
Saul Reynolds-Haertle
09005940ef Make extension_info in background comply with no-unused-declarations 2019-04-17 00:29:46 -07:00
Saul Reynolds-Haertle
bc482ec64d Add new check to autocontain code to suppress some double-opens 2019-04-16 22:59:30 -07:00
Saul Reynolds-Haertle
6f726d7092 Teach autocontainers to coexist with other container-management exts
This has a few moving parts.

First, we need a bit of code for keeping track of what other
extensions are installed and enabled. This isn't completely trivial
because we need to listen for "on {en,dis}abled" and "on
{,un}installed" events. This requires a new permission, `management`,
which is _annoying_, but not having this permission would require
extension detection to be done using kludgy messaging hacks that would
be on the critical path for essentially every navigation operation.

Second, we need to write code to talk to the other addons and ask them
if they're handling things. Thankfully they do provide public APIs and
and we can use their sample code to do exactly what we need to do.

Third, it turns out some important chunks of the firefox webext API
aren't handled by the web-ext-browser ts declaration we're
using. They *are* handled by a PR on @types/firefox-webext-browser,
though, so we can copy and paste that to make TS happy.

Fourth, and finally, we need to add some code to the autocontainer
logic to use the compatibility code. This is pretty easy, but
autocontainer logic starts taking a noticeable amount of time becuase
of all the sequences awaits we're doing, so I also have to tweak
things to do all of the async stuff in parallel.
2019-04-16 22:59:30 -07:00
glacambre
af20bbe4df
TSLint: re-enable no-identical-functions rule 2019-04-15 19:47:41 +02:00
glacambre
3fe1e5a091
TSLint: re-enable no-empty rule 2019-04-14 10:27:22 +02:00
glacambre
2b11d1d464
TSLint: re-enable prefer-const rule 2019-04-14 08:01:26 +02:00
glacambre
0a8c3cd2f6
TSLint: re-enable whitespace rule 2019-04-12 05:54:31 +02:00
glacambre
ff8f313aa5
Turn double-equals into triple-equals
See https://github.com/tridactyl/tridactyl/pull/1451
2019-04-10 12:28:47 +02:00
glacambre
3953830787
TSLint: re-enable import-spacing rule 2019-04-05 13:20:23 +02:00
glacambre
85b3e33719
Remove commandline_background
This commit removes commandline_background.ts. I believe this is useful
because the only thing it did was provide recvExStr, which just
triggered a synthetic "onLine" event the only consumer of which was the
parser. Since we already used controller_background + acceptExCmd in
some places, it made sense to me to directly use controller_background +
acceptExCmd everywhere.
2019-02-26 08:41:19 +01:00
glacambre
68a8fccb50
Mobe background/native_background.ts to lib/native.ts
All functions in native_background.ts use browserBg in order to interact
with the native messenger. This means that these functions can also be
used in the content script. This means that there's no point in keeping
these functions in the background/ folder and that there's no point in
having a native_background message type.
2019-02-20 07:09:01 +01:00
glacambre
820b35b984
background.ts: Replace performance.now() with a simple count
Using performance.now() was a pretty dumb idea that didn't completely
protect us against race conditions and I don't know why I did that
instead of the new code in this commit, which does completely protect us
against race conditions.
2018-12-18 05:27:46 +01:00
Oliver Blanthorn
be2618c352
Merge branch 'config_api' 2018-12-13 13:03:42 +00:00
Oliver Blanthorn
2aa36f7554
Check for updates at start, only nag if it's been a while 2018-12-07 15:40:20 +00:00
glacambre
51b4480b3f
Replace browser.storage.onChanged with config.addChangeListener
This commit replaces the use of browser.storage.onChanged.addListener
with the newly-implemented config.addChangeListener.
2018-11-23 22:42:52 +01:00
Oliver Blanthorn
3ec27fd40c
Merge branch 'reorganize-directories' 2018-10-04 13:59:19 +01:00
Saul Reynolds-Haertle
77832fd8a2 Add documentation for perf counts library and clean up the interface
Most importantly, provide some convenience functions for hooking up
listeners and messaging.
2018-09-30 12:01:07 -07:00
Saul Reynolds-Haertle
b8e0459e6b Build a performance counters system so I can start optimizing things
Complete a circular buffer so we don't log too much data, config
settings for turning it on and off (default off, becuase performance)
and for changing the size of the buffer, an excmd for dumping the raw
json so you can pore over it, and for when you just want to
sanity-check yourself instead of groveling over your data for six days
with a deep learning toolkit and three hundred CPUs of compute, an
excmd for pretty-printing your stats in a nice histogram.

I didn't think far enough ahead and only implemented the easy way to
instrument a function, which is with a decorator. I'm getting _really_
angry at typescript not being able to handle decorators on free
functions. bah. I'll figure out a good way to wrap free
functions. Maybe just go the stupid route and make you change
`export async function foo(args)` to `export foo = measured(async
function(args) ...`. But that would break excmd parsing, so... :/

I think that I already want to do a refactor to break excmd.ts into a
bunch of one-line wrappers referencing implementations spread
throughout a bunch of libraries. This would go nicely with that.

Other things I did while I was here:
* Fix the ugliness we had with (window as any).tri by monkey-patching
  the tri property into the window object in tridactyl.d.ts
2018-09-30 12:01:07 -07:00
Saul Reynolds-Haertle
f95a33d76c Fix remaining relative imports 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
a9367f479b move src/keyseq.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
8670ed1136 move src/dom.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
b181840ceb move src/requests.ts into src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
eeb74c95c6 move src/native_background.ts to src/background/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
3160137c57 move src/messaging.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
c02ef5a90e Move src/itertools.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
c8362dd774 Move src/download_background.ts to src/background/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
4bdd07308a Move src/convert.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
de860eddb8 Move src/controller_background.ts to src/background/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
c531aa5481 Move src/config.ts to src/lib/ 2018-09-29 18:03:36 -07:00
Saul Reynolds-Haertle
9dad2e4ae8 Move src/commandline_background.ts to src/background/ 2018-09-29 18:03:36 -07:00
glacambre
1a1688a83f
Implement site-specific settings
This PR implements site-specific settings. It requires multiple changes
and new features.

First, I needed to create a new value in `window.tri` named
`contentLocation`. This contentLocation object is either a Location or
URL object containing the URL of the currently selected tab of the
currently selected window. This is required because config.get() is not
asynchronous and we probably want to keep it that way, thus we can't
message the content script just to get the current url.

Then, we create a new object, URLCONFIGS, in content.ts. It behaves
exactly the same as USERCONFIG, except it has a level of indirection,
matching url patterns to config objects. This requires creating new
seturl, geturl and unseturl functions which behave mostly the same as
set, get and unset.

Last, we create a `seturl` ex command in order to interact with this new
object.
2018-09-10 18:51:31 +02:00