mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge fx-team to m-c a=merge
This commit is contained in:
commit
a64e041656
@ -1582,8 +1582,12 @@ pref("image.mem.max_decoded_image_kb", 256000);
|
||||
// Enable by default development builds up until early beta
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
pref("loop.enabled", true);
|
||||
pref("loop.throttled", false);
|
||||
#else
|
||||
pref("loop.enabled", false);
|
||||
pref("loop.enabled", true);
|
||||
pref("loop.throttled", true);
|
||||
pref("loop.soft_start_ticket_number", -1);
|
||||
pref("loop.soft_start_hostname", "soft-start.loop-dev.stage.mozaws.net");
|
||||
#endif
|
||||
|
||||
pref("loop.server", "https://loop.services.mozilla.com");
|
||||
|
@ -49,6 +49,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "PanelFrame", "resource:///modules/Panel
|
||||
// Add observer notifications before the service is initialized
|
||||
Services.obs.addObserver(this, "loop-status-changed", false);
|
||||
|
||||
// If we're throttled, check to see if it's our turn to be unthrottled
|
||||
if (Services.prefs.getBoolPref("loop.throttled")) {
|
||||
this.toolbarButton.node.hidden = true;
|
||||
MozLoopService.checkSoftStart(this.toolbarButton.node);
|
||||
return;
|
||||
}
|
||||
|
||||
MozLoopService.initialize();
|
||||
this.updateToolbarState();
|
||||
|
@ -137,7 +137,9 @@
|
||||
<method name="swapDocShells">
|
||||
<parameter name="aTarget"/>
|
||||
<body><![CDATA[
|
||||
aTarget.setAttribute('label', this.contentDocument.title);
|
||||
aTarget.setAttribute("label", this.contentDocument.title);
|
||||
if (this.getAttribute("dark") == "true")
|
||||
aTarget.setAttribute("dark", "true");
|
||||
aTarget.src = this.src;
|
||||
aTarget.content.setAttribute("origin", this.content.getAttribute("origin"));
|
||||
aTarget.content.popupnotificationanchor.className = this.content.popupnotificationanchor.className;
|
||||
|
@ -10,6 +10,11 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
// https://github.com/mozilla-services/loop-server/blob/45787d34108e2f0d87d74d4ddf4ff0dbab23501c/loop/errno.json#L6
|
||||
const INVALID_AUTH_TOKEN = 110;
|
||||
|
||||
// Ticket numbers are 24 bits in length.
|
||||
// The highest valid ticket number is 16777214 (2^24 - 2), so that a "now
|
||||
// serving" number of 2^24 - 1 is greater than it.
|
||||
const MAX_SOFT_START_TICKET_NUMBER = 16777214;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
@ -49,6 +54,11 @@ XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
|
||||
"@mozilla.org/uuid-generator;1",
|
||||
"nsIUUIDGenerator");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gDNSService",
|
||||
"@mozilla.org/network/dns-service;1",
|
||||
"nsIDNSService");
|
||||
|
||||
|
||||
// The current deferred for the registration process. This is set if in progress
|
||||
// or the registration was successful. This is null if a registration attempt was
|
||||
// unsuccessful.
|
||||
@ -454,6 +464,8 @@ let MozLoopServiceInternal = {
|
||||
return;
|
||||
}
|
||||
|
||||
chatbox.setAttribute("dark", true);
|
||||
|
||||
chatbox.addEventListener("DOMContentLoaded", function loaded(event) {
|
||||
if (event.target != chatbox.contentDocument) {
|
||||
return;
|
||||
@ -632,6 +644,8 @@ this.MozLoopService = {
|
||||
},
|
||||
#endif
|
||||
|
||||
_DNSService: gDNSService,
|
||||
|
||||
set initializeTimerFunc(value) {
|
||||
gInitializeTimerFunc = value;
|
||||
},
|
||||
@ -642,7 +656,8 @@ this.MozLoopService = {
|
||||
*/
|
||||
initialize: function() {
|
||||
// Don't do anything if loop is not enabled.
|
||||
if (!Services.prefs.getBoolPref("loop.enabled")) {
|
||||
if (!Services.prefs.getBoolPref("loop.enabled") ||
|
||||
Services.prefs.getBoolPref("loop.throttled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -652,6 +667,105 @@ this.MozLoopService = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* If we're operating the service in "soft start" mode, and this browser
|
||||
* isn't already activated, check whether it's time for it to become active.
|
||||
* If so, activate the loop service.
|
||||
*
|
||||
* @param {Object} buttonNode DOM node representing the Loop button -- if we
|
||||
* change from inactive to active, we need this
|
||||
* in order to unhide the Loop button.
|
||||
* @param {Function} doneCb [optional] Callback that is called when the
|
||||
* check has completed.
|
||||
*/
|
||||
checkSoftStart(buttonNode, doneCb) {
|
||||
if (!Services.prefs.getBoolPref("loop.throttled")) {
|
||||
if (typeof(doneCb) == "function") {
|
||||
doneCb(new Error("Throttling is not active"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (Services.io.offline) {
|
||||
if (typeof(doneCb) == "function") {
|
||||
doneCb(new Error("Cannot check soft-start value: browser is offline"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let ticket = Services.prefs.getIntPref("loop.soft_start_ticket_number");
|
||||
if (!ticket || ticket > MAX_SOFT_START_TICKET_NUMBER || ticket < 0) {
|
||||
// Ticket value isn't valid (probably isn't set up yet) -- pick a random
|
||||
// number from 1 to MAX_SOFT_START_TICKET_NUMBER, inclusive, and write it
|
||||
// into prefs.
|
||||
ticket = Math.floor(Math.random() * MAX_SOFT_START_TICKET_NUMBER) + 1;
|
||||
// Floating point numbers can be imprecise, so we need to deal with
|
||||
// the case that Math.random() effectively rounds to 1.0
|
||||
if (ticket > MAX_SOFT_START_TICKET_NUMBER) {
|
||||
ticket = MAX_SOFT_START_TICKET_NUMBER;
|
||||
}
|
||||
Services.prefs.setIntPref("loop.soft_start_ticket_number", ticket);
|
||||
}
|
||||
|
||||
let onLookupComplete = (request, record, status) => {
|
||||
// We don't bother checking errors -- if the DNS query fails,
|
||||
// we just don't activate this time around. We'll check again on
|
||||
// next startup.
|
||||
if (!Components.isSuccessCode(status)) {
|
||||
if (typeof(doneCb) == "function") {
|
||||
doneCb(new Error("Error in DNS Lookup: " + status));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let address = record.getNextAddrAsString().split(".");
|
||||
if (address.length != 4) {
|
||||
if (typeof(doneCb) == "function") {
|
||||
doneCb(new Error("Invalid IP address"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (address[0] != 127) {
|
||||
if (typeof(doneCb) == "function") {
|
||||
doneCb(new Error("Throttling IP address is not on localhost subnet"));
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Can't use bitwise operations here because JS treats all bitwise
|
||||
// operations as 32-bit *signed* integers.
|
||||
let now_serving = ((parseInt(address[1]) * 0x10000) +
|
||||
(parseInt(address[2]) * 0x100) +
|
||||
parseInt(address[3]));
|
||||
|
||||
if (now_serving > ticket) {
|
||||
// Hot diggity! It's our turn! Activate the service.
|
||||
console.log("MozLoopService: Activating Loop via soft-start");
|
||||
Services.prefs.setBoolPref("loop.throttled", false);
|
||||
buttonNode.hidden = false;
|
||||
this.initialize();
|
||||
}
|
||||
if (typeof(doneCb) == "function") {
|
||||
doneCb(null);
|
||||
}
|
||||
};
|
||||
|
||||
// We use DNS to propagate the slow-start value, since it has well-known
|
||||
// scaling properties. Ideally, this would use something more semantic,
|
||||
// like a TXT record; but we don't support TXT in our DNS resolution (see
|
||||
// Bug 14328), so we instead treat the lowest 24 bits of the IP address
|
||||
// corresponding to our "slow start DNS name" as a 24-bit integer. To
|
||||
// ensure that these addresses aren't routable, the highest 8 bits must
|
||||
// be "127" (reserved for localhost).
|
||||
let host = Services.prefs.getCharPref("loop.soft_start_hostname");
|
||||
let task = this._DNSService.asyncResolve(host,
|
||||
this._DNSService.RESOLVE_DISABLE_IPV6,
|
||||
onLookupComplete,
|
||||
Services.tm.mainThread);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Starts registration of Loop with the push server, and then will register
|
||||
* with the Loop server. It will return early if already registered.
|
||||
@ -667,6 +781,10 @@ this.MozLoopService = {
|
||||
throw new Error("Loop is not enabled");
|
||||
}
|
||||
|
||||
if (Services.prefs.getBoolPref("loop.throttled")) {
|
||||
throw new Error("Loop is disabled by the soft-start mechanism");
|
||||
}
|
||||
|
||||
return MozLoopServiceInternal.promiseRegisteredWithServers(mockPushHandler);
|
||||
},
|
||||
|
||||
|
@ -12,6 +12,7 @@ skip-if = !debug
|
||||
[browser_mozLoop_appVersionInfo.js]
|
||||
[browser_mozLoop_prefs.js]
|
||||
[browser_mozLoop_doNotDisturb.js]
|
||||
[browser_mozLoop_softStart.js]
|
||||
skip-if = buildapp == 'mulet'
|
||||
[browser_toolbarbutton.js]
|
||||
[browser_mozLoop_pluralStrings.js]
|
||||
|
@ -0,0 +1,130 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const SOFT_START_HOSTNAME = "soft-start.example.invalid";
|
||||
|
||||
let MockDNSService = {
|
||||
RESOLVE_DISABLE_IPV6: 32,
|
||||
nowServing: 0,
|
||||
resultCode: 0,
|
||||
ipFirstOctet: 127,
|
||||
|
||||
getNowServingAddress: function() {
|
||||
let ip = this.ipFirstOctet + "." +
|
||||
((this.nowServing >>> 16) & 0xFF) + "." +
|
||||
((this.nowServing >>> 8) & 0xFF) + "." +
|
||||
((this.nowServing) & 0xFF);
|
||||
info("Using 'now serving' of " + this.nowServing + " (" + ip + ")");
|
||||
return ip;
|
||||
},
|
||||
|
||||
asyncResolve: function(host, flags, callback) {
|
||||
let mds = this;
|
||||
Assert.equal(flags, this.RESOLVE_DISABLE_IPV6,
|
||||
"AAAA lookup should be disabled");
|
||||
Assert.equal(host, SOFT_START_HOSTNAME,
|
||||
"Configured hostname should be used");
|
||||
callback(null,
|
||||
{getNextAddrAsString: mds.getNowServingAddress.bind(mds)},
|
||||
this.resultCode);
|
||||
}
|
||||
};
|
||||
|
||||
// We need an unfrozen copy of the LoopService so we can monkeypatch it.
|
||||
let LoopService = {};
|
||||
for (var prop in MozLoopService) {
|
||||
if (MozLoopService.hasOwnProperty(prop)) {
|
||||
LoopService[prop] = MozLoopService[prop];
|
||||
}
|
||||
}
|
||||
LoopService._DNSService = MockDNSService;
|
||||
|
||||
let MockButton = {
|
||||
hidden: true
|
||||
};
|
||||
|
||||
let runCheck = function(expectError) {
|
||||
return new Promise((resolve, reject) => {
|
||||
LoopService.checkSoftStart(MockButton, error => {
|
||||
if ((!!error) != (!!expectError)) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(error);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
add_task(function* test_mozLoop_softStart() {
|
||||
// Set associated variables to proper values
|
||||
Services.prefs.setBoolPref("loop.throttled", true);
|
||||
Services.prefs.setCharPref("loop.soft_start_hostname", SOFT_START_HOSTNAME);
|
||||
Services.prefs.setIntPref("loop.soft_start_ticket_number", -1);
|
||||
|
||||
let throttled;
|
||||
let ticket;
|
||||
|
||||
info("Ensure that we pick a valid ticket number.");
|
||||
yield runCheck();
|
||||
throttled = Services.prefs.getBoolPref("loop.throttled");
|
||||
ticket = Services.prefs.getIntPref("loop.soft_start_ticket_number");
|
||||
Assert.equal(MockButton.hidden, true, "Button should still be hidden");
|
||||
Assert.equal(throttled, true, "Feature should still be throttled");
|
||||
Assert.notEqual(ticket, -1, "Ticket should be changed");
|
||||
Assert.ok((ticket < 16777214 && ticket > 0), "Ticket should be in range");
|
||||
|
||||
// Try some "interesting" ticket numbers
|
||||
for (ticket of [1, 256, 65535, 10000000, 16777214]) {
|
||||
MockButton.hidden = true;
|
||||
Services.prefs.setBoolPref("loop.throttled", true);
|
||||
Services.prefs.setBoolPref("loop.soft_start", true);
|
||||
Services.prefs.setIntPref("loop.soft_start_ticket_number", ticket);
|
||||
|
||||
info("Ensure that we don't activate when the now serving " +
|
||||
"number is less than our value.");
|
||||
MockDNSService.nowServing = ticket - 1;
|
||||
yield runCheck();
|
||||
throttled = Services.prefs.getBoolPref("loop.throttled");
|
||||
Assert.equal(MockButton.hidden, true, "Button should still be hidden");
|
||||
Assert.equal(throttled, true, "Feature should still be throttled");
|
||||
|
||||
info("Ensure that we don't activate when the now serving " +
|
||||
"number is equal to our value");
|
||||
MockDNSService.nowServing = ticket;
|
||||
yield runCheck();
|
||||
throttled = Services.prefs.getBoolPref("loop.throttled");
|
||||
Assert.equal(MockButton.hidden, true, "Button should still be hidden");
|
||||
Assert.equal(throttled, true, "Feature should still be throttled");
|
||||
|
||||
info("Ensure that we *do* activate when the now serving " +
|
||||
"number is greater than our value");
|
||||
MockDNSService.nowServing = ticket + 1;
|
||||
yield runCheck();
|
||||
throttled = Services.prefs.getBoolPref("loop.throttled");
|
||||
Assert.equal(MockButton.hidden, false, "Button should not be hidden");
|
||||
Assert.equal(throttled, false, "Feature should be unthrottled");
|
||||
}
|
||||
|
||||
info("Check DNS error behavior");
|
||||
MockDNSService.nowServing = 0;
|
||||
MockDNSService.resultCode = 0x80000000;
|
||||
Services.prefs.setBoolPref("loop.throttled", true);
|
||||
Services.prefs.setBoolPref("loop.soft_start", true);
|
||||
MockButton.hidden = true;
|
||||
yield runCheck(true);
|
||||
throttled = Services.prefs.getBoolPref("loop.throttled");
|
||||
Assert.equal(MockButton.hidden, true, "Button should be hidden");
|
||||
Assert.equal(throttled, true, "Feature should be throttled");
|
||||
|
||||
info("Check DNS misconfiguration behavior");
|
||||
MockDNSService.nowServing = ticket + 1;
|
||||
MockDNSService.resultCode = 0;
|
||||
MockDNSService.ipFirstOctet = 6;
|
||||
Services.prefs.setBoolPref("loop.throttled", true);
|
||||
Services.prefs.setBoolPref("loop.soft_start", true);
|
||||
MockButton.hidden = true;
|
||||
yield runCheck(true);
|
||||
throttled = Services.prefs.getBoolPref("loop.throttled");
|
||||
Assert.equal(MockButton.hidden, true, "Button should be hidden");
|
||||
Assert.equal(throttled, true, "Feature should be throttled");
|
||||
});
|
@ -156,7 +156,7 @@ browser.jar:
|
||||
skin/classic/browser/social/services-64.png (social/services-64.png)
|
||||
skin/classic/browser/social/share-button.png (social/share-button.png)
|
||||
skin/classic/browser/social/share-button-active.png (social/share-button-active.png)
|
||||
skin/classic/browser/social/chat-icons.png (social/chat-icons.png)
|
||||
skin/classic/browser/social/chat-icons.svg (../shared/social/chat-icons.svg)
|
||||
skin/classic/browser/social/gear_default.png (../shared/social/gear_default.png)
|
||||
skin/classic/browser/social/gear_clicked.png (../shared/social/gear_clicked.png)
|
||||
skin/classic/browser/tabbrowser/alltabs.png (tabbrowser/alltabs.png)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB |
@ -260,8 +260,7 @@ browser.jar:
|
||||
skin/classic/browser/social/services-16@2x.png (social/services-16@2x.png)
|
||||
skin/classic/browser/social/services-64.png (social/services-64.png)
|
||||
skin/classic/browser/social/services-64@2x.png (social/services-64@2x.png)
|
||||
skin/classic/browser/social/chat-icons.png (social/chat-icons.png)
|
||||
skin/classic/browser/social/chat-icons@2x.png (social/chat-icons@2x.png)
|
||||
skin/classic/browser/social/chat-icons.svg (../shared/social/chat-icons.svg)
|
||||
skin/classic/browser/social/gear_default.png (../shared/social/gear_default.png)
|
||||
skin/classic/browser/social/gear_clicked.png (../shared/social/gear_clicked.png)
|
||||
skin/classic/browser/tabbrowser/alltabs-box-bkgnd-icon.png (tabbrowser/alltabs-box-bkgnd-icon.png)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.4 KiB |
45
browser/themes/shared/social/chat-icons.svg
Normal file
45
browser/themes/shared/social/chat-icons.svg
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- 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/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
x="0px" y="0px"
|
||||
viewBox="-3 -3 16 16"
|
||||
enable-background="new 0 0 16 16"
|
||||
xml:space="preserve">
|
||||
<style>
|
||||
use:not(:target) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
use {
|
||||
fill: #c1c1c1;
|
||||
}
|
||||
|
||||
use[id$="-active"] {
|
||||
fill: #c1c1c1;
|
||||
}
|
||||
|
||||
use[id$="-disabled"] {
|
||||
fill: #c1c1c1;
|
||||
}
|
||||
</style>
|
||||
<defs>
|
||||
<polygon id="close-shape" fill-rule="evenodd" clip-rule="evenodd" points="10,1.717 8.336,0.049 5.024,3.369 1.663,0 0,1.668
|
||||
3.36,5.037 0.098,8.307 1.762,9.975 5.025,6.705 8.311,10 9.975,8.332 6.688,5.037"/>
|
||||
<path id="dropdown-shape" fill-rule="evenodd" clip-rule="evenodd" d="M9,3L4.984,7L1,3H9z"/>
|
||||
<polygon id="expand-shape" fill-rule="evenodd" clip-rule="evenodd" points="10,0 4.838,0 6.506,1.669 0,8.175 1.825,10 8.331,3.494
|
||||
10,5.162"/>
|
||||
<rect id="minimize-shape" y="3.6" fill-rule="evenodd" clip-rule="evenodd" width="10" height="2.8"/>
|
||||
</defs>
|
||||
<use id="close" xlink:href="#close-shape"/>
|
||||
<use id="close-active" xlink:href="#close-shape"/>
|
||||
<use id="close-disabled" xlink:href="#close-shape"/>
|
||||
<use id="expand" xlink:href="#expand-shape"/>
|
||||
<use id="expand-active" xlink:href="#expand-shape"/>
|
||||
<use id="expand-disabled" xlink:href="#expand-shape"/>
|
||||
<use id="minimize" xlink:href="#minimize-shape"/>
|
||||
<use id="minimize-active" xlink:href="#minimize-shape"/>
|
||||
<use id="minimize-disabled" xlink:href="#minimize-shape"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
@ -47,10 +47,17 @@
|
||||
.chat-toolbarbutton {
|
||||
-moz-appearance: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
padding: 0 3px;
|
||||
margin: 0;
|
||||
background: none;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
.chat-toolbarbutton:hover {
|
||||
background-color: rgba(255,255,255,.35);
|
||||
}
|
||||
|
||||
.chat-toolbarbutton:hover:active {
|
||||
background-color: rgba(255,255,255,.5);
|
||||
}
|
||||
|
||||
.chat-toolbarbutton > .toolbarbutton-text {
|
||||
@ -58,113 +65,37 @@
|
||||
}
|
||||
|
||||
.chat-toolbarbutton > .toolbarbutton-icon {
|
||||
width: inherit;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.chat-close-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons.png');
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
list-style-image: url("chrome://browser/skin/social/chat-icons.svg#close");
|
||||
}
|
||||
|
||||
.chat-close-button:hover {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
.chat-close-button:hover:active {
|
||||
-moz-image-region: rect(0, 48px, 16px, 32px);
|
||||
.chat-close-button:-moz-any(:hover,:hover:active) {
|
||||
list-style-image: url("chrome://browser/skin/social/chat-icons.svg#close-active");
|
||||
}
|
||||
|
||||
.chat-minimize-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons.png');
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0);
|
||||
list-style-image: url("chrome://browser/skin/social/chat-icons.svg#minimize");
|
||||
}
|
||||
|
||||
.chat-minimize-button:hover {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
|
||||
.chat-minimize-button:hover:active {
|
||||
-moz-image-region: rect(16px, 48px, 32px, 32px);
|
||||
.chat-minimize-button:-moz-any(:hover,:hover:active) {
|
||||
list-style-image: url("chrome://browser/skin/social/chat-icons.svg#minimize-active");
|
||||
}
|
||||
|
||||
.chat-swap-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons.png');
|
||||
-moz-image-region: rect(48px, 16px, 64px, 0);
|
||||
list-style-image: url("chrome://browser/skin/social/chat-icons.svg#expand");
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.chat-swap-button:hover {
|
||||
-moz-image-region: rect(48px, 32px, 64px, 16px);
|
||||
}
|
||||
|
||||
.chat-swap-button:hover:active {
|
||||
-moz-image-region: rect(48px, 48px, 64px, 32px);
|
||||
.chat-swap-button:-moz-any(:hover,:hover:active) {
|
||||
list-style-image: url("chrome://browser/skin/social/chat-icons.svg#expand-active");
|
||||
}
|
||||
|
||||
chatbar > chatbox > .chat-titlebar > .chat-swap-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons.png');
|
||||
-moz-image-region: rect(32px, 16px, 48px, 0);
|
||||
}
|
||||
|
||||
chatbar > chatbox > .chat-titlebar > .chat-swap-button:hover {
|
||||
-moz-image-region: rect(32px, 32px, 48px, 16px);
|
||||
}
|
||||
|
||||
chatbar > chatbox > .chat-titlebar > .chat-swap-button:hover:active {
|
||||
-moz-image-region: rect(32px, 48px, 48px, 32px);
|
||||
}
|
||||
|
||||
@media (min-resolution: 2dppx) {
|
||||
.chat-close-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons@2x.png');
|
||||
-moz-image-region: rect(0, 32px, 32px, 0);
|
||||
}
|
||||
|
||||
.chat-close-button:hover {
|
||||
-moz-image-region: rect(0, 64px, 32px, 32px);
|
||||
}
|
||||
|
||||
.chat-close-button:hover:active {
|
||||
-moz-image-region: rect(0, 96px, 32px, 64px);
|
||||
}
|
||||
|
||||
.chat-minimize-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons@2x.png');
|
||||
-moz-image-region: rect(32px, 32px, 64px, 0);
|
||||
}
|
||||
|
||||
.chat-minimize-button:hover {
|
||||
-moz-image-region: rect(32px, 64px, 64px, 32px);
|
||||
}
|
||||
|
||||
.chat-minimize-button:hover:active {
|
||||
-moz-image-region: rect(32px, 96px, 64px, 64px);
|
||||
}
|
||||
|
||||
.chat-swap-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons@2x.png');
|
||||
-moz-image-region: rect(96px, 32px, 128px, 0);
|
||||
}
|
||||
|
||||
.chat-swap-button:hover {
|
||||
-moz-image-region: rect(96px, 64px, 128px, 32px);
|
||||
}
|
||||
|
||||
.chat-swap-button:hover:active {
|
||||
-moz-image-region: rect(96px, 96px, 128px, 64px);
|
||||
}
|
||||
|
||||
chatbar > chatbox > .chat-titlebar > .chat-swap-button {
|
||||
list-style-image: url('chrome://browser/skin/social/chat-icons@2x.png');
|
||||
-moz-image-region: rect(64px, 32px, 96px, 0);
|
||||
}
|
||||
|
||||
chatbar > chatbox > .chat-titlebar > .chat-swap-button:hover {
|
||||
-moz-image-region: rect(64px, 64px, 96px, 32px);
|
||||
}
|
||||
|
||||
chatbar > chatbox > .chat-titlebar > .chat-swap-button:hover:active {
|
||||
-moz-image-region: rect(64px, 96px, 96px, 64px);
|
||||
}
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.chat-title {
|
||||
@ -175,12 +106,11 @@ chatbar > chatbox > .chat-titlebar > .chat-swap-button:hover:active {
|
||||
}
|
||||
|
||||
.chat-titlebar {
|
||||
height: 20px;
|
||||
min-height: 20px;
|
||||
height: 30px;
|
||||
min-height: 30px;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
-moz-padding-start: 6px;
|
||||
padding: 7px 6px;
|
||||
border: none;
|
||||
border-bottom: 1px solid #ccc;
|
||||
cursor: pointer;
|
||||
@ -202,6 +132,18 @@ chatbar > chatbox > .chat-titlebar > .chat-swap-button:hover:active {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
|
||||
chatbox[dark=true] > .chat-titlebar,
|
||||
chatbox[dark=true] > .chat-titlebar[selected] {
|
||||
border-bottom: none;
|
||||
background-color: #000;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
chatbox[dark=true] > .chat-titlebar > hbox > .chat-title {
|
||||
font-weight: normal;
|
||||
color: #c1c1c1;
|
||||
}
|
||||
|
||||
.chat-frame {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
@ -182,7 +182,7 @@ browser.jar:
|
||||
skin/classic/browser/preferences/aboutPermissions.css (preferences/aboutPermissions.css)
|
||||
skin/classic/browser/social/services-16.png (social/services-16.png)
|
||||
skin/classic/browser/social/services-64.png (social/services-64.png)
|
||||
skin/classic/browser/social/chat-icons.png (social/chat-icons.png)
|
||||
skin/classic/browser/social/chat-icons.svg (../shared/social/chat-icons.svg)
|
||||
skin/classic/browser/social/gear_default.png (../shared/social/gear_default.png)
|
||||
skin/classic/browser/social/gear_clicked.png (../shared/social/gear_clicked.png)
|
||||
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
|
||||
@ -601,7 +601,7 @@ browser.jar:
|
||||
skin/classic/aero/browser/preferences/aboutPermissions.css (preferences/aboutPermissions.css)
|
||||
skin/classic/aero/browser/social/services-16.png (social/services-16.png)
|
||||
skin/classic/aero/browser/social/services-64.png (social/services-64.png)
|
||||
skin/classic/aero/browser/social/chat-icons.png (social/chat-icons.png)
|
||||
skin/classic/aero/browser/social/chat-icons.svg (../shared/social/chat-icons.svg)
|
||||
skin/classic/aero/browser/social/gear_default.png (../shared/social/gear_default.png)
|
||||
skin/classic/aero/browser/social/gear_clicked.png (../shared/social/gear_clicked.png)
|
||||
skin/classic/aero/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB |
@ -2704,6 +2704,15 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
break;
|
||||
}
|
||||
|
||||
// For remote content, capture the event in the parent process at the
|
||||
// <xul:browser remote> element. This will ensure that subsequent mousemove/mouseup
|
||||
// events will continue to be dispatched to this element and therefore forwarded
|
||||
// to the child.
|
||||
if (dispatchedToContentProcess && !nsIPresShell::GetCapturingContent()) {
|
||||
nsIContent* content = mCurrentTarget ? mCurrentTarget->GetContent() : nullptr;
|
||||
nsIPresShell::SetCapturingContent(content, 0);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> activeContent;
|
||||
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
|
||||
nsCOMPtr<nsIContent> newFocus;
|
||||
|
@ -48,7 +48,7 @@ public class MediaCastingBar extends RelativeLayout implements View.OnClickListe
|
||||
mMediaStop = (ImageButton) content.findViewById(R.id.media_stop);
|
||||
mMediaStop.setOnClickListener(this);
|
||||
|
||||
mCastingTo = (TextView) content.findViewById(R.id.media_casting_to);
|
||||
mCastingTo = (TextView) content.findViewById(R.id.media_sending_to);
|
||||
|
||||
// Capture clicks on the rest of the view to prevent them from
|
||||
// leaking into other views positioned below.
|
||||
|
@ -301,9 +301,9 @@ size. -->
|
||||
<!ENTITY find_next "Next">
|
||||
<!ENTITY find_close "Close">
|
||||
|
||||
<!-- Localization note (media_casting_to, media_play, media_pause, media_stop) : These strings are used
|
||||
<!-- Localization note (media_sending_to, media_play, media_pause, media_stop) : These strings are used
|
||||
as alternate text for accessibility. They are not visible in the UI. -->
|
||||
<!ENTITY media_casting_to "Casting to Device">
|
||||
<!ENTITY media_sending_to "Sending to Device">
|
||||
<!ENTITY media_play "Play">
|
||||
<!ENTITY media_pause "Pause">
|
||||
<!ENTITY media_stop "Stop">
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView android:id="@+id/media_casting_to"
|
||||
<TextView android:id="@+id/media_sending_to"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dip"
|
||||
@ -30,7 +30,7 @@
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:contentDescription="@string/media_casting_to"/>
|
||||
android:contentDescription="@string/media_sending_to"/>
|
||||
|
||||
<ImageButton android:id="@+id/media_stop"
|
||||
style="@style/FindBar.ImageButton"
|
||||
|
@ -105,7 +105,7 @@
|
||||
<string name="find_next">&find_next;</string>
|
||||
<string name="find_close">&find_close;</string>
|
||||
|
||||
<string name="media_casting_to">&media_casting_to;</string>
|
||||
<string name="media_sending_to">&media_sending_to;</string>
|
||||
<string name="media_play">&media_play;</string>
|
||||
<string name="media_pause">&media_pause;</string>
|
||||
<string name="media_stop">&media_stop;</string>
|
||||
|
@ -1167,7 +1167,7 @@ JavaBridge.prototype = {
|
||||
"resource://gre/modules/Services.jsm", {}).Services,
|
||||
|
||||
_sendMessageToJava: Components.utils.import(
|
||||
"resource://gre/modules/Messaging.jsm", {}).sendMessageToJava,
|
||||
"resource://gre/modules/Messaging.jsm", {}).Messaging.sendRequest,
|
||||
|
||||
_sendMessage: function (innerType, args) {
|
||||
this._sendMessageToJava({
|
||||
|
@ -21,21 +21,21 @@ function addMessage() {
|
||||
messageId = Home.banner.add({
|
||||
text: TEXT,
|
||||
onclick: function() {
|
||||
sendMessageToJava({ type: "TestHomeBanner:MessageClicked" });
|
||||
Messaging.sendRequest({ type: "TestHomeBanner:MessageClicked" });
|
||||
},
|
||||
onshown: function() {
|
||||
sendMessageToJava({ type: "TestHomeBanner:MessageShown" });
|
||||
Messaging.sendRequest({ type: "TestHomeBanner:MessageShown" });
|
||||
},
|
||||
ondismiss: function() {
|
||||
sendMessageToJava({ type: "TestHomeBanner:MessageDismissed" });
|
||||
Messaging.sendRequest({ type: "TestHomeBanner:MessageDismissed" });
|
||||
}
|
||||
});
|
||||
sendMessageToJava({ type: "TestHomeBanner:MessageAdded" });
|
||||
Messaging.sendRequest({ type: "TestHomeBanner:MessageAdded" });
|
||||
}
|
||||
|
||||
function removeMessage() {
|
||||
Home.banner.remove(messageId);
|
||||
sendMessageToJava({ type: "TestHomeBanner:MessageRemoved" });
|
||||
Messaging.sendRequest({ type: "TestHomeBanner:MessageRemoved" });
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -213,7 +213,7 @@ function testCloseSelection() {
|
||||
*
|
||||
*/
|
||||
function finishTests() {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Robocop:testSelectionHandler",
|
||||
result: true,
|
||||
msg: "Done!",
|
||||
|
@ -28,7 +28,7 @@ function send_test_message(type) {
|
||||
outerObject.object = innerObject;
|
||||
outerObject.objectArray = [null, innerObject];
|
||||
|
||||
sendMessageToJava(outerObject);
|
||||
Messaging.sendRequest(outerObject);
|
||||
}
|
||||
|
||||
function send_message_for_response(type, response) {
|
||||
|
@ -8,13 +8,13 @@ do_register_cleanup(() => {
|
||||
do_test_pending();
|
||||
|
||||
function add_request_listener(message) {
|
||||
RequestService.addListener(function (data) {
|
||||
Messaging.addListener(function (data) {
|
||||
return { result: data + "bar" };
|
||||
}, message);
|
||||
}
|
||||
|
||||
function add_exception_listener(message) {
|
||||
RequestService.addListener(function (data) {
|
||||
Messaging.addListener(function (data) {
|
||||
throw "error!";
|
||||
}, message);
|
||||
}
|
||||
@ -23,7 +23,7 @@ function add_second_request_listener(message) {
|
||||
let exceptionCaught = false;
|
||||
|
||||
try {
|
||||
RequestService.addListener(() => {}, message);
|
||||
Messaging.addListener(() => {}, message);
|
||||
} catch (e) {
|
||||
exceptionCaught = true;
|
||||
}
|
||||
@ -32,7 +32,7 @@ function add_second_request_listener(message) {
|
||||
}
|
||||
|
||||
function remove_request_listener(message) {
|
||||
RequestService.removeListener(message);
|
||||
Messaging.removeListener(message);
|
||||
}
|
||||
|
||||
function finish_test() {
|
||||
|
@ -15,7 +15,7 @@ public interface NativeEventListener {
|
||||
* @param event The name of the event being sent.
|
||||
* @param message The message data.
|
||||
* @param callback The callback interface for this message. A callback is provided only if the
|
||||
* originating sendMessageToJava call included a callback argument; otherwise,
|
||||
* originating Messaging.sendRequest call included a callback argument; otherwise,
|
||||
* callback will be null. All listeners for a given event are given the same
|
||||
* callback object, and exactly one listener must handle the callback.
|
||||
*/
|
||||
|
@ -62,7 +62,7 @@ var CastingApps = {
|
||||
SimpleServiceDiscovery.search(120 * 1000);
|
||||
|
||||
this._castMenuId = NativeWindow.contextmenus.add(
|
||||
Strings.browser.GetStringFromName("contextmenu.castToScreen"),
|
||||
Strings.browser.GetStringFromName("contextmenu.sendToDevice"),
|
||||
this.filterCast,
|
||||
this.handleContextMenu.bind(this)
|
||||
);
|
||||
@ -429,14 +429,14 @@ var CastingApps = {
|
||||
// Both states have the same action: Show the cast page action
|
||||
if (aVideo.mozIsCasting) {
|
||||
this.pageAction.id = PageActions.add({
|
||||
title: Strings.browser.GetStringFromName("contextmenu.castToScreen"),
|
||||
title: Strings.browser.GetStringFromName("contextmenu.sendToDevice"),
|
||||
icon: "drawable://casting_active",
|
||||
clickCallback: this.pageAction.click,
|
||||
important: true
|
||||
});
|
||||
} else if (aVideo.mozAllowCasting) {
|
||||
this.pageAction.id = PageActions.add({
|
||||
title: Strings.browser.GetStringFromName("contextmenu.castToScreen"),
|
||||
title: Strings.browser.GetStringFromName("contextmenu.sendToDevice"),
|
||||
icon: "drawable://casting",
|
||||
clickCallback: this.pageAction.click,
|
||||
important: true
|
||||
@ -463,7 +463,7 @@ var CastingApps = {
|
||||
}
|
||||
|
||||
let prompt = new Prompt({
|
||||
title: Strings.browser.GetStringFromName("casting.prompt")
|
||||
title: Strings.browser.GetStringFromName("casting.sendToDevice")
|
||||
}).setSingleChoiceItems(items).show(function(data) {
|
||||
let selected = data.button;
|
||||
let service = selected == -1 ? null : filteredServices[selected];
|
||||
@ -563,7 +563,7 @@ var CastingApps = {
|
||||
}
|
||||
|
||||
aRemoteMedia.load(this.session.data);
|
||||
sendMessageToJava({ type: "Casting:Started", device: this.session.service.friendlyName });
|
||||
Messaging.sendRequest({ type: "Casting:Started", device: this.session.service.friendlyName });
|
||||
|
||||
let video = this.session.videoRef.get();
|
||||
if (video) {
|
||||
@ -573,7 +573,7 @@ var CastingApps = {
|
||||
},
|
||||
|
||||
onRemoteMediaStop: function(aRemoteMedia) {
|
||||
sendMessageToJava({ type: "Casting:Stopped" });
|
||||
Messaging.sendRequest({ type: "Casting:Stopped" });
|
||||
this._shutdown();
|
||||
},
|
||||
|
||||
|
@ -88,7 +88,7 @@ var PermissionsHelper = {
|
||||
} catch(e) {
|
||||
host = uri.spec;
|
||||
}
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Permissions:Data",
|
||||
host: host,
|
||||
permissions: permissions
|
||||
|
@ -198,7 +198,7 @@ var SelectionHandler = {
|
||||
}
|
||||
|
||||
case "TextSelection:Get":
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "TextSelection:Data",
|
||||
requestId: aData,
|
||||
text: this._getSelectedText()
|
||||
@ -212,7 +212,7 @@ var SelectionHandler = {
|
||||
_startDraggingHandles: function sh_startDraggingHandles() {
|
||||
if (!this._draggingHandles) {
|
||||
this._draggingHandles = true;
|
||||
sendMessageToJava({ type: "TextSelection:DraggingHandle", dragging: true });
|
||||
Messaging.sendRequest({ type: "TextSelection:DraggingHandle", dragging: true });
|
||||
}
|
||||
},
|
||||
|
||||
@ -221,7 +221,7 @@ var SelectionHandler = {
|
||||
_stopDraggingHandles: function sh_stopDraggingHandles() {
|
||||
if (this._draggingHandles) {
|
||||
this._draggingHandles = false;
|
||||
sendMessageToJava({ type: "TextSelection:DraggingHandle", dragging: false });
|
||||
Messaging.sendRequest({ type: "TextSelection:DraggingHandle", dragging: false });
|
||||
}
|
||||
},
|
||||
|
||||
@ -341,7 +341,7 @@ var SelectionHandler = {
|
||||
|
||||
// Determine position and show handles, open actionbar
|
||||
this._positionHandles(positions);
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "TextSelection:ShowHandles",
|
||||
handles: [this.HANDLE_TYPE_START, this.HANDLE_TYPE_END]
|
||||
});
|
||||
@ -546,7 +546,7 @@ var SelectionHandler = {
|
||||
|
||||
actions.sort((a, b) => b.order - a.order);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "TextSelection:Update",
|
||||
actions: actions
|
||||
});
|
||||
@ -717,7 +717,7 @@ var SelectionHandler = {
|
||||
|
||||
// Determine position and show caret, open actionbar
|
||||
this._positionHandles();
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "TextSelection:ShowHandles",
|
||||
handles: [this.HANDLE_TYPE_MIDDLE]
|
||||
});
|
||||
@ -931,7 +931,7 @@ var SelectionHandler = {
|
||||
shareSelection: function sh_shareSelection() {
|
||||
let selectedText = this._getSelectedText();
|
||||
if (selectedText.length) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Share:Text",
|
||||
text: selectedText
|
||||
});
|
||||
@ -1000,7 +1000,7 @@ var SelectionHandler = {
|
||||
_deactivate: function sh_deactivate() {
|
||||
this._stopDraggingHandles();
|
||||
// Hide handle/caret, close actionbar
|
||||
sendMessageToJava({ type: "TextSelection:HideHandles" });
|
||||
Messaging.sendRequest({ type: "TextSelection:HideHandles" });
|
||||
|
||||
this._removeObservers();
|
||||
|
||||
@ -1156,7 +1156,7 @@ var SelectionHandler = {
|
||||
if (!positions) {
|
||||
positions = this._getHandlePositions(this._getScrollPos());
|
||||
}
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "TextSelection:PositionHandles",
|
||||
positions: positions,
|
||||
rtl: this._isRTL
|
||||
|
@ -37,13 +37,13 @@ var ZoomHelper = {
|
||||
rect.h = viewport.cssHeight;
|
||||
rect.animate = false;
|
||||
|
||||
sendMessageToJava(rect);
|
||||
Messaging.sendRequest(rect);
|
||||
BrowserApp.selectedTab._mReflozPoint = null;
|
||||
},
|
||||
|
||||
zoomOut: function() {
|
||||
BrowserEventHandler.resetMaxLineBoxWidth();
|
||||
sendMessageToJava({ type: "Browser:ZoomToPageWidth" });
|
||||
Messaging.sendRequest({ type: "Browser:ZoomToPageWidth" });
|
||||
},
|
||||
|
||||
isRectZoomedIn: function(aRect, aViewport) {
|
||||
@ -145,6 +145,6 @@ var ZoomHelper = {
|
||||
BrowserEventHandler.resetMaxLineBoxWidth();
|
||||
}
|
||||
|
||||
sendMessageToJava(rect);
|
||||
Messaging.sendRequest(rect);
|
||||
},
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ function init() {
|
||||
document.getElementById("last-url").value = aData;
|
||||
}, "Feedback:LastUrl", false);
|
||||
|
||||
sendMessageToJava({ type: "Feedback:LastUrl" });
|
||||
Messaging.sendRequest({ type: "Feedback:LastUrl" });
|
||||
}
|
||||
|
||||
function uninit() {
|
||||
@ -66,7 +66,7 @@ function updateActiveSection(aSection) {
|
||||
}
|
||||
|
||||
function openPlayStore() {
|
||||
sendMessageToJava({ type: "Feedback:OpenPlayStore" });
|
||||
Messaging.sendRequest({ type: "Feedback:OpenPlayStore" });
|
||||
|
||||
window.close();
|
||||
}
|
||||
@ -74,7 +74,7 @@ function openPlayStore() {
|
||||
function maybeLater() {
|
||||
window.close();
|
||||
|
||||
sendMessageToJava({ type: "Feedback:MaybeLater" });
|
||||
Messaging.sendRequest({ type: "Feedback:MaybeLater" });
|
||||
}
|
||||
|
||||
function sendFeedback(aEvent) {
|
||||
|
@ -88,7 +88,7 @@ let healthReportWrapper = {
|
||||
|
||||
refreshPayload: function () {
|
||||
console.log("AboutHealthReport: page requested fresh payload.");
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: EVENT_HEALTH_REQUEST,
|
||||
});
|
||||
},
|
||||
@ -120,7 +120,7 @@ let healthReportWrapper = {
|
||||
|
||||
showSettings: function () {
|
||||
console.log("AboutHealthReport: showing settings.");
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Settings:Show",
|
||||
resource: "preferences_vendor",
|
||||
});
|
||||
@ -128,7 +128,7 @@ let healthReportWrapper = {
|
||||
|
||||
launchUpdater: function () {
|
||||
console.log("AboutHealthReport: launching updater.");
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Updater:Launch",
|
||||
});
|
||||
},
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
let Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Messaging.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm")
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
@ -308,7 +309,7 @@ AboutReader.prototype = {
|
||||
},
|
||||
|
||||
_requestReadingListStatus: function Reader_requestReadingListStatus() {
|
||||
gChromeWin.sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:ListStatusRequest",
|
||||
url: this._article.url
|
||||
});
|
||||
@ -335,7 +336,7 @@ AboutReader.prototype = {
|
||||
let json = JSON.stringify({ fromAboutReader: true, url: this._article.url });
|
||||
Services.obs.notifyObservers(null, "Reader:Add", json);
|
||||
|
||||
gChromeWin.sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:Added",
|
||||
result: result,
|
||||
title: this._article.title,
|
||||
@ -359,7 +360,7 @@ AboutReader.prototype = {
|
||||
if (!this._article)
|
||||
return;
|
||||
|
||||
gChromeWin.sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:Share",
|
||||
url: this._article.url,
|
||||
title: this._article.title
|
||||
@ -524,14 +525,14 @@ AboutReader.prototype = {
|
||||
},
|
||||
|
||||
_setBrowserToolbarVisiblity: function Reader_setBrowserToolbarVisiblity(visible) {
|
||||
gChromeWin.sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "BrowserToolbar:Visibility",
|
||||
visible: visible
|
||||
});
|
||||
},
|
||||
|
||||
_setSystemUIVisibility: function Reader_setSystemUIVisibility(visible) {
|
||||
gChromeWin.sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "SystemUI:Visibility",
|
||||
visible: visible
|
||||
});
|
||||
@ -560,7 +561,7 @@ AboutReader.prototype = {
|
||||
},
|
||||
|
||||
_requestFavicon: function Reader_requestFavicon() {
|
||||
gChromeWin.sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:FaviconRequest",
|
||||
url: this._article.url
|
||||
});
|
||||
|
@ -27,7 +27,7 @@ Cu.import("resource://gre/modules/accessibility/AccessFu.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
|
||||
"resource://gre/modules/Messaging.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DebuggerServer",
|
||||
@ -306,7 +306,7 @@ var BrowserApp = {
|
||||
try {
|
||||
BrowserApp.deck.removeEventListener("DOMContentLoaded", BrowserApp_delayedStartup, false);
|
||||
Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
|
||||
sendMessageToJava({ type: "Gecko:DelayedStartup" });
|
||||
Messaging.sendRequest({ type: "Gecko:DelayedStartup" });
|
||||
|
||||
// Queue up some other performance-impacting initializations
|
||||
Services.tm.mainThread.dispatch(function() {
|
||||
@ -366,7 +366,7 @@ var BrowserApp = {
|
||||
}
|
||||
|
||||
window.addEventListener("fullscreen", function() {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: window.fullScreen ? "ToggleChrome:Show" : "ToggleChrome:Hide"
|
||||
});
|
||||
}, false);
|
||||
@ -378,7 +378,7 @@ var BrowserApp = {
|
||||
// (per spec). This means the last event on enabling will be for the innermost
|
||||
// document, which will have mozFullScreenElement set correctly.
|
||||
let doc = e.target;
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: doc.mozFullScreen ? "DOMFullScreen:Start" : "DOMFullScreen:Stop",
|
||||
rootElement: (doc.mozFullScreen && doc.mozFullScreenElement == doc.documentElement)
|
||||
});
|
||||
@ -461,7 +461,7 @@ var BrowserApp = {
|
||||
}
|
||||
|
||||
// notify java that gecko has loaded
|
||||
sendMessageToJava({ type: "Gecko:Ready" });
|
||||
Messaging.sendRequest({ type: "Gecko:Ready" });
|
||||
},
|
||||
|
||||
get _startupStatus() {
|
||||
@ -487,7 +487,7 @@ var BrowserApp = {
|
||||
*/
|
||||
setLocale: function (locale) {
|
||||
console.log("browser.js: requesting locale set: " + locale);
|
||||
sendMessageToJava({ type: "Locale:Set", locale: locale });
|
||||
Messaging.sendRequest({ type: "Locale:Set", locale: locale });
|
||||
},
|
||||
|
||||
_initRuntime: function(status, url, callback) {
|
||||
@ -632,7 +632,7 @@ var BrowserApp = {
|
||||
UITelemetry.addEvent("action.1", "contextmenu", null, "web_contact_email");
|
||||
|
||||
let url = NativeWindow.contextmenus._getLinkURL(aTarget);
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Contact:Add",
|
||||
email: url
|
||||
});
|
||||
@ -644,7 +644,7 @@ var BrowserApp = {
|
||||
UITelemetry.addEvent("action.1", "contextmenu", null, "web_contact_phone");
|
||||
|
||||
let url = NativeWindow.contextmenus._getLinkURL(aTarget);
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Contact:Add",
|
||||
phone: url
|
||||
});
|
||||
@ -657,7 +657,7 @@ var BrowserApp = {
|
||||
|
||||
let url = NativeWindow.contextmenus._getLinkURL(aTarget);
|
||||
let title = aTarget.textContent || aTarget.title || url;
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Bookmark:Insert",
|
||||
url: url,
|
||||
title: title
|
||||
@ -773,7 +773,7 @@ var BrowserApp = {
|
||||
UITelemetry.addEvent("action.1", "contextmenu", null, "web_background_image");
|
||||
|
||||
let src = aTarget.src;
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Image:SetAs",
|
||||
url: src
|
||||
});
|
||||
@ -963,7 +963,7 @@ var BrowserApp = {
|
||||
type: "Content:LoadError",
|
||||
tabID: tab.id
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
dump("Handled load error: " + e)
|
||||
}
|
||||
}
|
||||
@ -1010,7 +1010,7 @@ var BrowserApp = {
|
||||
type: "Tab:Close",
|
||||
tabID: aTab.id
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
},
|
||||
|
||||
_loadWebapp: function(aMessage) {
|
||||
@ -1080,7 +1080,7 @@ var BrowserApp = {
|
||||
type: "Tab:Select",
|
||||
tabID: aTab.id
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1323,7 +1323,7 @@ var BrowserApp = {
|
||||
prefs.push(pref);
|
||||
}
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Preferences:Data",
|
||||
requestId: aRequestId, // opaque request identifier, can be any string/int/whatever
|
||||
preferences: prefs
|
||||
@ -1429,7 +1429,7 @@ var BrowserApp = {
|
||||
}
|
||||
|
||||
Promise.all(promises).then(function() {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Sanitize:Finished",
|
||||
success: true
|
||||
});
|
||||
@ -1438,7 +1438,7 @@ var BrowserApp = {
|
||||
callback();
|
||||
}
|
||||
}).catch(function(err) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Sanitize:Finished",
|
||||
error: err,
|
||||
success: false
|
||||
@ -1621,7 +1621,7 @@ var BrowserApp = {
|
||||
let query = isPrivate ? "" : aData;
|
||||
|
||||
let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Search:Keyword",
|
||||
identifier: engine.identifier,
|
||||
name: engine.name,
|
||||
@ -1682,11 +1682,11 @@ var BrowserApp = {
|
||||
}
|
||||
|
||||
case "sessionstore-state-purge-complete":
|
||||
sendMessageToJava({ type: "Session:StatePurged" });
|
||||
Messaging.sendRequest({ type: "Session:StatePurged" });
|
||||
break;
|
||||
|
||||
case "gather-telemetry":
|
||||
sendMessageToJava({ type: "Telemetry:Gather" });
|
||||
Messaging.sendRequest({ type: "Telemetry:Gather" });
|
||||
break;
|
||||
|
||||
case "Viewport:FixedMarginsChanged":
|
||||
@ -1871,7 +1871,7 @@ var NativeWindow = {
|
||||
},
|
||||
|
||||
loadDex: function(zipFile, implClass) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Dex:Load",
|
||||
zipfile: zipFile,
|
||||
impl: implClass || "Main"
|
||||
@ -1879,7 +1879,7 @@ var NativeWindow = {
|
||||
},
|
||||
|
||||
unloadDex: function(zipFile) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Dex:Unload",
|
||||
zipfile: zipFile
|
||||
});
|
||||
@ -1913,7 +1913,7 @@ var NativeWindow = {
|
||||
this._callbacks[msg.button.id] = aOptions.button.callback;
|
||||
}
|
||||
|
||||
sendMessageToJava(msg);
|
||||
Messaging.sendRequest(msg);
|
||||
}
|
||||
},
|
||||
|
||||
@ -1938,21 +1938,21 @@ var NativeWindow = {
|
||||
options.type = "Menu:Add";
|
||||
options.id = this._menuId;
|
||||
|
||||
sendMessageToJava(options);
|
||||
Messaging.sendRequest(options);
|
||||
this._callbacks[this._menuId] = options.callback;
|
||||
this._menuId++;
|
||||
return this._menuId - 1;
|
||||
},
|
||||
|
||||
remove: function(aId) {
|
||||
sendMessageToJava({ type: "Menu:Remove", id: aId });
|
||||
Messaging.sendRequest({ type: "Menu:Remove", id: aId });
|
||||
},
|
||||
|
||||
update: function(aId, aOptions) {
|
||||
if (!aOptions)
|
||||
return;
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Menu:Update",
|
||||
id: aId,
|
||||
options: aOptions
|
||||
@ -2002,11 +2002,11 @@ var NativeWindow = {
|
||||
tabID: aTabID || BrowserApp.selectedTab.id,
|
||||
options: aOptions || {}
|
||||
};
|
||||
sendMessageToJava(json);
|
||||
Messaging.sendRequest(json);
|
||||
},
|
||||
|
||||
hide: function(aValue, aTabID) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Doorhanger:Remove",
|
||||
value: aValue,
|
||||
tabID: aTabID
|
||||
@ -3196,7 +3196,7 @@ Tab.prototype = {
|
||||
isPrivate: isPrivate,
|
||||
stub: stub
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
|
||||
this.overscrollController = new OverscrollController(this);
|
||||
}
|
||||
@ -3260,7 +3260,7 @@ Tab.prototype = {
|
||||
type: "Content:LoadError",
|
||||
tabID: this.id
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
dump("Handled load error: " + e);
|
||||
}
|
||||
}
|
||||
@ -3351,7 +3351,7 @@ Tab.prototype = {
|
||||
// Set desktop mode for tab and send change to Java
|
||||
if (this.desktopMode != aDesktopMode) {
|
||||
this.desktopMode = aDesktopMode;
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "DesktopMode:Changed",
|
||||
desktopMode: aDesktopMode,
|
||||
tabID: this.id
|
||||
@ -3780,7 +3780,7 @@ Tab.prototype = {
|
||||
else if (docURI.startsWith("about:neterror"))
|
||||
errorType = "neterror";
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "DOMContentLoaded",
|
||||
tabID: this.id,
|
||||
bgColor: backgroundColor,
|
||||
@ -3891,7 +3891,7 @@ Tab.prototype = {
|
||||
href: resolveGeckoURI(target.href),
|
||||
size: maxSize
|
||||
};
|
||||
sendMessageToJava(json);
|
||||
Messaging.sendRequest(json);
|
||||
} else if (list.indexOf("[alternate]") != -1 && aEvent.type == "DOMLinkAdded") {
|
||||
let type = target.type.toLowerCase().replace(/^\s+|\s*(?:;.*)?$/g, "");
|
||||
let isFeed = (type == "application/rss+xml" || type == "application/atom+xml");
|
||||
@ -3911,7 +3911,7 @@ Tab.prototype = {
|
||||
type: "Link:Feed",
|
||||
tabID: this.id
|
||||
};
|
||||
sendMessageToJava(json);
|
||||
Messaging.sendRequest(json);
|
||||
} catch (e) {}
|
||||
} else if (list.indexOf("[search]" != -1) && aEvent.type == "DOMLinkAdded") {
|
||||
let type = target.type && target.type.toLowerCase();
|
||||
@ -3965,7 +3965,7 @@ Tab.prototype = {
|
||||
visible: true
|
||||
};
|
||||
|
||||
sendMessageToJava(newEngineMessage);
|
||||
Messaging.sendRequest(newEngineMessage);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3979,7 +3979,7 @@ Tab.prototype = {
|
||||
if (aEvent.originalTarget != this.browser.contentDocument)
|
||||
return;
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "DOMTitleChanged",
|
||||
tabID: this.id,
|
||||
title: truncate(aEvent.target.title, MAX_TITLE_LENGTH)
|
||||
@ -3995,7 +3995,7 @@ Tab.prototype = {
|
||||
if (this.browser.contentWindow == aEvent.target) {
|
||||
aEvent.preventDefault();
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Tab:Close",
|
||||
tabID: this.id
|
||||
});
|
||||
@ -4065,7 +4065,7 @@ Tab.prototype = {
|
||||
if (aEvent.originalTarget.defaultView != this.browser.contentWindow)
|
||||
return;
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Content:PageShow",
|
||||
tabID: this.id
|
||||
});
|
||||
@ -4112,7 +4112,7 @@ Tab.prototype = {
|
||||
|
||||
this.savedArticle = article;
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Content:ReaderEnabled",
|
||||
tabID: this.id
|
||||
});
|
||||
@ -4176,7 +4176,7 @@ Tab.prototype = {
|
||||
restoring: restoring,
|
||||
success: success
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
}
|
||||
},
|
||||
|
||||
@ -4258,7 +4258,7 @@ Tab.prototype = {
|
||||
sameDocument: sameDocument
|
||||
};
|
||||
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
|
||||
// The search term is only valid for this location change event, so reset it here.
|
||||
this.userSearch = "";
|
||||
@ -4300,7 +4300,7 @@ Tab.prototype = {
|
||||
identity: identity
|
||||
};
|
||||
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
},
|
||||
|
||||
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {
|
||||
@ -4327,7 +4327,7 @@ Tab.prototype = {
|
||||
message.numEntries = aParams.numEntries;
|
||||
}
|
||||
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
},
|
||||
|
||||
_getGeckoZoom: function() {
|
||||
@ -4564,7 +4564,7 @@ Tab.prototype = {
|
||||
|
||||
sendViewportMetadata: function sendViewportMetadata() {
|
||||
let metadata = this.metadata;
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Tab:ViewportMetadata",
|
||||
allowZoom: metadata.allowZoom,
|
||||
allowDoubleTapZoom: metadata.allowDoubleTapZoom,
|
||||
@ -4782,7 +4782,7 @@ var BrowserEventHandler = {
|
||||
let doc = BrowserApp.selectedBrowser.contentDocument;
|
||||
let rootScrollable = (doc.compatMode === "BackCompat" ? doc.body : doc.documentElement);
|
||||
if (this._scrollableElement != rootScrollable) {
|
||||
sendMessageToJava({ type: "Panning:Override" });
|
||||
Messaging.sendRequest({ type: "Panning:Override" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4822,7 +4822,7 @@ var BrowserEventHandler = {
|
||||
return;
|
||||
|
||||
tab.hasTouchListener = true;
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Tab:HasTouchListener",
|
||||
tabID: tab.id
|
||||
});
|
||||
@ -4872,7 +4872,7 @@ var BrowserEventHandler = {
|
||||
let doc = BrowserApp.selectedBrowser.contentDocument;
|
||||
if (this._scrollableElement == null ||
|
||||
this._scrollableElement == doc.documentElement) {
|
||||
sendMessageToJava({ type: "Panning:CancelOverride" });
|
||||
Messaging.sendRequest({ type: "Panning:CancelOverride" });
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4882,10 +4882,10 @@ var BrowserEventHandler = {
|
||||
// Scroll the scrollable element
|
||||
if (this._elementCanScroll(this._scrollableElement, x, y)) {
|
||||
this._scrollElementBy(this._scrollableElement, x, y);
|
||||
sendMessageToJava({ type: "Gesture:ScrollAck", scrolled: true });
|
||||
Messaging.sendRequest({ type: "Gesture:ScrollAck", scrolled: true });
|
||||
SelectionHandler.subdocumentScrolled(this._scrollableElement);
|
||||
} else {
|
||||
sendMessageToJava({ type: "Gesture:ScrollAck", scrolled: false });
|
||||
Messaging.sendRequest({ type: "Gesture:ScrollAck", scrolled: false });
|
||||
}
|
||||
|
||||
break;
|
||||
@ -5801,7 +5801,7 @@ var FormAssistant = {
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "FormAssist:AutoComplete",
|
||||
suggestions: suggestions,
|
||||
rect: ElementTouchHelper.getBoundingContentRect(aElement)
|
||||
@ -5836,7 +5836,7 @@ var FormAssistant = {
|
||||
if (!this._isValidateable(aElement))
|
||||
return false;
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "FormAssist:ValidationMessage",
|
||||
validationMessage: aElement.validationMessage,
|
||||
rect: ElementTouchHelper.getBoundingContentRect(aElement)
|
||||
@ -5846,7 +5846,7 @@ var FormAssistant = {
|
||||
},
|
||||
|
||||
_hideFormAssistPopup: function _hideFormAssistPopup() {
|
||||
sendMessageToJava({ type: "FormAssist:Hide" });
|
||||
Messaging.sendRequest({ type: "FormAssist:Hide" });
|
||||
}
|
||||
};
|
||||
|
||||
@ -5917,7 +5917,7 @@ let HealthReportStatusListener = {
|
||||
return;
|
||||
}
|
||||
|
||||
sendMessageToJava(response);
|
||||
Messaging.sendRequest(response);
|
||||
break;
|
||||
}
|
||||
},
|
||||
@ -5976,7 +5976,7 @@ let HealthReportStatusListener = {
|
||||
if (this._shouldIgnore(aAddon)) {
|
||||
json.ignore = true;
|
||||
}
|
||||
sendMessageToJava({ type: aAction, id: aAddon.id, json: json });
|
||||
Messaging.sendRequest({ type: aAction, id: aAddon.id, json: json });
|
||||
},
|
||||
|
||||
// Add-on listeners.
|
||||
@ -6039,7 +6039,7 @@ let HealthReportStatusListener = {
|
||||
}
|
||||
|
||||
console.log("Sending snapshot message.");
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HealthReport:Snapshot",
|
||||
json: {
|
||||
addons: jsonA,
|
||||
@ -6693,7 +6693,7 @@ var CharacterEncoding = {
|
||||
showCharEncoding = Services.prefs.getComplexValue("browser.menu.showCharacterEncoding", Ci.nsIPrefLocalizedString).data;
|
||||
} catch (e) { /* Optional */ }
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "CharEncoding:State",
|
||||
visible: showCharEncoding
|
||||
});
|
||||
@ -6727,7 +6727,7 @@ var CharacterEncoding = {
|
||||
}
|
||||
}
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "CharEncoding:Data",
|
||||
charsets: this._charsets,
|
||||
selected: selected
|
||||
@ -6939,7 +6939,7 @@ OverscrollController.prototype = {
|
||||
},
|
||||
|
||||
doCommand : function doCommand(aCommand){
|
||||
sendMessageToJava({ type: "ToggleChrome:Focus" });
|
||||
Messaging.sendRequest({ type: "ToggleChrome:Focus" });
|
||||
},
|
||||
|
||||
onEvent : function onEvent(aEvent) { }
|
||||
@ -7033,7 +7033,7 @@ var SearchEngines = {
|
||||
}
|
||||
|
||||
// By convention, the currently configured default engine is at position zero in searchEngines.
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "SearchEngines:Data",
|
||||
searchEngines: searchEngines,
|
||||
suggest: {
|
||||
@ -7117,7 +7117,7 @@ var SearchEngines = {
|
||||
visible: false
|
||||
};
|
||||
|
||||
sendMessageToJava(newEngineMessage);
|
||||
Messaging.sendRequest(newEngineMessage);
|
||||
}
|
||||
}).bind(this));
|
||||
},
|
||||
@ -7412,13 +7412,13 @@ let Reader = {
|
||||
|
||||
pageAction: {
|
||||
readerModeCallback: function(){
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:Click",
|
||||
});
|
||||
},
|
||||
|
||||
readerModeActiveCallback: function(){
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:LongClick",
|
||||
});
|
||||
|
||||
@ -7492,7 +7492,7 @@ let Reader = {
|
||||
article = article || {};
|
||||
this.log("Reader:Add success=" + result + ", url=" + url + ", title=" + article.title + ", excerpt=" + article.excerpt);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:Added",
|
||||
result: result,
|
||||
title: truncate(article.title, MAX_TITLE_LENGTH),
|
||||
@ -7540,7 +7540,7 @@ let Reader = {
|
||||
this.removeArticleFromCache(args.url, function(success) {
|
||||
this.log("Reader:Remove success=" + success + ", url=" + args.url);
|
||||
if (success && args.notify) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Reader:Removed",
|
||||
url: args.url
|
||||
});
|
||||
@ -8185,7 +8185,7 @@ var Distribution = {
|
||||
} catch (e) { /* ignore bad prefs and move on */ }
|
||||
}
|
||||
|
||||
sendMessageToJava({ type: "Distribution:Set:OK" });
|
||||
Messaging.sendRequest({ type: "Distribution:Set:OK" });
|
||||
},
|
||||
|
||||
// aFile is an nsIFile
|
||||
|
@ -64,7 +64,7 @@ ContentDispatchChooser.prototype =
|
||||
url: "market://search?q=" + aURI.scheme,
|
||||
};
|
||||
|
||||
sendMessageToJava(message);
|
||||
Messaging.sendRequest(message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava", "resource://gre/modules/Messaging.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging", "resource://gre/modules/Messaging.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
function dump(a) {
|
||||
@ -144,7 +144,7 @@ SessionStore.prototype = {
|
||||
}
|
||||
|
||||
// Let Java know we're done restoring tabs so tabs added after this can be animated
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Session:RestoreEnd"
|
||||
});
|
||||
}.bind(this)
|
||||
@ -454,7 +454,7 @@ SessionStore.prototype = {
|
||||
|
||||
// If we have private data, send it to Java; otherwise, send null to
|
||||
// indicate that there is no private data
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "PrivateBrowsing:Data",
|
||||
session: (privateData.windows.length > 0 && privateData.windows[0].tabs.length > 0) ? JSON.stringify(privateData) : null
|
||||
});
|
||||
@ -943,7 +943,7 @@ SessionStore.prototype = {
|
||||
};
|
||||
});
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "ClosedTabs:Data",
|
||||
tabs: tabs
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
|
||||
"resource://gre/modules/Prompt.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
|
||||
"resource://gre/modules/Messaging.jsm");
|
||||
|
||||
function TabSource() {
|
||||
@ -72,7 +72,7 @@ TabSource.prototype = {
|
||||
let tabs = app.tabs;
|
||||
for (var i in tabs) {
|
||||
if (tabs[i].browser.contentWindow == window) {
|
||||
sendMessageToJava({ type: "Tab:StreamStart", tabID: tabs[i].id });
|
||||
Messaging.sendRequest({ type: "Tab:StreamStart", tabID: tabs[i].id });
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -82,7 +82,7 @@ TabSource.prototype = {
|
||||
let tabs = app.tabs;
|
||||
for (let i in tabs) {
|
||||
if (tabs[i].browser.contentWindow == window) {
|
||||
sendMessageToJava({ type: "Tab:StreamStop", tabID: tabs[i].id });
|
||||
Messaging.sendRequest({ type: "Tab:StreamStop", tabID: tabs[i].id });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,9 @@ browser.menu.showCharacterEncoding=false
|
||||
selectionHelper.textCopied=Text copied to clipboard
|
||||
|
||||
# Casting
|
||||
casting.prompt=Cast to Device
|
||||
# LOCALIZATION NOTE (casting.sendToDevice): Label that will be used in the
|
||||
# dialog/prompt.
|
||||
casting.sendToDevice=Send to Device
|
||||
casting.mirrorTab=Mirror Tab
|
||||
casting.mirrorTabStop=Stop Mirror
|
||||
|
||||
@ -247,7 +249,9 @@ contextmenu.unmute=Unmute
|
||||
contextmenu.saveVideo=Save Video
|
||||
contextmenu.saveAudio=Save Audio
|
||||
contextmenu.addToContacts=Add to Contacts
|
||||
contextmenu.castToScreen=Cast to Screen
|
||||
# LOCALIZATION NOTE (contextmenu.sendToDevice):
|
||||
# The label that will be used in the contextmenu and the pageaction
|
||||
contextmenu.sendToDevice=Send to Device
|
||||
|
||||
contextmenu.copy=Copy
|
||||
contextmenu.cut=Cut
|
||||
@ -384,4 +388,4 @@ feedHandler.subscribeWith=Subscribe with
|
||||
# This string is shown in the console when someone uses deprecated NativeWindow apis.
|
||||
# %1$S=name of the api that's deprecated, %2$S=New API to use. This may be a url to
|
||||
# a file they should import or the name of an api.
|
||||
nativeWindow.deprecated=%S is deprecated. Please use %S instead
|
||||
nativeWindow.deprecated=%S is deprecated. Please use %S instead
|
||||
|
@ -72,7 +72,7 @@ let Accounts = Object.freeze({
|
||||
* There is no return value from this method.
|
||||
*/
|
||||
launchSetup: function (extras) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Accounts:Create",
|
||||
extras: extras,
|
||||
});
|
||||
|
@ -11,6 +11,9 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
|
||||
"resource://gre/modules/Prompt.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging",
|
||||
"resource://gre/modules/Messaging.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava",
|
||||
"resource://gre/modules/Messaging.jsm");
|
||||
|
||||
@ -152,7 +155,7 @@ var HelperApps = {
|
||||
|
||||
launchUri: function launchUri(uri) {
|
||||
let msg = this._getMessage("Intent:Open", uri);
|
||||
sendMessageToJava(msg);
|
||||
Messaging.sendRequest(msg);
|
||||
},
|
||||
|
||||
_parseApps: function _parseApps(appInfo) {
|
||||
@ -202,7 +205,7 @@ var HelperApps = {
|
||||
className: app.activityName
|
||||
});
|
||||
|
||||
sendMessageToJava(msg);
|
||||
Messaging.sendRequest(msg);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -94,7 +94,7 @@ let HomeBanner = (function () {
|
||||
for (let key in _messages) {
|
||||
let message = _messages[key];
|
||||
if (threshold < message.totalWeight) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HomeBanner:Data",
|
||||
id: message.id,
|
||||
text: message.text,
|
||||
@ -214,7 +214,7 @@ let HomePanels = (function () {
|
||||
}
|
||||
}
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HomePanels:Data",
|
||||
panels: panels,
|
||||
requestId: requestId
|
||||
@ -429,7 +429,7 @@ let HomePanels = (function () {
|
||||
install: function(id) {
|
||||
_assertPanelExists(id);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HomePanels:Install",
|
||||
panel: _generatePanel(id)
|
||||
});
|
||||
@ -438,7 +438,7 @@ let HomePanels = (function () {
|
||||
uninstall: function(id) {
|
||||
_assertPanelExists(id);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HomePanels:Uninstall",
|
||||
id: id
|
||||
});
|
||||
@ -447,7 +447,7 @@ let HomePanels = (function () {
|
||||
update: function(id) {
|
||||
_assertPanelExists(id);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HomePanels:Update",
|
||||
panel: _generatePanel(id)
|
||||
});
|
||||
|
@ -300,7 +300,7 @@ function refreshDataset(datasetId) {
|
||||
timer.initWithCallback(function(timer) {
|
||||
delete gRefreshTimers[datasetId];
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "HomePanels:RefreshDataset",
|
||||
datasetId: datasetId
|
||||
});
|
||||
|
@ -9,49 +9,26 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["sendMessageToJava", "RequestService"];
|
||||
this.EXPORTED_SYMBOLS = ["sendMessageToJava", "Messaging"];
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "uuidgen",
|
||||
"@mozilla.org/uuid-generator;1",
|
||||
"nsIUUIDGenerator");
|
||||
|
||||
function sendMessageToJava(aMessage, aCallback) {
|
||||
if (aCallback) {
|
||||
let id = uuidgen.generateUUID().toString();
|
||||
let obs = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
let data = JSON.parse(aData);
|
||||
if (data.__guid__ != id) {
|
||||
return;
|
||||
}
|
||||
Cu.reportError("sendMessageToJava is deprecated. Use Messaging API instead.");
|
||||
|
||||
Services.obs.removeObserver(obs, aMessage.type + ":Response", false);
|
||||
|
||||
if (data.status === "cancel") {
|
||||
// No Java-side listeners handled our callback.
|
||||
return;
|
||||
}
|
||||
|
||||
aCallback(data.status === "success" ? data.response : null,
|
||||
data.status === "error" ? data.response : null);
|
||||
}
|
||||
}
|
||||
|
||||
aMessage.__guid__ = id;
|
||||
Services.obs.addObserver(obs, aMessage.type + ":Response", false);
|
||||
}
|
||||
|
||||
return Services.androidBridge.handleGeckoMessage(aMessage);
|
||||
Messaging.sendRequest(aMessage, aCallback);
|
||||
}
|
||||
|
||||
let RequestService = {
|
||||
let Messaging = {
|
||||
/**
|
||||
* Add a listener for the given message.
|
||||
*
|
||||
* Only one request listener can be registered for a given message.
|
||||
*
|
||||
* Example usage:
|
||||
* RequestService.addListener({
|
||||
* Messaging.addListener({
|
||||
* // aMessage is the message name.
|
||||
* // aData is data sent from Java with the request.
|
||||
* // The return value is used to respond to the request. The return
|
||||
@ -66,7 +43,7 @@ let RequestService = {
|
||||
*
|
||||
* The listener may also be a generator function, useful for performing a
|
||||
* task asynchronously. For example:
|
||||
* RequestService.addListener({
|
||||
* Messaging.addListener({
|
||||
* onRequest: function* (aMessage, aData) {
|
||||
* yield new Promise(resolve => setTimeout(resolve, 2000));
|
||||
* return { response: "bar" };
|
||||
@ -89,6 +66,41 @@ let RequestService = {
|
||||
removeListener: function (aMessage) {
|
||||
requestHandler.removeListener(aMessage);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sends a request to Java.
|
||||
*
|
||||
* @param aMessage Message to send; must be an object with a "type" property
|
||||
* @param aCallback Callback function, required if this request expects a response.
|
||||
*/
|
||||
sendRequest: function (aMessage, aCallback) {
|
||||
if (aCallback) {
|
||||
let id = uuidgen.generateUUID().toString();
|
||||
let obs = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
let data = JSON.parse(aData);
|
||||
if (data.__guid__ != id) {
|
||||
return;
|
||||
}
|
||||
|
||||
Services.obs.removeObserver(obs, aMessage.type + ":Response", false);
|
||||
|
||||
if (data.status === "cancel") {
|
||||
// No Java-side listeners handled our callback.
|
||||
return;
|
||||
}
|
||||
|
||||
aCallback(data.status === "success" ? data.response : null,
|
||||
data.status === "error" ? data.response : null);
|
||||
}
|
||||
}
|
||||
|
||||
aMessage.__guid__ = id;
|
||||
Services.obs.addObserver(obs, aMessage.type + ":Response", false);
|
||||
}
|
||||
|
||||
return Services.androidBridge.handleGeckoMessage(aMessage);
|
||||
},
|
||||
};
|
||||
|
||||
let requestHandler = {
|
||||
@ -135,7 +147,7 @@ let requestHandler = {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Gecko:Request" + wrapper.id,
|
||||
response: response
|
||||
});
|
||||
|
@ -101,7 +101,7 @@ handlers.wifi = {
|
||||
this.node = Cu.getWeakReference(node);
|
||||
Services.obs.addObserver(this, "network:link-status-changed", true);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Wifi:Enable"
|
||||
});
|
||||
},
|
||||
|
@ -70,7 +70,7 @@ function sendOrderedBroadcast(action, token, callback, permission) {
|
||||
|
||||
Services.obs.addObserver(observer, responseEvent, false);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "OrderedBroadcast:Send",
|
||||
action: action,
|
||||
responseEvent: responseEvent,
|
||||
|
@ -67,7 +67,7 @@ var PageActions = {
|
||||
|
||||
add: function(aOptions) {
|
||||
let id = uuidgen.generateUUID().toString();
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "PageActions:Add",
|
||||
id: id,
|
||||
title: aOptions.title,
|
||||
@ -85,7 +85,7 @@ var PageActions = {
|
||||
},
|
||||
|
||||
remove: function(id) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "PageActions:Remove",
|
||||
id: id
|
||||
});
|
||||
|
@ -76,7 +76,7 @@ function SharedPreferencesImpl(options = {}) {
|
||||
|
||||
SharedPreferencesImpl.prototype = Object.freeze({
|
||||
_set: function _set(prefs) {
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "SharedPreferences:Set",
|
||||
preferences: prefs,
|
||||
scope: this._scope,
|
||||
@ -206,7 +206,7 @@ SharedPreferencesImpl.prototype = Object.freeze({
|
||||
this._listening = true;
|
||||
|
||||
Services.obs.addObserver(this, "SharedPreferences:Changed", false);
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "SharedPreferences:Observe",
|
||||
enable: true,
|
||||
scope: this._scope,
|
||||
@ -243,7 +243,7 @@ SharedPreferencesImpl.prototype = Object.freeze({
|
||||
this._listening = false;
|
||||
|
||||
Services.obs.removeObserver(this, "SharedPreferences:Changed");
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "SharedPreferences:Observe",
|
||||
enable: false,
|
||||
scope: this._scope,
|
||||
|
@ -22,6 +22,7 @@ Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Notifications", "resource://gre/modules/Notifications.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Messaging", "resource://gre/modules/Messaging.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "sendMessageToJava", "resource://gre/modules/Messaging.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
@ -193,7 +194,7 @@ this.WebappManager = {
|
||||
|
||||
_postInstall: function(aProfilePath, aNewManifest, aOrigin, aApkPackageName, aManifestURL) {
|
||||
// aOrigin may now point to the app: url that hosts this app.
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Webapps:Postinstall",
|
||||
apkPackageName: aApkPackageName,
|
||||
origin: aOrigin,
|
||||
@ -209,7 +210,7 @@ this.WebappManager = {
|
||||
launch: function({ apkPackageName }) {
|
||||
debug("launch: " + apkPackageName);
|
||||
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Webapps:Launch",
|
||||
packageName: apkPackageName,
|
||||
});
|
||||
@ -236,7 +237,7 @@ this.WebappManager = {
|
||||
let apkVersions = yield this._getAPKVersions([ app.apkPackageName ]);
|
||||
if (app.apkPackageName in apkVersions) {
|
||||
debug("APK is installed; requesting uninstallation");
|
||||
sendMessageToJava({
|
||||
Messaging.sendRequest({
|
||||
type: "Webapps:UninstallApk",
|
||||
apkPackageName: app.apkPackageName,
|
||||
});
|
||||
|
@ -86,9 +86,15 @@ public class SearchEngineManager implements SharedPreferences.OnSharedPreference
|
||||
@Override
|
||||
protected SearchEngine doInBackground(Void... params) {
|
||||
String identifier = GeckoSharedPrefs.forApp(context).getString(SearchPreferenceActivity.PREF_SEARCH_ENGINE_KEY, null);
|
||||
if (TextUtils.isEmpty(identifier)) {
|
||||
identifier = context.getResources().getString(R.string.default_engine_identifier);
|
||||
if (!TextUtils.isEmpty(identifier)) {
|
||||
try {
|
||||
return createEngine(identifier);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(LOG_TAG, "Exception creating search engine from pref. Falling back to default engine.", e);
|
||||
}
|
||||
}
|
||||
|
||||
identifier = context.getResources().getString(R.string.default_engine_identifier);
|
||||
return createEngine(identifier);
|
||||
}
|
||||
|
||||
|
@ -242,6 +242,7 @@ user_pref("browser.newtabpage.directory.ping", "");
|
||||
|
||||
// Enable Loop
|
||||
user_pref("loop.enabled", true);
|
||||
user_pref("loop.throttled", false);
|
||||
|
||||
// Ensure UITour won't hit the network
|
||||
user_pref("browser.uitour.pinnedTabUrl", "http://%(server)s/uitour-dummy/pinnedTab");
|
||||
|
@ -52,6 +52,7 @@ Protocol.prototype = {
|
||||
*/
|
||||
get protocolFlags() {
|
||||
return Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
|
||||
Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
|
||||
Ci.nsIProtocolHandler.URI_NORELATIVE |
|
||||
Ci.nsIProtocolHandler.URI_NOAUTH;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user