summaryrefslogtreecommitdiff
path: root/README.md
blob: 59d039669c327842e0203a9b12bcda92934d5cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
[![CircleCI](https://circleci.com/gh/midori-browser/core.svg?style=svg)](https://circleci.com/gh/midori-browser/core)
[![Snap Status](https://build.snapcraft.io/badge/midori-browser/core.svg)](https://build.snapcraft.io/user/midori-browser/core)
[![FlatHub](https://img.shields.io/badge/FlatHub-gray.svg)](https://flathub.org/apps/details/org.midori_browser.Midori)
[![Telegram](https://img.shields.io/badge/Telegram-Chat-gray.svg?style=flat&logo=telegram&colorA=5583a4&logoColor=fff)](https://www.midori-browser.org/telegram)
[![Twitter](https://img.shields.io/twitter/follow/midoriweb.svg?style=social&label=Follow)](https://twitter.com/midoriweb)
[![Donate](https://img.shields.io/badge/PayPal-Donate-gray.svg?style=flat&logo=paypal&colorA=0071bb&logoColor=fff)](https://www.midori-browser.org/donate)
[![BountySource](https://img.shields.io/bountysource/team/midori/activity.svg)](https://www.bountysource.com/teams/midori)
[![Patreon](https://img.shields.io/badge/PATREON-Pledge-red.svg)](https://www.patreon.com/midoribrowser)

<p align="center">
    <img src="icons/scalable/apps/org.midori_browser.Midori.svg"/>
</p>

<p align="center">
    <b>Midori</b>
    a lightweight, fast and free web browser
</p>

![Midori Screenshot](https://www.midori-browser.org/images/screenshots/rdio.png)

Midori is a lightweight yet powerful web browser which runs just as well on little embedded computers named for delicious pastries as it does on beefy machines with a core temperature exceeding that of planet earth. And it looks good doing that, too. Oh, and of course it's free software.

**Privacy out of the box**

* Adblock filter list support
* Private browsing
* Manage cookies and scripts

**Productivity features**

* Open a 1000 tabs instantly
* Easy web apps creation
* Customizable side panels
* User scripts and styles a la Greasemonkey
* Web developer tools powered by WebKit
* Cross-browser extensions compatible with Chrome, Firefox, Opera and Vivaldi

Please report comments, suggestions and bugs to:
    https://github.com/midori-browser/core/issues

Join [the #midori IRC channel](https://www.midori-browser.org/irc) on Freenode
or [the Telegram group](https://www.midori-browser.org/telegram)!

# Installing Midori on Linux

If [your distro supports snaps](https://docs.snapcraft.io/core/)
you can install the **latest stable** version of Midori
[from the snap store](https://snapcraft.io/midori) with a single command:

    snap install midori

> **Spoilers:** For those more adventurous types out there, trying out the preview of the next version is only the switch of a channel away.

You can also install Midori from [FlatHub](https://flathub.org/apps/details/org.midori_browser.Midori).

    flatpak install flathub org.midori_browser.Midori

# Installing Midori on Android

You can opt-in for the [beta release on the Play Store](https://play.google.com/apps/testing/org.midori_browser.midori).

# Building from source

**Requirements**

* [GLib](https://wiki.gnome.org/Projects/GLib) 2.46.2
* [GTK](https://www.gtk.org) 3.12
* [WebKitGTK](https://webkitgtk.org/) 2.16.6
* [libsoup](https://wiki.gnome.org/Projects/libsoup) 2.48.0
* [sqlite](https://sqlite.org) 3.6.19
* [Vala](https://wiki.gnome.org/Projects/Vala) 0.30
* GCR 2.32
* [Libpeas](https://wiki.gnome.org/Projects/Libpeas)
* [JSON-Glib](https://wiki.gnome.org/Projects/JsonGlib) 0.12

Install dependencies on Astian OS, Ubuntu, Debian or other Debian-based distros:

    sudo apt install cmake valac libwebkit2gtk-4.0-dev libgcr-3-dev libpeas-dev libsqlite3-dev libjson-glib-dev libarchive-dev intltool libxml2-utils

Install dependencies on openSUSE:

    sudo zypper in cmake vala gcc webkit2gtk3-devel libgcr-devel libpeas-devel sqlite3-devel json-glib-devel libarchive-devel fdupes gettext-tools intltool libxml2-devel

Install dependencies on Fedora:

    sudo dnf install gcc cmake intltool vala libsoup-devel sqlite-devel webkit2gtk3-devel gcr-devel json-glib-devel libpeas-devel libarchive-devel libxml2-devel

Use CMake to build Midori:

    mkdir _build
    cd _build
    cmake -DCMAKE_INSTALL_PREFIX=/usr ..
    make
    sudo make install

> **Spoilers:** Pass `-G Ninja` to CMake to use [Ninja](http://martine.github.io/ninja) instead of make (install `ninja-build` on Ubuntu/ Debian).

Midori can be **run without being installed**.

    _build/midori

# Testing

## Unit tests

You'll want to **unit test** the code if you're testing a new version or contributed your own changes:

    xvfb-run make check

## Manual checklist

* Browser window starts up normally, with optional URL(s) on the command line
* Tabs have icons, a close button if there's more than one and can be switched
* Urlbar suggests from typed search or URL, completes from history and highlights key
* Private data can be cleared
* Shortcuts window shows most important hotkeys
* Download button lists on-going and finished downloads
* `javascript:alert("test")`, `javascript:confirm("test")` and `javascript:input("test")` work
* Websites can (un)toggle fullscreen mode
* Shrinking the window moves browser and page actions into the respective menus

# Release process

We're on a 8/4 cycle which means 8 weeks of features and 4 weeks of stabilization
capped at a release once every 3 months ie. at the last of the third month.

Update `CORE_VERSION` in `CMakeLists.txt` to `10.0`.
Add a section to `CHANGELOG.md`.
Add release to `data/org.midori_browser.Midori.appdata.xml.in`.

    git commit -p -v -m "Release Midori 10.0"
    git checkout -B release-10.0
    git push origin HEAD
    git archive --prefix=midori-v10.0/ -o midori-v10.0.tar.gz -9 HEAD

Propose a PR for the release.
Publish the release on https://github.com/midori-browser/core/releases
Promote snap on https://snapcraft.io/midori/release to the `stable` channel

# Troubleshooting

Testing an installed release may reveal crashers or memory corruption which require investigating from a local build and obtaining a stacktrace (backtrace, crash log).

    gdb _build/midori
    run
    …
    bt

If the problem is a warning, not a crash GLib has a handy feature

    env G_MESSAGES_DEBUG=all gdb _build/midori

On Windows you can open the folder where Midori is installed and double-click gdb.exe which opens a command window:

    file midori.exe
    run
    …
    bt

To verify a regression you might need to revert a particular change:

    # Revert only d54c7e45
    git revert d54c7e45

# Contributing code

## Coding style and quality

Midori code should in general have:

  * 4 space indentation, no tabs
  * Between 80 to 120 columns
  * Use `//` or `/* */` style comments
  * Call variables `animal` and `animal_shelter` instead of ~camelCase~
  * Keep a space between functions/ keywords and round parentheses
  * Prefer `new Gtk.Widget ()` over `using Gtk; new Widget ()`
  * `Midori` and `GLib` namespaces should be omitted
  * Don't use `private` specifiers (which is the default)
  * Stick to standard Vala-style curly parentheses on the same line
  * Cuddled `} else {` and `} catch (Error error) {`

## Working with Git

If you haven't yet, [check that GitHub has your SSH key](https://github.com/settings/keys).
> **Spoilers:** You can create an SSH key with **Passwords and Keys** aka **Seahorse**
> or `ssh-keygen -t rsa` and specify `Host github.com` with `User git` in your SSH config.
> See [GitHub docs](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) for further details.

[Fork the project on GitHub](https://help.github.com/articles/fork-a-repo).

    # USERNAME is your GitHub username
    git clone git@github.com:USERNAME/core.git

Prepare to pull in updates from upstream:

    git remote add upstream https://github.com/midori-browser/core.git

> **Spoilers:** The code used to be hosted at `lp:midori` and `git.xfce.org/apps/midori` respectively.

The development **master** (trunk, tip) is the latest iteration of the next release.

    git checkout upstream/master

Pick a name for your feature branch:

    git checkout -B myfeature

Remember to keep your branch updated:

    git pull -r upstream master

Tell git your name if you haven't yet:

    git config user.email "<email@address>"
    git config user.name "Real Name"

See what you did so far

    git diff

Get an overview of changed and new files:

    git status -u

Add new files, move/ rename or delete:

    git add FILENAME
    mv OLDFILE NEWFILE
    rm FILENAME

Commit all current changes, selected interactively:

    git commit -p -v

If you have one or more related bug reports you should mention them
in the commit message. Once these commits are merged the bug will
automatically be closed and the commit log shows clickable links to the reports:

    Fixes: #123

If you've made several commits:

    git log

In the case you committed something wrong or want to amend it:

    git reset --soft HEAD^

If you end up with unrelated debugging code or other patches in the current changes
it's sometimes handy to temporarily clean up.
This may be seen as git's version of `bzr shelve`:

    git stash save
    git commit -p -v
    git stash apply

As a general rule of thumb, `git COMMAND --help` gives you an explanation
of any command and `git --help -a` lists all available commands.

Push your branch and **propose it for merging into master**.

    git push origin HEAD

This will automatically request a **review from other developers** who can then comment on it and provide feedback.

# Extensions

## Cross-browser web extensions

The following API specification is supported by Midori:

    manifest.json
      name
      version
      description
      background:
        page: *.html
        scripts:
        - *.js
      browser_action:
        default_popup: *.html
        default_icon: *.png
        default_title
      sidebar_action:
        default_panel: *.html
        default_icon: *.png
        default_title
      content_scripts:
        js:
        - *.js
        css:
        - *.css
      manifest_version: 2

    *.js
      browser (chrome)
        tabs
          create
          - url: uri
          executeScript
          - code: string
        notifications
          create
          - title: string
            message: string

# Jargon

* **freeze**: a period of bug fixes eg. 4/2 cycle means 4 weeks of features and 2 weeks of stabilization
* **PR**: pull request, a branch proposed for review, analogous to **MR** (merge request) with Bazaar
* **ninja**: an internal tab, usually empty label, used for taking screenshots
* **fortress**: user of an ancient release like 0.4.3 as found on Raspberry Pie, Debian, Ubuntu
* **katze, sokoke, tabby**: legacy API names and coincidentally cat breeds
* web extension: a cross-browser extension (plugin) - or in a webkit context, the multi-process api

# Midori for Android

The easiest way to build, develop and test Midori on Android is with [Android Studio](https://developer.android.com/studio/#downloads) ([snap](https://snapcraft.io/android-studio)).

When working with the command line, setting `JAVA_HOME` is paramount:

    export JAVA_HOME=/snap/android-studio/current/android-studio/jre/

Afterwards you can run commands like so:

    ./gradlew lint test

# Midori for Windows

## For Linux developers

### Dependencies

Midori for Windows is compiled on a Linux host and MinGW stack. For the current build Fedora 18 packages are used. Packages needed are listed below:

    yum install gcc vala intltool

For a native build

    yum install libsoup-devel webkitgtk3-devel sqlite-devel

For cross-compilation

    yum install mingw{32,64}-webkitgtk3 mingw{32,64}-glib-networking mingw{32,64}-gdb mingw{32,64}-gstreamer-plugins-good

Packages needed when assembling the archive

    yum install faenza-icon-theme p7zip mingw32-nsis greybird-gtk3-theme

Installing those should get you the packages needed to successfully build and develop Midori for Win32.

### Building

For 32-bit builds:

    mkdir _mingw32
    cd _mingw32
    mingw32-cmake .. -DCMAKE_INSTALL_PREFIX=/usr/i686-w64-mingw32/sys-root/mingw -DCMAKE_VERBOSE_MAKEFILE=0
    make
    sudo make install

For 64-bit builds:

    mkdir _mingw64
    cd _mingw64
    mingw64-cmake .. -DCMAKE_INSTALL_PREFIX=/usr/x86_64-w64-mingw32/sys-root/mingw -DCMAKE_VERBOSE_MAKEFILE=0
    make
    sudo make install

Once built and tested you can assemble the Midori archive with a helper script

32-bit build:

    env MINGW_PREFIX="/usr/i686-w64-mingw32/sys-root/mingw" ./win32/makedist/makedist.midori

64-bit build:

    env MINGW_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw/" ./win32/makedist/makedist.midori x64

### Testing

For testing your changes a real system is recommended because WebKitGTK+ doesn't work properly under Wine. Mounting your MinGW directories as a network drive or shared folder in a Windows VM is a good option.

## For Windows developers

### Prerequisites

* [MinGW](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win32_rubenvb.7z/download) *mingw64 rubenvb*/ gcc 4.8.0 ([Releases](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.8-release))
* [7zip](http://www.7-zip.org/download.html) ([32bit Installer](http://downloads.sourceforge.net/sevenzip/7z920.exe)) to extract archives
* [Python3](http://www.python.org/download/releases/3.3.5) to use **download-mingw-rpm.py**.
* [download-mingw-rpm.py](https://github.com/mkbosmans/download-mingw-rpm/blob/master/download-mingw-rpm.py) to fetch and unpack rpm's
* [Msys](http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/MSYS-20111123.zip/download) contains shell and some small utilities
* [CMake](http://www.cmake.org/cmake/resources/software.html) ([Installer](http://www.cmake.org/files/v2.8/cmake-2.8.12.2-win32-x86.exe))
* [Vala](http://ftp.gnome.org/pub/gnome/sources/vala/0.20/vala-0.20.0.tar.xz)


> **Spoilers:** 32-bit versions are known to be more stable at the time of this writing.

### Using download-mingw-rpm.py

* Launch `cmd.exe` and navigate to the folder where the script was saved.
* Make sure that Python can access `7z.exe`.
* Run the following command and wait for it to extract the packages into your current directory:
* `c:\Python33\python.exe download-mingw-rpm.py -u http://ftp.wsisiz.edu.pl/pub/linux/fedora/linux/updates/18/i386/ --deps mingw32-webkitgtk mingw32-glib-networking mingw32-gdb mingw32-gstreamer-plugins-good`

See [Fedora 18 packages](http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Everything/i386/os/Packages/m/).

> **Spoilers:** Use `msys.bat` to launch a shell