Bug 1204965 - Graphene support. Merge larch into mozilla-central. r=fabrice r=glandium

This commit is contained in:
Kevin Grandon 2015-09-30 23:49:00 +02:00
parent 4373eb18e4
commit 79f0fe7233
95 changed files with 2422 additions and 52 deletions

View File

@ -32,6 +32,7 @@ this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache', // jsh
this.Utils = { // jshint ignore:line
_buildAppMap: {
'{3c2e2abc-06d4-11e1-ac3b-374f68613e61}': 'b2g',
'{d1bfe7d9-c01e-4237-998b-7b5f960a4314}': 'graphene',
'{ec8030f7-c20a-464f-9b0e-13a3a9e97384}': 'browser',
'{aa3c5121-dab2-40e2-81ca-7ea25febc110}': 'mobile/android',
'{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'

View File

@ -325,7 +325,6 @@ pref("media.fragmented-mp4.gonk.enabled", true);
//Encrypted media extensions.
pref("media.eme.enabled", true);
pref("media.eme.apiVisible", true);
// The default number of decoded video frames that are enqueued in
// MediaDecoderReader's mVideoQueue.
pref("media.video-queue.default-size", 3);
@ -431,7 +430,7 @@ pref("dom.ipc.processCount", 100000);
pref("dom.ipc.browser_frames.oop_by_default", false);
#ifndef MOZ_MULET
#if !defined(MOZ_MULET) && !defined(MOZ_GRAPHENE)
pref("dom.meta-viewport.enabled", true);
#endif
@ -1067,11 +1066,18 @@ pref("dom.wakelock.enabled", true);
// Enable webapps add-ons
pref("dom.apps.customization.enabled", true);
#ifdef MOZ_GRAPHENE
// Enable touch caret by default
pref("touchcaret.enabled", true);
// Enable selection caret by default
pref("selectioncaret.enabled", true);
#else
// Original caret implementation on collapsed selection.
pref("touchcaret.enabled", false);
// Original caret implementation on non-collapsed selection.
pref("selectioncaret.enabled", false);
#endif
// New implementation to unify touch-caret and selection-carets.
pref("layout.accessiblecaret.enabled", true);
@ -1150,3 +1156,7 @@ pref("dom.performance.enable_notify_performance_timing", true);
pref("b2g.multiscreen.chrome_remote_url", "chrome://b2g/content/shell_remote.html");
pref("b2g.multiscreen.system_remote_url", "index_remote.html");
// Because we can't have nice things.
#ifdef MOZ_GRAPHENE
#include ../graphene/graphene.js
#endif

View File

@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>b2g</string>
<string>%APP_BINARY%</string>
<key>CFBundleGetInfoString</key>
<string>%APP_NAME% %APP_VERSION%</string>
<key>CFBundleIconFile</key>
@ -32,5 +32,36 @@
<true/>
<key>NSPrincipalClass</key>
<string>GeckoNSApplication</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLIconFile</key>
<string>document.icns</string>
<key>CFBundleURLName</key>
<string>http URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>http</string>
</array>
</dict>
<dict>
<key>CFBundleURLIconFile</key>
<string>document.icns</string>
<key>CFBundleURLName</key>
<string>https URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>https</string>
</array>
</dict>
<dict>
<key>CFBundleURLName</key>
<string>ftp URL</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ftp</string>
</array>
</dict>
</array>
</dict>
</plist>

View File

@ -0,0 +1,30 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(topsrcdir)/config/config.mk
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
BRANDING_FILES := \
app.ico \
$(NULL)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
BRANDING_FILES := \
app.icns \
background.png \
disk.icns \
dsstore \
$(NULL)
endif
ifdef MOZ_WIDGET_GTK
BRANDING_FILES := \
default.png \
$(NULL)
endif
BRANDING_DEST := $(DIST)/branding
BRANDING_TARGET := export
INSTALL_TARGETS += BRANDING

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

View File

@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOZ_APP_DISPLAYNAME=Browser.html

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -0,0 +1,10 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
chrome.jar:
% content branding %content/branding/
content/branding/about.png (about.png)
content/branding/logoWordmark.png (logoWordmark.png)
content/branding/logo.png (logo.png)
content/branding/favicon32.png (favicon32.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY brandShortName "Browser.html">
<!ENTITY brandFullName "Mozilla Browser.html">
<!ENTITY vendorShortName "Mozilla">

View File

@ -0,0 +1,6 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
brandShortName=Browser.html
brandFullName=Mozilla Browser.html

View File

@ -0,0 +1,11 @@
#filter substitution
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
# Branding only exists in en-US
locale/branding/brand.dtd (en-US/brand.dtd)
locale/branding/brand.properties (en-US/brand.properties)

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['content', 'locales']

View File

@ -0,0 +1,30 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(topsrcdir)/config/config.mk
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
BRANDING_FILES := \
app.ico \
$(NULL)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
BRANDING_FILES := \
app.icns \
background.png \
disk.icns \
dsstore \
$(NULL)
endif
ifdef MOZ_WIDGET_GTK
BRANDING_FILES := \
default.png \
$(NULL)
endif
BRANDING_DEST := $(DIST)/branding
BRANDING_TARGET := export
INSTALL_TARGETS += BRANDING

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

View File

@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOZ_APP_DISPLAYNAME=Horizon

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -0,0 +1,10 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
chrome.jar:
% content branding %content/branding/
content/branding/about.png (about.png)
content/branding/logoWordmark.png (logoWordmark.png)
content/branding/logo.png (logo.png)
content/branding/favicon32.png (favicon32.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,8 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY brandShortName "Horizon">
<!ENTITY brandFullName "Mozilla Horizon">
<!ENTITY vendorShortName "Mozilla">
<!ENTITY logoTrademark "Horizon and the Horizon logos are trademarks of the Mozilla Foundation.">

View File

@ -0,0 +1,6 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
brandShortName=Horizon
brandFullName=Mozilla Horizon

View File

@ -0,0 +1,11 @@
#filter substitution
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
@AB_CD@.jar:
% locale branding @AB_CD@ %locale/branding/
# Branding only exists in en-US
locale/branding/brand.dtd (en-US/brand.dtd)
* locale/branding/brand.properties (en-US/brand.properties)

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JAR_MANIFESTS += ['jar.mn']

View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['content', 'locales']

View File

@ -11,12 +11,19 @@ xul|window xul|scrollbar {
}
/* Bug 1041576 - Scrollable with scrollgrab should not have scrollbars */
@-moz-document domain(system.gaiamobile.org) {
.browser-container > xul|scrollbar {
display: none;
}
}
%ifdef MOZ_GRAPHENE
.moz-noscrollbars > xul|scrollbar {
display: none;
}
%endif
xul|scrollbar[root="true"] {
position: relative;
z-index: 2147483647;
@ -85,6 +92,7 @@ xul|scrollbarbutton {
background-image: none !important;
}
%ifndef MOZ_GRAPHENE
/* -moz-touch-enabled? media elements */
:-moz-any(video, audio) > xul|videocontrols {
-moz-binding: url("chrome://global/content/bindings/videocontrols.xml#touchControls");
@ -310,6 +318,7 @@ input[type=number] > div > div, /* work around bug 946184 */
input[type=number]::-moz-number-spin-box {
display: none;
}
%endif
%ifdef MOZ_WIDGET_GONK
/* This binding only provide key shortcuts that we can't use on devices */

View File

@ -637,10 +637,18 @@ var settingsToObserve = {
'layers.draw-borders': false,
'layers.draw-tile-borders': false,
'layers.dump': false,
#ifdef XP_WIN
'layers.enable-tiles': false,
#else
'layers.enable-tiles': true,
#endif
'layers.effect.invert': false,
'layers.effect.grayscale': false,
'layers.effect.contrast': '0.0',
#ifdef MOZ_GRAPHENE
// Restart required
'layers.async-pan-zoom.enabled': false,
#endif
'layout.display-list.dump': false,
'mms.debugging.enabled': false,
'network.debugging.enabled': false,

View File

@ -25,4 +25,51 @@ iframe {
top: 0;
right: 0;
bottom: 0;
z-index: 1;
}
%ifdef MOZ_GRAPHENE
body.content-loaded > #installing {
display: none;
}
#installing {
z-index: 2;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: #F1C40F;
color: #FFF;
}
.throbber {
width: 3px;
height: 3px;
border-radius: 100px;
background-color: #FFF;
animation-name: throbber;
animation-duration: 1500ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes throbber{
from {
transform: scale(0);
opacity: 0.4;
}
to {
transform: scale(400);
opacity: 0;
}
}
%endif

View File

@ -8,6 +8,11 @@
windowtype="navigator:browser"
#ifdef ANDROID
sizemode="fullscreen"
#endif
#ifdef MOZ_GRAPHENE
macanimationtype="document"
fullscreenbutton="true"
chromemargin="0,0,0,0"
#endif
>
@ -26,6 +31,7 @@
src="chrome://b2g/content/shell.js"> </script>
#ifndef ANDROID
#ifndef MOZ_GRAPHENE
<!-- various task that has to happen only on desktop -->
<script type="application/javascript;version=1.8"
src="chrome://b2g/content/desktop.js"> </script>
@ -35,6 +41,7 @@
<!-- this script handles the "runapp" argument for desktop builds -->
<script type="application/javascript;version=1.8"
src="chrome://b2g/content/runapp.js"> </script>
#endif
#else
<!-- this file is only loaded on Gonk to manage ADB state -->
<script type="application/javascript;version=1.8"
@ -56,12 +63,19 @@
</footer>
#endif
#endif
#ifndef MOZ_GRAPHENE
#ifdef MOZ_WIDGET_COCOA
<!--
If the document is empty at startup, we don't display the window
at all on Mac OS...
-->
<h1 id="placeholder">wtf mac os!</h1>
#endif
#else
<div id="installing">
<div class="throbber"></div>
<div class="message"></div>
</div>
#endif
<!-- The html:iframe containing the UI is created here. -->
</body>

View File

@ -87,6 +87,39 @@ function debug(str) {
dump(' -*- Shell.js: ' + str + '\n');
}
const once = event => {
let target = shell.contentBrowser;
return new Promise((resolve, reject) => {
target.addEventListener(event, function gotEvent(evt) {
target.removeEventListener(event, gotEvent, false);
resolve(evt);
}, false);
});
}
function clearCache() {
let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
.getService(Ci.nsICacheStorageService);
cache.clear();
}
function clearCacheAndReload() {
// Reload the main frame with a cleared cache.
debug('Reloading ' + getContentWindow().location);
clearCache();
getContentWindow().location.reload(true);
once('mozbrowserlocationchange').then(
evt => {
shell.sendEvent(window, "ContentStart");
});
}
function restart() {
let appStartup = Cc['@mozilla.org/toolkit/app-startup;1']
.getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eForceQuit | Ci.nsIAppStartup.eRestart);
}
#ifdef MOZ_CRASHREPORTER
function debugCrashReport(aStr) {
dump('Crash reporter : ' + aStr);
@ -244,8 +277,32 @@ var shell = {
let startManifestURL =
Cc['@mozilla.org/commandlinehandler/general-startup;1?type=b2gbootstrap']
.getService(Ci.nsISupports).wrappedJSObject.startManifestURL;
#ifdef MOZ_GRAPHENE
// If --start-manifest hasn't been specified, we re-use the latest specified manifest.
// If it's the first launch, we will fallback to b2g.default.start_manifest_url
if (!startManifestURL) {
try {
startManifestURL = Services.prefs.getCharPref("b2g.system_manifest_url");
} catch(e) {}
}
#endif
if (!startManifestURL) {
try {
startManifestURL = Services.prefs.getCharPref("b2g.default.start_manifest_url");
} catch(e) {}
}
if (startManifestURL) {
Cu.import('resource://gre/modules/Bootstraper.jsm');
#ifdef MOZ_GRAPHENE
if (Bootstraper.isInstallRequired(startManifestURL)) {
// Installing the app my take some time. We don't want to keep the
// native window hidden.
showInstallScreen();
}
#endif
Bootstraper.ensureSystemAppInstall(startManifestURL)
.then(this.start.bind(this))
.catch(Bootstraper.bailout);
@ -337,11 +394,14 @@ var shell = {
#endif
this.contentBrowser = container.appendChild(systemAppFrame);
systemAppFrame.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.sessionHistory = Cc["@mozilla.org/browser/shistory;1"]
.createInstance(Ci.nsISHistory);
let webNav = systemAppFrame.contentWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation);
webNav.sessionHistory = Cc["@mozilla.org/browser/shistory;1"].createInstance(Ci.nsISHistory);
#ifdef MOZ_GRAPHENE
webNav.QueryInterface(Ci.nsIDocShell).windowDraggingAllowed = true;
#endif
this.allowedAudioChannels = new Map();
let audioChannels = systemAppFrame.allowedAudioChannels;
@ -464,11 +524,34 @@ var shell = {
visibleNormalAudioActive: false,
handleEvent: function shell_handleEvent(evt) {
function checkReloadKey() {
if (evt.type !== 'keyup') {
return false;
}
try {
let key = JSON.parse(Services.prefs.getCharPref('b2g.reload_key'));
return (evt.keyCode == key.key &&
evt.ctrlKey == key.ctrl &&
evt.altKey == key.alt &&
evt.shiftKey == key.shift &&
evt.metaKey == key.meta);
} catch(e) {
debug('Failed to get key: ' + e);
}
return false;
}
let content = this.contentBrowser.contentWindow;
switch (evt.type) {
case 'keydown':
case 'keyup':
this.broadcastHardwareKeys(evt);
if (checkReloadKey()) {
clearCacheAndReload();
} else {
this.broadcastHardwareKeys(evt);
}
break;
case 'sizemodechange':
if (window.windowState == window.STATE_MINIMIZED && !this.visibleNormalAudioActive) {
@ -690,24 +773,30 @@ var shell = {
Cu.import('resource://gre/modules/OperatorApps.jsm');
#endif
this.handleCmdLine();
#ifdef MOZ_GRAPHENE
if (Services.prefs.getBoolPref("b2g.nativeWindowGeometry.fullscreen")) {
window.fullScreen = true;
}
#endif
shell.handleCmdLine();
},
handleCmdLine: function shell_handleCmdLine() {
handleCmdLine: function() {
// This isn't supported on devices.
#ifndef ANDROID
let b2gcmds = Cc["@mozilla.org/commandlinehandler/general-startup;1?type=b2gcmds"]
.getService(Ci.nsISupports);
let args = b2gcmds.wrappedJSObject.cmdLine;
try {
// Returns null if -url is not present
// Returns null if -url is not present.
let url = args.handleFlagWithParam("url", false);
if (url) {
this.sendChromeEvent({type: "mozbrowseropenwindow", url});
args.preventDefault = true;
}
} catch(e) {
// Throws if -url is present with no params
// Throws if -url is present with no params.
}
#endif
},
@ -843,6 +932,29 @@ var CustomEventManager = {
evt.preventDefault();
}
break;
case 'shutdown-application':
let appStartup = Cc['@mozilla.org/toolkit/app-startup;1']
.getService(Ci.nsIAppStartup);
appStartup.quit(appStartup.eAttemptQuit);
break;
case 'toggle-fullscreen-native-window':
window.fullScreen = !window.fullScreen;
Services.prefs.setBoolPref("b2g.nativeWindowGeometry.fullscreen",
window.fullScreen);
break;
case 'minimize-native-window':
window.minimize();
break;
case 'clear-cache-and-reload':
clearCacheAndReload();
break;
case 'clear-cache-and-restart':
clearCache();
restart();
break;
case 'restart':
restart();
break;
}
}
}
@ -1361,3 +1473,64 @@ Services.obs.addObserver(function resetProfile(subject, topic, data) {
.getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eForceQuit);
}, 'b2g-reset-profile', false);
#ifdef MOZ_GRAPHENE
const restoreWindowGeometry = () => {
let screenX = Services.prefs.getIntPref("b2g.nativeWindowGeometry.screenX");
let screenY = Services.prefs.getIntPref("b2g.nativeWindowGeometry.screenY");
let width = Services.prefs.getIntPref("b2g.nativeWindowGeometry.width");
let height = Services.prefs.getIntPref("b2g.nativeWindowGeometry.height");
if (screenX == -1) {
// Center
screenX = (screen.width - width) / 2;
screenY = (screen.height - height) / 2;
}
moveTo(screenX, screenY);
resizeTo(width, height);
}
restoreWindowGeometry();
const saveWindowGeometry = () => {
window.removeEventListener("unload", saveWindowGeometry);
Services.prefs.setIntPref("b2g.nativeWindowGeometry.screenX", screenX);
Services.prefs.setIntPref("b2g.nativeWindowGeometry.screenY", screenY);
Services.prefs.setIntPref("b2g.nativeWindowGeometry.width", outerWidth);
Services.prefs.setIntPref("b2g.nativeWindowGeometry.height", outerHeight);
}
window.addEventListener("unload", saveWindowGeometry);
let baseWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIBaseWindow);
const showNativeWindow = () => baseWindow.visibility = true;
const hideNativeWindow = () => baseWindow.visibility = false;
const showInstallScreen = () => {
const grapheneStrings =
Services.strings.createBundle('chrome://b2g-l10n/locale/graphene.properties');
document.querySelector('#installing > .message').textContent =
grapheneStrings.GetStringFromName('installing');
showNativeWindow();
}
const hideInstallScreen = () => {
document.body.classList.add('content-loaded');
}
window.addEventListener('ContentStart', () => {
shell.contentBrowser.contentWindow.addEventListener('load', () => {
hideInstallScreen();
showNativeWindow();
});
});
hideNativeWindow();
#endif

View File

@ -12,9 +12,9 @@ chrome.jar:
* content/settings.js (content/settings.js)
* content/shell.html (content/shell.html)
* content/shell.js (content/shell.js)
content/shell.css (content/shell.css)
content/shell_remote.html (content/shell_remote.html)
content/shell_remote.js (content/shell_remote.js)
* content/shell.css (content/shell.css)
content/blank.html (content/blank.html)
content/blank.css (content/blank.css)
#ifdef MOZ_WIDGET_GONK
@ -38,7 +38,9 @@ chrome.jar:
content/identity.js (content/identity.js)
#ifndef MOZ_GRAPHENE
% override chrome://global/skin/media/videocontrols.css chrome://b2g/content/touchcontrols.css
#endif
% override chrome://global/content/aboutCertError.xhtml chrome://b2g/content/aboutCertError.xhtml
% override chrome://global/skin/netError.css chrome://b2g/content/netError.css

View File

@ -118,6 +118,18 @@ this.Bootstraper = {
return DOMApplicationRegistry.uninstall(oldManifestURL);
},
/**
* Check if we are already configured to run from this manifest url.
*/
isInstallRequired: function(aManifestURL) {
try {
if (Services.prefs.getCharPref("b2g.system_manifest_url") == aManifestURL) {
return false;
}
} catch(e) { }
return true;
},
/**
* Resolves once we have installed the app.
*/
@ -125,14 +137,10 @@ this.Bootstraper = {
this._manifestURL = aManifestURL;
debug("Installing app from " + this._manifestURL);
// Check if we are already configured to run from this manifest url, and
// skip reinstall if that's the case.
try {
if (Services.prefs.getCharPref("b2g.system_manifest_url") == this._manifestURL) {
debug("Already configured for " + this._manifestURL);
return Promise.resolve();
}
} catch(e) { }
if (!this.isInstallRequired(this._manifestURL)) {
debug("Already configured for " + this._manifestURL);
return Promise.resolve();
}
return new Promise((aResolve, aReject) => {
DOMApplicationRegistry.registryReady

20
b2g/graphene/app.mozbuild Normal file
View File

@ -0,0 +1,20 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['LIBXUL_SDK']:
include('/toolkit/toolkit.mozbuild')
elif CONFIG['ENABLE_TESTS']:
DIRS += ['/testing/mochitest']
if CONFIG['MOZ_EXTENSIONS']:
DIRS += ['/extensions']
DIRS += [
'/%s' % CONFIG['MOZ_BRANDING_DIRECTORY'],
'/b2g',
]
# Add the defaults settings.
FINAL_TARGET_FILES.defaults += [ 'b2g/graphene/settings.json' ]

5
b2g/graphene/build.mk Normal file
View File

@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
include $(topsrcdir)/b2g/build.mk

View File

@ -0,0 +1,24 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Disable the l10n-check target, which isn't relevant to b2g builds at all.
# This needs to be set prior to the next include for it to take effect.
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_SDK=0
. "$topsrcdir/build/mozconfig.common"
# Normally, we'd set this unconditionally, but this file is also used
# for local builds and there is no other mozconfig in this tree that
# is included on device builds.
if test -d $topsrcdir/../gcc/bin; then
HOST_CC="$topsrcdir/../gcc/bin/gcc"
HOST_CXX="$topsrcdir/../gcc/bin/g++"
ac_add_options --enable-stdcxx-compat
fi
MOZ_HORIZON=1
ac_add_options --with-branding=b2g/branding/horizon
ac_add_options --enable-application=b2g/graphene

View File

@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -0,0 +1,28 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux32"
ac_add_options --enable-debug
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,29 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux32"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,28 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux"
ac_add_options --enable-debug
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,29 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,26 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
# Use sccache
no_sccache=
. $topsrcdir/build/macosx/mozconfig.common
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
#ac_add_options --with-macbundlename-prefix=Firefox
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# graphene Stuff
ac_add_options --enable-debug-symbols
ac_add_options --enable-debug
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,27 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
# Use sccache
no_sccache=
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
#ac_add_options --with-macbundlename-prefix=Firefox
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# graphene Stuff
ac_add_options --enable-debug-symbols
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,23 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
ac_add_options --enable-jemalloc
ac_add_options --enable-debug
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2013-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
# graphene Options
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,23 @@
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2013-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
# graphene Options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,33 @@
. "$topsrcdir/build/mozconfig.win-common"
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
ac_add_options --enable-debug
ac_add_options --enable-dmd
ac_add_options --enable-profiling # needed for --enable-dmd to work on Windows
ac_add_options --enable-signmar
if [ -f /c/builds/google-oauth-api.key ]; then
_google_oauth_api_keyfile=/c/builds/google-oauth-api.key
else
_google_oauth_api_keyfile=/e/builds/google-oauth-api.key
fi
ac_add_options --with-google-oauth-api-keyfile=${_google_oauth_api_keyfile}
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
. $topsrcdir/build/win64/mozconfig.vs2013
. "$topsrcdir/build/mozconfig.cache"
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,27 @@
if [ "x$IS_NIGHTLY" = "xyes" ]; then
MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
MOZ_AUTOMATION_UPDATE_PACKAGING=1
fi
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common"
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
. $topsrcdir/build/win64/mozconfig.vs2013
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# graphene Options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/horizon-mozconfigs/common.override"

View File

@ -0,0 +1,24 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Disable the l10n-check target, which isn't relevant to b2g builds at all.
# This needs to be set prior to the next include for it to take effect.
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_SDK=0
. "$topsrcdir/build/mozconfig.common"
# Normally, we'd set this unconditionally, but this file is also used
# for local builds and there is no other mozconfig in this tree that
# is included on device builds.
if test -d $topsrcdir/../gcc/bin; then
HOST_CC="$topsrcdir/../gcc/bin/gcc"
HOST_CXX="$topsrcdir/../gcc/bin/g++"
ac_add_options --enable-stdcxx-compat
fi
ac_add_options --with-branding=b2g/branding/browserhtml
ac_add_options --enable-application=b2g/graphene

View File

@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
. "$topsrcdir/build/mozconfig.common.override"

View File

@ -0,0 +1,28 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux32"
ac_add_options --enable-debug
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,29 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux32"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,28 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux"
ac_add_options --enable-debug
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,29 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
. "$topsrcdir/build/unix/mozconfig.linux"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
#ac_add_options --enable-js-diagnostics
# This will overwrite the default of stripping everything and keep the symbol table.
# This is useful for profiling and debugging and only increases the package size
# by 2 MBs.
STRIP_FLAGS="--strip-debug"
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Use sccache
no_sccache=
. "$topsrcdir/build/mozconfig.cache"
# graphene options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,26 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
# Use sccache
no_sccache=
. $topsrcdir/build/macosx/mozconfig.common
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
#ac_add_options --with-macbundlename-prefix=Firefox
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# graphene Stuff
ac_add_options --enable-debug-symbols
ac_add_options --enable-debug
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,27 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
# Use sccache
no_sccache=
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
#ac_add_options --with-macbundlename-prefix=Firefox
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# graphene Stuff
ac_add_options --enable-debug-symbols
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,23 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
ac_add_options --enable-jemalloc
ac_add_options --enable-debug
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2013-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
# graphene Options
ENABLE_MARIONETTE=1
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/grapheneconfig/mozconfigs/common.override"

View File

@ -0,0 +1,23 @@
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
. $topsrcdir/build/win32/mozconfig.vs2013-win64
else
. $topsrcdir/build/win32/mozconfig.vs2010
fi
# graphene Options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,33 @@
. "$topsrcdir/build/mozconfig.win-common"
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
ac_add_options --enable-debug
ac_add_options --enable-dmd
ac_add_options --enable-profiling # needed for --enable-dmd to work on Windows
ac_add_options --enable-signmar
if [ -f /c/builds/google-oauth-api.key ]; then
_google_oauth_api_keyfile=/c/builds/google-oauth-api.key
else
_google_oauth_api_keyfile=/e/builds/google-oauth-api.key
fi
ac_add_options --with-google-oauth-api-keyfile=${_google_oauth_api_keyfile}
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors
# Package js shell.
export MOZ_PACKAGE_JSSHELL=1
. $topsrcdir/build/win64/mozconfig.vs2013
. "$topsrcdir/build/mozconfig.cache"
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

View File

@ -0,0 +1,27 @@
if [ "x$IS_NIGHTLY" = "xyes" ]; then
MOZ_AUTOMATION_UPLOAD_SYMBOLS=1
MOZ_AUTOMATION_UPDATE_PACKAGING=1
fi
. "$topsrcdir/b2g/graphene/config/mozconfigs/common"
ac_add_options --target=x86_64-pc-mingw32
ac_add_options --host=x86_64-pc-mingw32
. $topsrcdir/build/win64/mozconfig.vs2013
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --enable-update-packaging
ac_add_options --enable-jemalloc
ac_add_options --enable-signmar
# Nightlies only since this has a cost in performance
ac_add_options --enable-js-diagnostics
# Needed to enable breakpad in application.ini
export MOZILLA_OFFICIAL=1
# graphene Options
export CXXFLAGS=-DMOZ_ENABLE_JS_DUMP
. "$topsrcdir/b2g/graphene/config/mozconfigs/common.override"

65
b2g/graphene/confvars.sh Normal file
View File

@ -0,0 +1,65 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if test "$MOZ_HORIZON"; then
MOZ_APP_BASENAME=Horizon
else
MOZ_APP_BASENAME=Graphene
fi
MOZ_APP_VENDOR=Mozilla
MOZ_UPDATER=1
MOZ_B2G=1
MOZ_GRAPHENE=1
MOZ_APP_VERSION=$FIREFOX_VERSION
MOZ_APP_UA_NAME=Firefox
MOZ_B2G_VERSION=3.0.0.0-prerelease
MOZ_B2G_OS_NAME=Boot2Gecko
MOZ_BRANDING_DIRECTORY=b2g/branding/unofficial
MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
# MOZ_APP_DISPLAYNAME is set by branding/configure.sh
MOZ_SAFE_BROWSING=1
MOZ_SERVICES_COMMON=1
MOZ_SERVICES_METRICS=1
MOZ_CAPTIVEDETECT=1
MOZ_WEBSMS_BACKEND=1
MOZ_NO_SMART_CARDS=1
MOZ_APP_STATIC_INI=1
NSS_NO_LIBPKIX=1
NSS_DISABLE_DBM=1
MOZ_DISABLE_EXPORT_JS=1
if test "$OS_TARGET" = "Android"; then
MOZ_CAPTURE=1
MOZ_RAW=1
MOZ_AUDIO_CHANNEL_MANAGER=1
fi
MOZ_MEDIA_NAVIGATOR=1
MOZ_APP_ID={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
MOZ_TIME_MANAGER=1
MOZ_PAY=1
MOZ_TOOLKIT_SEARCH=
MOZ_PLACES=
MOZ_B2G=1
if test "$OS_TARGET" = "Android"; then
MOZ_NUWA_PROCESS=1
MOZ_B2G_LOADER=1
MOZ_ENABLE_WARNINGS_AS_ERRORS=1
fi
MOZ_JSDOWNLOADS=1
MOZ_BUNDLED_FONTS=1
export JS_GC_SMALL_CHUNK_SIZE=1

57
b2g/graphene/graphene.js Normal file
View File

@ -0,0 +1,57 @@
// See http://mxr.mozilla.org/mozilla-central/source/dom/webidl/KeyEvent.webidl
// for keyCode values.
// Default value is F5
pref("b2g.reload_key", '{ "key": 116, "shift": false, "ctrl": false, "alt": false, "meta": false }');
#ifdef MOZ_HORIZON
pref("b2g.default.start_manifest_url", "https://mozvr.github.io/horizon/web/manifest.webapp");
pref("dom.vr.enabled", true);
pref("dom.ipc.tabs.disabled", true);
#else
pref("b2g.default.start_manifest_url", "https://mozilla.github.io/browser.html/manifest.webapp");
pref("dom.ipc.tabs.disabled", false);
#endif
pref("javascript.options.discardSystemSource", false);
pref("browser.dom.window.dump.enabled", true);
pref("browser.ignoreNativeFrameTextSelection", false);
pref("dom.meta-viewport.enabled", false);
pref("full-screen-api.ignore-widgets", false);
pref("image.high_quality_downscaling.enabled", true);
pref("dom.w3c_touch_events.enabled", 0);
pref("font.size.inflation.minTwips", 0);
pref("browser.enable_click_image_resizing", true);
pref("layout.css.scroll-snap.enabled", true);
pref("dom.mozInputMethod.enabled", false);
pref("browser.autofocus", true);
pref("layers.async-pan-zoom.enabled", false);
pref("network.predictor.enabled", true);
// Not touch caret
pref("layout.accessiblecaret.enabled", false);
pref("selectioncaret.enabled", false);
pref("touchcaret.enabled", false);
pref("gfx.vsync.hw-vsync.enabled", true);
pref("gfx.vsync.compositor", true);
// To be removed once bug 942756 is fixed.
pref("devtools.debugger.unix-domain-socket", "6000");
pref("devtools.debugger.forbid-certified-apps", false);
pref("devtools.debugger.prompt-connection", false);
// Update url.
pref("app.update.url", "https://aus4.mozilla.org/update/3/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml");
pref("b2g.nativeWindowGeometry.width", 700);
pref("b2g.nativeWindowGeometry.height", 600);
pref("b2g.nativeWindowGeometry.screenX", -1); // center
pref("b2g.nativeWindowGeometry.screenY", -1); // center
pref("b2g.nativeWindowGeometry.fullscreen", false);
pref("media.useAudioChannelService", false);
#ifdef ENABLE_MARIONETTE
pref("b2g.is_mulet", true);
#endif

View File

@ -0,0 +1,3 @@
{
"apz.overscroll.enabled": false
}

View File

@ -12,19 +12,6 @@
; ; file comment
;
; Due to Apple Mac OS X packaging requirements, files that are in the same
; directory on other platforms must be located in different directories on
; Mac OS X. The following defines allow specifying the Mac OS X bundle
; location which also work on other platforms.
;
; @BINPATH@
; Equals Contents/MacOS/ on Mac OS X and is the path to the main binary on other
; platforms.
;
; @RESPATH@
; Equals Contents/Resources/ on Mac OS X and is equivalent to @BINPATH@ on other
; platforms.
#filter substitution
#ifdef XP_MACOSX
@ -142,6 +129,7 @@
@BINPATH@/@DLL_PREFIX@lgpllibs@DLL_SUFFIX@
@RESPATH@/blocklist.xml
@RESPATH@/ua-update.json
@RESPATH@/defaults/settings.json
#ifdef XP_UNIX
#ifndef XP_MACOSX
@RESPATH@/run-mozilla.sh

View File

@ -0,0 +1,5 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
installing=Installing…

View File

@ -11,6 +11,9 @@
% override chrome://global/locale/appstrings.properties chrome://b2g-l10n/locale/appstrings.properties
* locale/@AB_CD@/b2g-l10n/aboutCertError.dtd (%chrome/overrides/aboutCertError.dtd)
* locale/@AB_CD@/b2g-l10n/appstrings.properties (%chrome/overrides/appstrings.properties)
#ifdef MOZ_GRAPHENE
locale/@AB_CD@/b2g-l10n/graphene.properties (%chrome/graphene.properties)
#endif
# overrides for toolkit l10n, also for en-US

View File

@ -34,13 +34,14 @@ category command-line-validator b-browser @mozilla.org/browser/clh;1 application
# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
# graphene: {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
#
# In theory we should do this for all these instructions, but in practice it is
# sufficient to do it for the app-startup one, and the file is simpler that way.
component {eab9012e-5f74-4cbc-b2b5-a590235513cc} nsBrowserGlue.js
contract @mozilla.org/browser/browserglue;1 {eab9012e-5f74-4cbc-b2b5-a590235513cc}
category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
component {d8903bf6-68d5-4e97-bcd1-e4d3012f721a} nsBrowserGlue.js
#ifndef MOZ_MULET
contract @mozilla.org/content-permission/prompt;1 {d8903bf6-68d5-4e97-bcd1-e4d3012f721a}

View File

@ -7,6 +7,7 @@
# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
# graphene: {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
#
# In theory we should do this for all these instructions, but in practice it is
# sufficient to do it for the app-startup one, and the file is simpler that way.
@ -25,4 +26,4 @@ component {49bb6593-3aff-4eb3-a068-2712c28bd58e} FeedWriter.js
contract @mozilla.org/browser/feeds/result-writer;1 {49bb6593-3aff-4eb3-a068-2712c28bd58e}
component {792a7e82-06a0-437c-af63-b2d12e808acc} WebContentConverter.js
contract @mozilla.org/embeddor.implemented/web-content-handler-registrar;1 {792a7e82-06a0-437c-af63-b2d12e808acc}
category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
category app-startup WebContentConverter service,@mozilla.org/embeddor.implemented/web-content-handler-registrar;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}

View File

@ -7,6 +7,7 @@
# browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
# graphene: {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
#
# In theory we should do this for all these instructions, but in practice it is
# sufficient to do it for the app-startup one, and the file is simpler that way.
@ -15,4 +16,4 @@ component {5280606b-2510-4fe0-97ef-9b5a22eafe6b} nsSessionStore.js
contract @mozilla.org/browser/sessionstore;1 {5280606b-2510-4fe0-97ef-9b5a22eafe6b}
component {ec7a6c20-e081-11da-8ad9-0800200c9a66} nsSessionStartup.js
contract @mozilla.org/browser/sessionstartup;1 {ec7a6c20-e081-11da-8ad9-0800200c9a66}
category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
category app-startup nsSessionStartup service,@mozilla.org/browser/sessionstartup;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}

View File

@ -4038,15 +4038,21 @@ browser)
xulrunner)
AC_DEFINE(MOZ_XULRUNNER)
;;
b2g)
AC_DEFINE(MOZ_B2G)
;;
b2g/dev)
AC_DEFINE(MOZ_B2G)
AC_DEFINE(MOZ_MULET)
;;
esac
if test -n "$MOZ_B2G"; then
AC_DEFINE(MOZ_B2G)
fi
# Graphene is a desktop runtime for running applications with a HTML UI.
if test -n "$MOZ_GRAPHENE"; then
AC_DEFINE(MOZ_GRAPHENE)
fi
if test -n "$MOZ_MULET"; then
AC_DEFINE(MOZ_MULET)
fi
if test -n "$MOZ_B2GDROID"; then
AC_DEFINE(MOZ_B2GDROID)
fi
@ -7526,6 +7532,16 @@ if test -n "$MOZ_REFLOW_PERF"; then
AC_DEFINE(MOZ_REFLOW_PERF)
fi
dnl ========================================================
dnl = Horizon build options - set default preferences for
dnl the horizon project. Horizon is a browser built on
dnl top of the graphene runtime.
dnl ========================================================
if test -n "$MOZ_HORIZON"; then
AC_DEFINE(MOZ_HORIZON)
fi
AC_SUBST(MOZ_HORIZON)
dnl ========================================================
dnl = Offer a way to disable the startup cache
dnl ========================================================

View File

@ -30,17 +30,19 @@ Object.defineProperty(this, "addonManager", {
});
const B2G_ID = "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}";
const GRAPHENE_ID = "{d1bfe7d9-c01e-4237-998b-7b5f960a4314}";
/**
* This is a wrapper around amIAddonManager.mapURIToAddonID which always returns
* false on B2G to avoid loading the add-on manager there and reports any
* exceptions rather than throwing so that the caller doesn't have to worry
* about them.
* false on B2G and graphene to avoid loading the add-on manager there and
* reports any exceptions rather than throwing so that the caller doesn't have
* to worry about them.
*/
module.exports = function mapURIToAddonID(uri, id) {
if (!Services.appinfo
|| Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT
|| Services.appinfo.ID == B2G_ID
|| Services.appinfo.ID == GRAPHENE_ID
|| !uri
|| !addonManager) {
return false;

View File

@ -874,7 +874,8 @@ WebappsActor.prototype = {
let deferred = promise.defer();
if (Services.appinfo.ID &&
Services.appinfo.ID != "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}") {
Services.appinfo.ID != "{3c2e2abc-06d4-11e1-ac3b-374f68613e61}" &&
Services.appinfo.ID != "{d1bfe7d9-c01e-4237-998b-7b5f960a4314}") {
return { error: "notSupported",
message: "Not B2G. Can't launch app." };
}

View File

@ -3,6 +3,7 @@
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
# suite (comm): {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
# graphene: {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
# The Data Reporting Service drives collection and submission of metrics
# and other useful data to Mozilla. It drives the display of the data
@ -11,5 +12,5 @@
component {41f6ae36-a79f-4613-9ac3-915e70f83789} DataReportingService.js
contract @mozilla.org/datareporting/service;1 {41f6ae36-a79f-4613-9ac3-915e70f83789}
category app-startup DataReportingService service,@mozilla.org/datareporting/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66}
category app-startup DataReportingService service,@mozilla.org/datareporting/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}

View File

@ -8,6 +8,7 @@
# mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110}
# mobile/xul: {a23983c0-fd0e-11dc-95ff-0800200c9a66}
# suite (comm): {92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
# graphene: {d1bfe7d9-c01e-4237-998b-7b5f960a4314}
#
# In theory we should do this for all these instructions, but in practice it is
# sufficient to do it for the app-startup one, and the file is simpler that way.
@ -15,7 +16,7 @@
# Weave.js
component {74b89fb0-f200-4ae8-a3ec-dd164117f6de} Weave.js
contract @mozilla.org/weave/service;1 {74b89fb0-f200-4ae8-a3ec-dd164117f6de}
category app-startup WeaveService service,@mozilla.org/weave/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={99bceaaa-e3c6-48c1-b981-ef9b46b67d60}
category app-startup WeaveService service,@mozilla.org/weave/service;1 application={3c2e2abc-06d4-11e1-ac3b-374f68613e61} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} application={a23983c0-fd0e-11dc-95ff-0800200c9a66} application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a} application={99bceaaa-e3c6-48c1-b981-ef9b46b67d60} application={d1bfe7d9-c01e-4237-998b-7b5f960a4314}
component {d28f8a0b-95da-48f4-b712-caf37097be41} Weave.js
contract @mozilla.org/network/protocol/about;1?what=sync-log {d28f8a0b-95da-48f4-b712-caf37097be41}

File diff suppressed because it is too large Load Diff