Commit graph

38 commits

Author SHA1 Message Date
Thomas Buckley-Houston 5b6cc89770 Refactored webext classes to be more SRP
The biggest refactor is separating out the DocumentBuilder from the DOM
Manager.

I also made consistent use of the mixin pattern I'd only half
implemented.
2018-04-09 18:36:46 +08:00
Thomas Buckley-Houston 1acb178fa7 Lots of new integration tests 2018-04-07 11:35:17 +08:00
Thomas Buckley-Houston 101b10b0e0 Use which when deciding if Firefox binary exists 2018-02-17 16:14:10 +08:00
Thomas Buckley-Houston c44e218c8a Bump to v0.2.13
FPM failed again :/
2018-02-17 15:16:21 +08:00
Thomas Buckley-Houston 29f4dce00b Bump to version 0.2.12 2018-02-17 15:08:07 +08:00
Thomas Buckley-Houston 8b042b2479 Added PAGEUP and PAGEDOWN key movement 2018-02-17 15:02:50 +08:00
Thomas Buckley-Houston 8cf3de33c3 Move integration tests to Golang CLI client
After moving to Tcell and implementing its screen diff updates, we can
no longer watch STDOUT to get frames during integration tests. Instead
we need to use Tcell's SimulationScreen and which has a GetContents()
method. This is actually also a much more robust way of being able to
see what Browsh actually outputs during testing.
2018-02-17 14:10:39 +08:00
Thomas Buckley-Houston b5a083e929 Replaced Termbox-go with Tcell
This was primarily to get native diff'ed frame rendering.
Termbox-go doesn't support true colours, thus the switch to Tcell, but
as it turns out Tcell claims to have wider platform support, so it looks
like an especially good change.

So now the CLI will only try to update the terminal screen when cells
actually change. This has some significant performant gains, especially
when using Browsh over SSH.

Also note that this required a complete change of the frame data
structure sent over the websocket. Previously it was a little
structured, but now it is just a plain 1 dimensional array of pure
strings, even the RGB components are sent as integers in strings. If I
can find a way to unmarshal mixed arrays in  Golang then it'll be worth
sending a mixed JSON array to save some compute overhead.
2018-02-14 10:33:39 +08:00
Thomas Buckley-Houston 60c20ee404 Release v0.2.11
Sigh, it's annoying that if the release block fails then we have to bump
the version :/ It's because the Mozilla Addon XPI version can be
re-released.
2018-02-09 11:52:19 +08:00
Thomas Buckley-Houston e1c8cf8a45 Release v0.2.10 2018-02-09 11:47:45 +08:00
Thomas Buckley-Houston 30b83d9d8f Release v0.2.9 2018-02-09 11:34:24 +08:00
Thomas Buckley-Houston 3091510a08 Fixes bug: "undefined" when clicking on URL bar 2018-02-09 11:25:11 +08:00
Thomas Buckley-Houston bb313f568a Added a monochrome mode: ALT+M to toggle
TODO: Still needs a way to represent clickable text
2018-02-09 11:13:33 +08:00
Thomas Buckley-Houston 819a29c8b6 Mouse wheel scrolling
Also throttle the frame rate to 40ms/ Previously it was redrawing on
every sent STDIN event.
2018-02-09 10:06:54 +08:00
Thomas Buckley-Houston f624ea00f1 Forgot to bump the version in manifest.json 2018-02-08 20:28:12 +08:00
Thomas Buckley-Houston cf6cde86f7 Added -startup-url and -time-limit args 2018-02-04 18:26:01 +08:00
Thomas Buckley-Houston c0e51e6413 Use Browsh-specific FF profile.
Also adds `-debug` flag.
2018-02-03 15:21:58 +08:00
Thomas Buckley-Houston 3b7ee79808 Just a version bump to retry a goreleaser bug 2018-02-02 17:35:18 +08:00
Thomas Buckley-Houston cdab6bde93 Bugfixes to Dockerfile 2018-02-02 17:20:37 +08:00
Thomas Buckley-Houston afca0dd468 Auto-reload a tab if it doesn't connect to webext 2018-02-01 23:15:34 +08:00
Thomas Buckley-Houston 7117eb9965 Added screenshot feature: press ALT+P
In the endless struggle to squash a Travis-specific bug, we now have
screenshots. Currently the screenshots are of the custom block font
state, so you can't read the text. But I'm planning on changing the
default state of the page to use a normal font - such that the
frame builder needs to toggle the block font on to build a frame. This
will make it more likely that screenshots will contain actual text.
2018-02-01 17:34:25 +08:00
Thomas Buckley-Houston 74538fed0e Fix for zero-width chars in page titles
Also removes the Mozilla Cliqz disclaimer tab on first startup.
Interestingly it has a carriage return in its HTML page title, which is
of course zero-width. But also the fact that this tab can sometimes load
before the requested tab at startup is a showstopper for automated
tests.
2018-01-31 15:40:43 +08:00
Thomas Buckley-Houston 0b3ff030cd Release v0.2.3 2018-01-30 17:50:55 +08:00
Thomas Buckley-Houston 2985774859 Automate releases 2018-01-28 16:08:19 +08:00
Thomas Buckley-Houston 6f0a732145 Adds Go built binaries to .gitignore 2018-01-24 16:50:09 +08:00
Thomas Buckley-Houston 9a82182a9a Don't use --new-instance, -P when launching FF 2018-01-24 10:59:57 +08:00
Thomas Buckley-Houston 318f5c3c34 First draft of integration tests 2018-01-23 20:04:23 +08:00
Thomas Buckley-Houston b387f66c69 Launch and install webextension from client
This means that Browsh can now be entirely run just by running the CLI
binary. The client launches Firefox as a subprocess, then connects to it
via the Marionette protocol, installs the webextension and finally
triggers a new tab with, currently, the Google homepage in it.

I was trying to set this up for automated testing as well by installing
the built webextension as a temporary addon, because otherwise you need
to sign the extension everytime with a unique semantic version. However
for some reason I can't quite recreate the environment that MDN's
`web-ext` creates. The extension installs fine but fails to load the
`content.js` script, I can't find a backtrace or any other details about
the failure. So for now, we're just going to have to use `web-ext` as
seperate process and have the client connect to that. Which is what one
should do during development anyway, so it's not a huge loss.
2018-01-21 11:56:05 +08:00
Thomas Buckley-Houston ef5c683591 Back and stop button 2018-01-17 15:52:52 +08:00
Thomas Buckley-Houston 4177bff127 First draft of mouse down/up/click support 2018-01-17 11:00:37 +08:00
Thomas Buckley-Houston 3fc70e6718 Basic z-layer detection for clobbered characters 2018-01-15 12:06:05 +08:00
Thomas Buckley-Houston 64431be7c3 First pass at supporting wide UTF8 chars like 中文 2018-01-14 22:29:08 +08:00
Thomas Buckley-Houston 97a36b68b4 First drafy of UI: tabs and URL bar 2018-01-12 21:58:32 +08:00
Thomas Buckley-Houston ad59dc3ce4 Basic up/down scrolling 2018-01-11 12:22:27 +08:00
Thomas Buckley-Houston d2aaa33963 Refactored webext background script 2018-01-10 22:54:51 +08:00
Thomas Buckley-Houston 27e0b2ddc6 First working draft of Golang interfacer
After weighing up the options it seems that Golang's termbox-go TTY
library has better support for terminals, and it's cross-platform out of
the box. So this commit is the first working version where the
interfacer launches a websocket server, makes a connection to the
webextension and listens to STDIN from the CLI, sending all input to the
webextenstion.
2018-01-07 11:21:29 +08:00
Thomas Buckley-Houston be2b961cfe Sample text colour using monochar block font trick
Using JS's `getComputedStyle()` for every character is too CPU
intensive, so instead I'm experimenting with using a custom font
to take the canvas snapshot. The font is made up of only the unicode
block character, which basically fills the entire space given to a
monospace glyph. This also means that we can fairly reliably work out
the visibility (whether it's obscured or hidden with CSS) of text.
2018-01-01 22:10:10 +08:00
Thomas Buckley-Houston d00361f87d First draft of rewrite to Webextension and Rust
This proves that frames can be generated on Firefox using the canvas and
a Tree Walker to examine text nodes. Already with little optimisation
frames don't ever take longer than 200ms to render.

Chrome has a MediaStream of the viewport, hopefully that will prove
performant as well.

This doesn't have functioning text colour detection or text occlusion
support. But early research suggests this will possible by comparing 2
screenshots: one with and the other without rendered text.
2018-01-01 21:50:30 +08:00