Go to file
Jimmy 54ca9b34e5 greasemonkey: enable running in isolated js worlds
QtWebEngine (via chromium) has the ability to run injected scripts in
isolated "worlds". What is isolated is just the javascript environment,
so variables and functions defined by the page and the script won't
clobber each other, or be able to interact (including variables saved to
the global `window` object). The DOM is still accessible from "isolated"
scripts.

This is NOT a security measure. You cannot put untrusted scripts in one
of these isolated worlds and expect it to not be able to do whatever
page js can do, it is just for namespacing convenience. See
https://stackoverflow.com/questions/9515704/insert-code-into-the-page-context-using-a-content-script
for some examples of how to inject scripts into the page scope using DOM
elements.

Now you can specify the world ID in a `@qute-js-world` directive like:

```
// ==UserScript==
// @name         Do thing
// @match        *://some.site/*
// @qute-js-world 1234
// ==/UserScript==
document.body.innerHTML = "<strong>overwritten</strong>"
```

The QtWebEngine docs say worldid is a `quint32` so you can put whatever
number (positive, whole, real) you want there. I have chosen to allow
the `qutebrowser.utils.usertypes` enum as aliases for IDs that are
predefined in
`qutebrowser.browser.webengine.webenginetab._JS_WORLD_MAP`. So you can
pass `main`, `application`, `user` or `jseval` in there too. `main` (0)
is the default one and is the only one in which JS disabled when
`content.javascript.enabled` is set to `false`. All others are still
enabled.

I'm not sure whether using any of those already-named worlds makes
sense, apart from `main`. We could stop people from using them I
suppose. Another option is to allow people to pass in `*` as a value to
have scripts put into their own little worlds, probably backed by a
counter in the GreaseMonkeyManager class.

Chrome docs: https://developer.chrome.com/extensions/content_scripts#execution-environment
Webengine docs: https://doc.qt.io/qt-5/qwebenginescript.html#details
2018-06-26 15:00:35 +12:00
.github Add myself to CODEOWNERS to watch for caret code 2018-01-19 22:25:58 +06:00
doc Disable certificate workaround on Qt >= 5.9 2018-06-25 20:35:48 +02:00
icons Add 32bit color for Windows icon 2018-03-21 23:13:26 +02:00
misc Revert "Update pyqt5 from 5.10.1 to 5.11.1" 2018-06-25 20:08:50 +02:00
qutebrowser greasemonkey: enable running in isolated js worlds 2018-06-26 15:00:35 +12:00
scripts Read dictionaries from /usr/share/qt on Qt >= 5.10 2018-06-17 20:27:52 +02:00
tests Stabilize escaping URLs test 2018-06-25 23:02:50 +02:00
www Use https:// links for qutebrowser.org 2017-11-14 10:43:05 +01:00
.appveyor.yml Use PyQt 5.10 on AppVeyor 2018-02-07 10:53:13 +01:00
.codecov.yml Make codecov.yml hidden 2017-09-17 21:40:35 +02:00
.coveragerc Add an utils.Unreachable exception 2017-12-15 16:33:47 +01:00
.editorconfig Add basic editorconfig for enforcing style 2016-04-06 02:55:34 -04:00
.flake8 flake8: Don't require docstrings for stuff under tests/ 2018-06-11 14:12:47 +02:00
.gitignore Move file_version_info.txt to misc/ and add it to .gitignore 2018-05-03 15:50:18 +03:00
.pydocstylerc Add a .pydocstylerc. 2016-01-30 23:39:55 +01:00
.pylintrc pylint: More config adjustments 2017-12-15 23:17:28 +01:00
.pyup.yml Switch pyup to Mondays 2017-08-24 05:50:33 +02:00
.travis.yml travis: Run coverage with PyQt 5.10 2018-06-12 10:53:34 +02:00
LICENSE Fix more file move issues 2017-09-17 21:54:42 +02:00
MANIFEST.in Remove old files from MANIFEST.in 2018-05-20 16:12:33 +02:00
pytest.ini Greasemonkey: skip window scoping test on webkit 2018-05-20 18:42:40 +12:00
qutebrowser.py Update copyright years 2018-02-05 12:19:50 +01:00
README.asciidoc Revert "Properly add QtQuickWidgets dependency" 2018-06-21 16:35:29 +02:00
requirements.txt Update attrs from 17.4.0 to 18.1.0 2018-05-07 18:39:17 +02:00
setup.py setup.py: Set long_description_content_type 2018-05-29 11:23:10 +02:00
tox.ini Force PyQt 5.10.0 with "tox -e mkvenv-pypi" 2018-03-11 20:47:01 +01:00

// If you are reading this in plaintext or on PyPi:
//
// A rendered version is available at:
// https://github.com/qutebrowser/qutebrowser/blob/master/README.asciidoc

qutebrowser
===========

// QUTE_WEB_HIDE
image:icons/qutebrowser-64x64.png[qutebrowser logo] *A keyboard-driven, vim-like browser based on PyQt5 and Qt.*

image:https://travis-ci.org/qutebrowser/qutebrowser.svg?branch=master["Build Status", link="https://travis-ci.org/qutebrowser/qutebrowser"]
image:https://ci.appveyor.com/api/projects/status/5pyauww2k68bbow2/branch/master?svg=true["AppVeyor build status", link="https://ci.appveyor.com/project/qutebrowser/qutebrowser"]
image:https://codecov.io/github/qutebrowser/qutebrowser/coverage.svg?branch=master["coverage badge",link="https://codecov.io/github/qutebrowser/qutebrowser?branch=master"]

link:https://www.qutebrowser.org[website] | link:https://blog.qutebrowser.org[blog] | https://github.com/qutebrowser/qutebrowser/blob/master/doc/faq.asciidoc[FAQ] | https://www.qutebrowser.org/doc/contributing.html[contributing] | link:https://github.com/qutebrowser/qutebrowser/releases[releases] | https://github.com/qutebrowser/qutebrowser/blob/master/doc/install.asciidoc[installing]
// QUTE_WEB_HIDE_END

qutebrowser is a keyboard-focused browser with a minimal GUI. It's based
on Python and PyQt5 and free software, licensed under the GPL.

It was inspired by other browsers/addons like dwb and Vimperator/Pentadactyl.

Screenshots
-----------

image:doc/img/main.png["screenshot 1",width=300,link="doc/img/main.png"]
image:doc/img/downloads.png["screenshot 2",width=300,link="doc/img/downloads.png"]
image:doc/img/completion.png["screenshot 3",width=300,link="doc/img/completion.png"]
image:doc/img/hints.png["screenshot 4",width=300,link="doc/img/hints.png"]

Downloads
---------

See the https://github.com/qutebrowser/qutebrowser/releases[github releases
page] for available downloads and the link:doc/install.asciidoc[INSTALL] file for
detailed instructions on how to get qutebrowser running on various platforms.

Documentation
-------------

In addition to the topics mentioned in this README, the following documents are
available:

* https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/cheatsheet-big.png[Key binding cheatsheet]: +
image:https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/cheatsheet-small.png["qutebrowser key binding cheatsheet",link="https://raw.githubusercontent.com/qutebrowser/qutebrowser/master/doc/img/cheatsheet-big.png"]
* link:doc/quickstart.asciidoc[Quick start guide]
* https://www.shortcutfoo.com/app/dojos/qutebrowser[Free training course] to remember those key bindings
* link:doc/faq.asciidoc[Frequently asked questions]
* link:doc/help/configuring.asciidoc[Configuring qutebrowser]
* link:doc/contributing.asciidoc[Contributing to qutebrowser]
* link:doc/install.asciidoc[Installing qutebrowser]
* link:doc/changelog.asciidoc[Change Log]
* link:doc/stacktrace.asciidoc[Reporting segfaults]
* link:doc/userscripts.asciidoc[How to write userscripts]

Getting help
------------

You can get help in the IRC channel
irc://irc.freenode.org/#qutebrowser[`#qutebrowser`] on
http://freenode.net/[Freenode]
(https://webchat.freenode.net/?channels=#qutebrowser[webchat]), or by writing a
message to the
https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[mailinglist] at
mailto:qutebrowser@lists.qutebrowser.org[].

There's also an https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser-announce[announce-only mailinglist]
at mailto:qutebrowser-announce@lists.qutebrowser.org[] (the announcements also
get sent to the general qutebrowser@ list).

If you're a reddit user, there's a
https://www.reddit.com/r/qutebrowser/[/r/qutebrowser] subreddit there.

Contributions / Bugs
--------------------

You want to contribute to qutebrowser? Awesome! Please read
link:doc/contributing.asciidoc[the contribution guidelines] for details and
useful hints.

If you found a bug or have a feature request, you can report it in several
ways:

* Use the built-in `:report` command or the automatic crash dialog.
* Open an issue in the Github issue tracker.
* Write a mail to the
https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[mailinglist] at
mailto:qutebrowser@lists.qutebrowser.org[].

For security bugs, please contact me directly at mail@qutebrowser.org, GPG ID
https://www.the-compiler.org/pubkey.asc[0x916eb0c8fd55a072].

Requirements
------------

The following software and libraries are required to run qutebrowser:

* http://www.python.org/[Python] 3.5 or newer (3.6 recommended)
* http://qt.io/[Qt] 5.7.1 or newer (5.10 recommended) with the following modules:
  - QtCore / qtbase
  - QtQuick (part of qtbase in some distributions)
  - QtSQL (part of qtbase in some distributions)
  - QtOpenGL
  - QtWebEngine, or
  - QtWebKit - only the
    link:https://github.com/annulen/webkit/wiki[updated fork] (5.212) is
    supported
* http://www.riverbankcomputing.com/software/pyqt/intro[PyQt] 5.7.0 or newer
  (5.10 recommended) for Python 3
* https://pypi.python.org/pypi/setuptools/[pkg_resources/setuptools]
* http://fdik.org/pyPEG/[pyPEG2]
* http://jinja.pocoo.org/[jinja2]
* http://pygments.org/[pygments]
* https://github.com/yaml/pyyaml[PyYAML]
* http://www.attrs.org/[attrs]

The following libraries are optional:

* http://cthedot.de/cssutils/[cssutils] (for an improved `:download --mhtml`
  with QtWebKit).
* On Windows, https://pypi.python.org/pypi/colorama/[colorama] for colored log
  output.
* http://asciidoc.org/[asciidoc] to generate the documentation for the `:help`
  command, when using the git repository (rather than a release).

See link:doc/install.asciidoc[the documentation] for directions on how to
install qutebrowser and its dependencies.

Donating
--------

Working on qutebrowser is a very rewarding hobby, but like (nearly) all hobbies
it also costs some money. Namely I have to pay for the server and domain, and
do occasional hardware upgrades footnote:[It turned out a 160 GB SSD is rather
small - the VMs and custom Qt builds I use for testing/developing qutebrowser
need about 100 GB of space].

If you want to give me a beer or a pizza back, I'm trying to make it as easy as
possible for you to do so. If some other way would be easier for you, please
get in touch!

* PayPal: me@the-compiler.org
* Bitcoin: link:bitcoin:1PMzbcetAHfpxoXww8Bj5XqquHtVvMjJtE[1PMzbcetAHfpxoXww8Bj5XqquHtVvMjJtE]

Authors
-------

qutebrowser's primary author is Florian Bruhin (The Compiler), but qutebrowser
wouldn't be what it is without the help of
https://github.com/qutebrowser/qutebrowser/graphs/contributors[hundreds of contributors]!

Additionally, the following people have contributed graphics:

* Jad/link:http://yelostudio.com[yelo] (new icon)
* WOFall (original icon)
* regines (key binding cheatsheet)

Also, thanks to everyone who contributed to one of qutebrowser's
link:doc/backers.asciidoc[crowdfunding campaigns]!

Similar projects
----------------

Many projects with a similar goal as qutebrowser exist.
Most of them were inspirations for qutebrowser in some way, thanks for that!

Active
~~~~~~

* https://fanglingsu.github.io/vimb/[vimb] (C, GTK+ with WebKit2)
* https://luakit.github.io/luakit/[luakit] (C/Lua, GTK+ with WebKit2)
* http://surf.suckless.org/[surf] (C, GTK+ with WebKit1/WebKit2)
* http://www.uzbl.org/[uzbl] (C, GTK+ with WebKit1/WebKit2)
* Chrome/Chromium addons:
  https://github.com/1995eaton/chromium-vim[cVim],
  http://vimium.github.io/[Vimium],
  https://github.com/brookhong/Surfingkeys[Surfingkeys],
  https://key.saka.io/[Saka Key]
* Firefox addons (based on WebExtensions):
  https://addons.mozilla.org/en-GB/firefox/addon/vimium-ff/[Vimium-FF] (experimental),
  https://key.saka.io[Saka Key],
  https://github.com/ueokande/vim-vixen[Vim Vixen],
  https://github.com/shinglyu/QuantumVim[QuantumVim],
  https://github.com/cmcaine/tridactyl[Tridactyl] (working
  on a https://bugzilla.mozilla.org/show_bug.cgi?id=1215061[better API] for
  keyboard integration in Firefox).

Inactive
~~~~~~~~

* https://bitbucket.org/portix/dwb[dwb] (C, GTK+ with WebKit1,
https://bitbucket.org/portix/dwb/pull-requests/22/several-cleanups-to-increase-portability/diff[unmaintained] -
main inspiration for qutebrowser)
* http://sourceforge.net/p/vimprobable/wiki/Home/[vimprobable] (C, GTK+ with
  WebKit1)
* http://pwmt.org/projects/jumanji/[jumanji] (C, GTK+ with WebKit1)
* http://conkeror.org/[conkeror] (Javascript, Emacs-like, XULRunner/Gecko)
* Firefox addons (not based on WebExtensions or no recent activity):
  http://www.vimperator.org/[Vimperator],
  http://5digits.org/pentadactyl/[Pentadactyl],
  https://github.com/akhodakivskiy/VimFx[VimFx],
* Chrome/Chromium addons:
  https://chrome.google.com/webstore/detail/vichrome/gghkfhpblkcmlkmpcpgaajbbiikbhpdi?hl=en[ViChrome],
  https://github.com/jinzhu/vrome[Vrome]

License
-------

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.

pdf.js
------

qutebrowser optionally uses https://github.com/mozilla/pdf.js/[pdf.js] to
display PDF files in the browser. Windows releases come with a bundled pdf.js.

pdf.js is distributed under the terms of the Apache License. You can
find a copy of the license in `qutebrowser/3rdparty/pdfjs/LICENSE` (in the
Windows release or after running `scripts/dev/update_3rdparty.py`), or online
http://www.apache.org/licenses/LICENSE-2.0.html[here].