Merge m-c to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2015-10-02 13:53:51 +02:00
commit 4771e19eec
422 changed files with 14548 additions and 2341 deletions

View File

@ -1252,6 +1252,11 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
break;
}
case nsIAccessibleEvent::EVENT_ALERT:
// A hack using state change showing events as alert events.
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, true);
break;
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
g_signal_emit_by_name(atkObj, "text_selection_changed");
break;

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

@ -450,9 +450,12 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) {
// Count the number of rows before that one to obtain the row index.
uint32_t index = 0;
for (int32_t i = accWrap->IndexInParent() - 1; i >= 0; i--) {
if (accWrap->GetChildAt(i)->IsTableRow()) {
index++;
Accessible* parent = accWrap->Parent();
if (parent) {
for (int32_t i = accWrap->IndexInParent() - 1; i >= 0; i--) {
if (parent->GetChildAt(i)->IsTableRow()) {
index++;
}
}
}
return [NSNumber numberWithUnsignedInteger:index];
@ -500,9 +503,12 @@ ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) {
// Count the number of rows before that one to obtain the row index.
uint32_t index = 0;
for (int32_t i = proxy->IndexInParent() - 1; i >= 0; i--) {
if (proxy->ChildAt(i)->IsTableRow()) {
index++;
ProxyAccessible* parent = proxy->Parent();
if (parent) {
for (int32_t i = proxy->IndexInParent() - 1; i >= 0; i--) {
if (parent->ChildAt(i)->IsTableRow()) {
index++;
}
}
}
return [NSNumber numberWithUnsignedInteger:index];

View File

@ -26,6 +26,7 @@ const { contract } = require("./util/contract");
const { on, off, emit, setListeners } = require("./event/core");
const { EventTarget } = require("./event/target");
const domPanel = require("./panel/utils");
const { getDocShell } = require('./frame/utils');
const { events } = require("./panel/events");
const systemEvents = require("./system/events");
const { filter, pipe, stripListeners } = require("./event/utils");
@ -73,9 +74,26 @@ var panelContract = contract(merge({
contentStyleFile: merge(Object.create(loaderContract.rules.contentScriptFile), {
msg: 'The `contentStyleFile` option must be a local URL or an array of URLs'
}),
contextMenu: boolean
contextMenu: boolean,
allow: {
is: ['object', 'undefined', 'null'],
map: function (allow) { return { script: !allow || allow.script !== false }}
},
}, displayContract.rules, loaderContract.rules));
function Allow(panel) {
return {
get script() { return getDocShell(viewFor(panel).backgroundFrame).allowJavascript; },
set script(value) { return setScriptState(panel, value); },
};
}
function setScriptState(panel, value) {
let view = viewFor(panel);
getDocShell(view.backgroundFrame).allowJavascript = value;
getDocShell(view.viewFrame).allowJavascript = value;
view.setAttribute("sdkscriptenabled", "" + value);
}
function isDisposed(panel) !views.has(panel);
@ -147,7 +165,8 @@ const Panel = Class({
}
// Setup view
let view = domPanel.make();
let viewOptions = {allowJavascript: !model.allow || (model.allow.script !== false)};
let view = domPanel.make(null, viewOptions);
panels.set(view, this);
views.set(this, view);
@ -212,6 +231,12 @@ const Panel = Class({
workerFor(this).detach();
},
get allow() { return Allow(this); },
set allow(value) {
let allowJavascript = panelContract({ allow: value }).allow.script;
return setScriptState(this, value);
},
/* Public API: Panel.isShowing */
get isShowing() !isDisposed(this) && domPanel.isOpen(viewFor(this)),

View File

@ -14,7 +14,7 @@ const { platform } = require("../system");
const { getMostRecentBrowserWindow, getOwnerBrowserWindow,
getHiddenWindow, getScreenPixelsPerCSSPixel } = require("../window/utils");
const { create: createFrame, swapFrameLoaders } = require("../frame/utils");
const { create: createFrame, swapFrameLoaders, getDocShell } = require("../frame/utils");
const { window: addonWindow } = require("../addon/window");
const { isNil } = require("../lang/type");
const { data } = require('../self');
@ -247,10 +247,11 @@ function setupPanelFrame(frame) {
}
}
function make(document) {
function make(document, options) {
document = document || getMostRecentBrowserWindow().document;
let panel = document.createElementNS(XUL_NS, "panel");
panel.setAttribute("type", "arrow");
panel.setAttribute("sdkscriptenabled", "" + options.allowJavascript);
// Note that panel is a parent of `viewFrame` who's `docShell` will be
// configured at creation time. If `panel` and there for `viewFrame` won't
@ -259,7 +260,7 @@ function make(document) {
attach(panel, document);
let frameOptions = {
allowJavascript: true,
allowJavascript: options.allowJavascript,
allowPlugins: true,
allowAuth: true,
allowWindowControl: false,
@ -284,8 +285,16 @@ function make(document) {
// See Bug 886329
if (target !== this) return;
try { swapFrameLoaders(backgroundFrame, viewFrame); }
catch(error) { console.exception(error); }
try {
swapFrameLoaders(backgroundFrame, viewFrame);
// We need to re-set this because... swapFrameLoaders. Or something.
let shouldEnableScript = panel.getAttribute("sdkscriptenabled") == "true";
getDocShell(backgroundFrame).allowJavascript = shouldEnableScript;
getDocShell(viewFrame).allowJavascript = shouldEnableScript;
}
catch(error) {
console.exception(error);
}
events.emit(type, { subject: panel });
}
@ -331,6 +340,7 @@ function make(document) {
panel.backgroundFrame = backgroundFrame;
panel.viewFrame = viewFrame;
// Store event listener on the panel instance so that it won't be GC-ed
// while panel is alive.
@ -356,8 +366,10 @@ function detach(panel) {
exports.detach = detach;
function dispose(panel) {
panel.backgroundFrame.parentNode.removeChild(panel.backgroundFrame);
panel.backgroundFrame.remove();
panel.viewFrame.remove();
panel.backgroundFrame = null;
panel.viewFrame = null;
events.off("document-element-inserted", panel.onContentChange);
panel.onContentChange = null;
detach(panel);

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

@ -1929,12 +1929,7 @@ pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
pref("browser.pocket.useLocaleList", true);
pref("browser.pocket.enabledLocales", "cs de en-GB en-US en-ZA es-ES es-MX fr hu it ja ja-JP-mac ko nl pl pt-BR pt-PT ru zh-CN zh-TW");
// View source tabs are only enabled by default for Dev. Ed and Nightly.
#ifdef RELEASE_BUILD
pref("view_source.tab", false);
#else
pref("view_source.tab", true);
#endif
// Enable ServiceWorkers for Push API consumers.
// Interception is still disabled on beta and release.

View File

@ -393,11 +393,11 @@ var FullScreen = {
textElem.setAttribute("hidden", true);
} else {
textElem.removeAttribute("hidden");
let hostLabel = document.getElementById("fullscreen-domain");
let hostElem = document.getElementById("fullscreen-domain");
// Document's principal's URI has a host. Display a warning including it.
let utils = {};
Cu.import("resource://gre/modules/DownloadUtils.jsm", utils);
hostLabel.value = utils.DownloadUtils.getURIHost(uri.spec)[0];
hostElem.textContent = utils.DownloadUtils.getURIHost(uri.spec)[0];
}
this._element.className = gIdentityHandler.fullscreenWarningClassName;

View File

@ -660,7 +660,7 @@ window[chromehidden~="toolbar"] toolbar:not(#nav-bar):not(#TabsToolbar):not(#pri
background: black;
}
#fullscreen-warning {
html|*#fullscreen-warning {
position: fixed;
z-index: 2147483647 !important;
visibility: visible;
@ -669,33 +669,33 @@ window[chromehidden~="toolbar"] toolbar:not(#nav-bar):not(#TabsToolbar):not(#pri
we use left: 50% with translateX(-50%). */
top: 0; left: 50%;
transform: translate(-50%, -100%);
/* We must specify a max-width, otherwise word-wrap:break-word doesn't
work in descendant <description> and <label> elements. Bug 630864. */
box-sizing: border-box;
width: -moz-max-content;
max-width: 95%;
pointer-events: none;
}
#fullscreen-warning:not([hidden]) {
html|*#fullscreen-warning:not([hidden]) {
display: flex;
}
#fullscreen-warning[onscreen] {
html|*#fullscreen-warning[onscreen] {
transform: translate(-50%, 50px);
}
#fullscreen-warning[ontop] {
html|*#fullscreen-warning[ontop] {
/* Use -10px to hide the border and border-radius on the top */
transform: translate(-50%, -10px);
}
#fullscreen-domain-text,
#fullscreen-generic-text {
html|*#fullscreen-domain-text,
html|*#fullscreen-generic-text {
word-wrap: break-word;
/* We must specify a min-width, otherwise word-wrap:break-word doesn't work. Bug 630864. */
min-width: 1px
}
#fullscreen-domain-text:not([hidden]) + #fullscreen-generic-text {
html|*#fullscreen-domain-text:not([hidden]) + html|*#fullscreen-generic-text {
display: none;
}
#fullscreen-exit-button {
html|*#fullscreen-exit-button {
pointer-events: auto;
}

View File

@ -84,6 +84,10 @@ function pktUIGetter(prop) {
Object.defineProperty(window, "pktUI", pktUIGetter("pktUI"));
Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging"));
XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
return Services.strings.createBundle('chrome://browser/locale/browser.properties');
});
const nsIWebNavigation = Ci.nsIWebNavigation;
var gLastBrowserCharset = null;
@ -4032,6 +4036,41 @@ function updateUserContextUIVisibility()
document.getElementById("menu_newUserContext").hidden = !userContextEnabled;
}
/**
* Updates the User Context UI indicators if the browser is in a non-default context
*/
function updateUserContextUIIndicator(browser)
{
let hbox = document.getElementById("userContext-icons");
if (!browser.hasAttribute("usercontextid")) {
hbox.removeAttribute("usercontextid");
return;
}
let label = document.getElementById("userContext-label");
let userContextId = browser.getAttribute("usercontextid");
hbox.setAttribute("usercontextid", userContextId);
switch (userContextId) {
case "1":
label.value = gBrowserBundle.GetStringFromName("usercontext.personal.label");
break;
case "2":
label.value = gBrowserBundle.GetStringFromName("usercontext.work.label");
break;
case "3":
label.value = gBrowserBundle.GetStringFromName("usercontext.banking.label");
break;
case "4":
label.value = gBrowserBundle.GetStringFromName("usercontext.shopping.label");
break;
// Display the context IDs for values outside the pre-defined range.
// Used for debugging, no localization necessary.
default:
label.value = "Context " + userContextId;
}
}
/**
* Makes the Character Encoding menu enabled or disabled as appropriate.
* To be called when the View menu or the app menu is opened.

View File

@ -768,6 +768,10 @@
hidden="true"
onclick="ReaderParent.buttonClick(event);"/>
</hbox>
<hbox id="userContext-icons">
<label id="userContext-label"/>
<image id="userContext-indicator"/>
</hbox>
<toolbarbutton id="urlbar-go-button"
class="chromeclass-toolbar-additional"
onclick="gURLBar.handleCommand(event);"
@ -1151,23 +1155,24 @@
#include ../../components/customizableui/content/customizeMode.inc.xul
</deck>
<hbox id="fullscreen-warning" hidden="true">
<description id="fullscreen-domain-text">
<html:div id="fullscreen-warning" hidden="true">
<html:div id="fullscreen-domain-text">
&fullscreenWarning.beforeDomain.label;
<label id="fullscreen-domain"/>
<html:span id="fullscreen-domain"/>
&fullscreenWarning.afterDomain.label;
</description>
<description id="fullscreen-generic-text">
</html:div>
<html:div id="fullscreen-generic-text">
&fullscreenWarning.generic.label;
</description>
<button id="fullscreen-exit-button"
</html:div>
<html:button id="fullscreen-exit-button"
onclick="FullScreen.exitDomFullScreen();">
#ifdef XP_MACOSX
label="&exitDOMFullscreenMac.button;"
&exitDOMFullscreenMac.button;
#else
label="&exitDOMFullscreen.button;"
&exitDOMFullscreen.button;
#endif
oncommand="FullScreen.exitDomFullScreen();"/>
</hbox>
</html:button>
</html:div>
<vbox id="browser-bottombox" layer="true">
<notificationbox id="global-notificationbox"/>

View File

@ -53,10 +53,6 @@
});
}
if (!this.chatbar) {
document.getAnonymousElementByAttribute(this, "anonid", "minimize").hidden = true;
document.getAnonymousElementByAttribute(this, "anonid", "close").hidden = true;
}
let contentWindow = this.contentWindow;
// process this._callbacks, then set to null so the chatbox creator
// knows to make new callbacks immediately.
@ -71,6 +67,7 @@
return;
this.removeEventListener("DOMContentLoaded", DOMContentLoaded, true);
this.isActive = !this.minimized;
this._chat.loadButtonSet(this, this.getAttribute("buttonSet"));
this._deferredChatLoaded.resolve(this);
}, true);
@ -92,6 +89,10 @@
document.getAnonymousElementByAttribute(this, "anonid", "content");
</field>
<field name="_chat" readonly="true">
Cu.import("resource:///modules/Chat.jsm", {}).Chat;
</field>
<property name="contentWindow">
<getter>
return this.content.contentWindow;
@ -171,10 +172,9 @@
<method name="setDecorationAttributes">
<parameter name="aTarget"/>
<body><![CDATA[
for (let attr of ["dark", "customSize"]) {
if (this.hasAttribute(attr))
aTarget.setAttribute(attr, this.getAttribute(attr));
}
if (this.hasAttribute("customSize"))
aTarget.setAttribute("customSize", this.getAttribute("customSize"));
this._chat.loadButtonSet(aTarget, this.getAttribute("buttonSet"));
]]></body>
</method>

View File

@ -1233,6 +1233,8 @@
this._adjustFocusAfterTabSwitch(this.mCurrentTab);
}
updateUserContextUIIndicator(gBrowser.selectedBrowser);
this.tabContainer._setPositionalAttributes();
if (!gMultiProcessBrowser) {
@ -1799,6 +1801,8 @@
var uriIsAboutBlank = !aURI || aURI == "about:blank";
if (aUserContextId)
t.setAttribute("usercontextid", aUserContextId);
t.setAttribute("crop", "end");
t.setAttribute("onerror", "this.removeAttribute('image');");
t.className = "tabbrowser-tab";
@ -2519,6 +2523,10 @@
aOurTab.setAttribute("soundplaying", "true");
modifiedAttrs.push("soundplaying");
}
if (aOtherTab.hasAttribute("usercontextid")) {
aOurTab.setAttribute("usercontextid", aOtherTab.getAttribute("usercontextid"));
modifiedAttrs.push("usercontextid");
}
// If the other tab is pending (i.e. has not been restored, yet)
// then do not switch docShells but retrieve the other tab's state

View File

@ -131,3 +131,68 @@ add_chat_task(function* testChatWindowChooser() {
privateWindow.close();
secondWindow.close();
});
add_chat_task(function* testButtonSet() {
let chatbox = yield promiseOpenChat("http://example.com#1");
let document = chatbox.ownerDocument;
// Expect all default buttons to be visible.
for (let buttonId of kDefaultButtonSet) {
let button = document.getAnonymousElementByAttribute(chatbox, "anonid", buttonId);
Assert.ok(!button.hidden, "Button '" + buttonId + "' should be visible");
}
let visible = new Set(["minimize", "close"]);
chatbox = yield promiseOpenChat("http://example.com#2", null, null, [...visible].join(","));
for (let buttonId of kDefaultButtonSet) {
let button = document.getAnonymousElementByAttribute(chatbox, "anonid", buttonId);
if (visible.has(buttonId)) {
Assert.ok(!button.hidden, "Button '" + buttonId + "' should be visible");
} else {
Assert.ok(button.hidden, "Button '" + buttonId + "' should NOT be visible");
}
}
});
add_chat_task(function* testCustomButton() {
let commanded = 0;
let customButton = {
id: "custom",
onCommand: function() {
++commanded;
}
};
Chat.registerButton(customButton);
let chatbox = yield promiseOpenChat("http://example.com#1");
let document = chatbox.ownerDocument;
let titlebarNode = document.getAnonymousElementByAttribute(chatbox, "class",
"chat-titlebar");
Assert.equal(titlebarNode.getElementsByClassName("chat-custom")[0], null,
"Custom chat button should not be in the toolbar yet.");
let visible = new Set(["minimize", "close", "custom"]);
Chat.loadButtonSet(chatbox, [...visible].join(","));
for (let buttonId of kDefaultButtonSet) {
let button = document.getAnonymousElementByAttribute(chatbox, "anonid", buttonId);
if (visible.has(buttonId)) {
Assert.ok(!button.hidden, "Button '" + buttonId + "' should be visible");
} else {
Assert.ok(button.hidden, "Button '" + buttonId + "' should NOT be visible");
}
}
let customButtonNode = titlebarNode.getElementsByClassName("chat-custom")[0];
Assert.ok(!customButtonNode.hidden, "Custom button should be visible");
let ev = document.createEvent("XULCommandEvent");
ev.initCommandEvent("command", true, true, document.defaultView, 0, false,
false, false, false, null);
customButtonNode.dispatchEvent(ev);
Assert.equal(commanded, 1, "Button should have been commanded once");
});

View File

@ -5,8 +5,9 @@
// Utility functions for Chat tests.
var Chat = Cu.import("resource:///modules/Chat.jsm", {}).Chat;
const kDefaultButtonSet = new Set(["minimize", "swap", "close"]);
function promiseOpenChat(url, mode, focus) {
function promiseOpenChat(url, mode, focus, buttonSet = null) {
let uri = Services.io.newURI(url, null, null);
let origin = uri.prePath;
let title = origin;
@ -28,6 +29,9 @@ function promiseOpenChat(url, mode, focus) {
}, true);
}
let chatbox = Chat.open(null, origin, title, url, mode, focus, callback);
if (buttonSet) {
chatbox.setAttribute("buttonSet", buttonSet);
}
return deferred.promise;
}

View File

@ -30,6 +30,12 @@ function init(event) {
fxButton.addEventListener("mousedown", PositionHandler);
updateIndicatorState();
// Alert accessibility implementations stuff just changed. We only need to do
// this initially, because changes after this will automatically fire alert
// events if things change materially.
let ev = new CustomEvent("AlertActive", {bubbles: true, cancelable: true});
document.documentElement.dispatchEvent(ev);
}
function updateIndicatorState() {

Some files were not shown because too many files have changed in this diff Show More