зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to b2g-inbound
This commit is contained in:
Коммит
867e7d222f
2
CLOBBER
2
CLOBBER
|
@ -22,4 +22,4 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 609976 needs a CLOBBER on Windows again.
|
||||
Bug 1087560 needs a CLOBBER to stop it from looking in the wrong place for tests
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"filename": "clang.tar.bz2"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
},
|
||||
|
|
|
@ -1761,3 +1761,6 @@ pref("experiments.supported", true);
|
|||
pref("media.gmp-gmpopenh264.provider.enabled", true);
|
||||
|
||||
pref("browser.apps.URL", "https://marketplace.firefox.com/discovery/");
|
||||
|
||||
pref("browser.polaris.enabled", false);
|
||||
pref("privacy.trackingprotection.ui.enabled", false);
|
||||
|
|
|
@ -74,3 +74,13 @@ tabpanels {
|
|||
browser[pending] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
browser[pendingpaint] {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
tabbrowser[pendingpaint] {
|
||||
background-image: url(chrome://browser/skin/tabbrowser/pendingpaint.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
|
|
@ -136,6 +136,10 @@
|
|||
""
|
||||
</field>
|
||||
|
||||
<field name="_contentWaitingCount">
|
||||
0
|
||||
</field>
|
||||
|
||||
<property name="_numPinnedTabs" readonly="true">
|
||||
<getter><![CDATA[
|
||||
for (var i = 0; i < this.tabs.length; i++) {
|
||||
|
@ -3238,6 +3242,31 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_showBusySpinnerRemoteBrowser">
|
||||
<parameter name="aBrowser"/>
|
||||
<body><![CDATA[
|
||||
aBrowser.setAttribute("pendingpaint", "true");
|
||||
if (this._contentWaitingCount <= 0) {
|
||||
// We are not currently spinning
|
||||
this.setAttribute("pendingpaint", "true");
|
||||
this._contentWaitingCount = 1;
|
||||
} else {
|
||||
this._contentWaitingCount++;
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_hideBusySpinnerRemoteBrowser">
|
||||
<parameter name="aBrowser"/>
|
||||
<body><![CDATA[
|
||||
aBrowser.removeAttribute("pendingpaint");
|
||||
this._contentWaitingCount--;
|
||||
if (this._contentWaitingCount <= 0) {
|
||||
this.removeAttribute("pendingpaint");
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_prepareForTabSwitch">
|
||||
<parameter name="toTab"/>
|
||||
<parameter name="fromTab"/>
|
||||
|
@ -3276,16 +3305,19 @@
|
|||
|
||||
let timeoutPromise = new Promise((aResolve, aReject) => {
|
||||
timeoutId = setTimeout(() => {
|
||||
this._showBusySpinnerRemoteBrowser(toBrowser);
|
||||
attemptTabSwitch(aResolve, aReject);
|
||||
}, kTabSwitchTimeout);
|
||||
});
|
||||
|
||||
let paintPromise = new Promise((aResolve, aReject) => {
|
||||
toBrowser.addEventListener("MozAfterRemotePaint", function onRemotePaint() {
|
||||
let onRemotePaint = () => {
|
||||
toBrowser.removeEventListener("MozAfterRemotePaint", onRemotePaint);
|
||||
this._hideBusySpinnerRemoteBrowser(toBrowser);
|
||||
clearTimeout(timeoutId);
|
||||
attemptTabSwitch(aResolve, aReject);
|
||||
});
|
||||
};
|
||||
toBrowser.addEventListener("MozAfterRemotePaint", onRemotePaint);
|
||||
toBrowser.QueryInterface(Ci.nsIFrameLoaderOwner)
|
||||
.frameLoader
|
||||
.requestNotifyAfterRemotePaint();
|
||||
|
|
|
@ -203,7 +203,7 @@ let LoopCallsInternal = {
|
|||
// Make the call to get the GUEST session regardless of whether the FXA
|
||||
// request fails.
|
||||
|
||||
if (channelID == LoopCalls.channelIDs.FxA && MozLoopService.userProfile) {
|
||||
if (channelID == MozLoopService.channelIDs.callsFxA && MozLoopService.userProfile) {
|
||||
this._getCalls(LOOP_SESSION_TYPE.FXA, version);
|
||||
} else {
|
||||
this._getCalls(LOOP_SESSION_TYPE.GUEST, version);
|
||||
|
@ -320,12 +320,6 @@ Object.freeze(LoopCallsInternal);
|
|||
* Public API
|
||||
*/
|
||||
this.LoopCalls = {
|
||||
// Channel ids that will be registered with the PushServer for notifications
|
||||
channelIDs: {
|
||||
FxA: "25389583-921f-4169-a426-a4673658944b",
|
||||
Guest: "801f754b-686b-43ec-bd83-1419bbf58388",
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback from MozLoopPushHandler - A push notification has been received from
|
||||
* the server.
|
||||
|
|
|
@ -5,21 +5,166 @@
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["LoopRooms"];
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MozLoopService",
|
||||
"resource:///modules/loop/MozLoopService.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LOOP_SESSION_TYPE",
|
||||
"resource:///modules/loop/MozLoopService.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MozLoopPushHandler",
|
||||
"resource:///modules/loop/MozLoopPushHandler.jsm");
|
||||
|
||||
/**
|
||||
* Public Loop Rooms API
|
||||
*/
|
||||
this.LoopRooms = Object.freeze({
|
||||
// Channel ids that will be registered with the PushServer for notifications
|
||||
channelIDs: {
|
||||
FxA: "6add272a-d316-477c-8335-f00f73dfde71",
|
||||
Guest: "19d3f799-a8f3-4328-9822-b7cd02765832",
|
||||
// Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let ConsoleAPI = Cu.import("resource://gre/modules/devtools/Console.jsm", {}).ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
maxLogLevel: Services.prefs.getCharPref(PREF_LOG_LEVEL).toLowerCase(),
|
||||
prefix: "Loop",
|
||||
};
|
||||
return new ConsoleAPI(consoleOptions);
|
||||
});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["LoopRooms", "roomsPushNotification"];
|
||||
|
||||
let gRoomsListFetched = false;
|
||||
let gRooms = new Map();
|
||||
|
||||
/**
|
||||
* Callback used to indicate changes to rooms data on the LoopServer.
|
||||
*
|
||||
* @param {Object} version Version number assigned to this change set.
|
||||
* @param {Object} channelID Notification channel identifier.
|
||||
*
|
||||
*/
|
||||
const roomsPushNotification = function(version, channelID) {
|
||||
return LoopRoomsInternal.onNotification(version, channelID);
|
||||
};
|
||||
|
||||
let LoopRoomsInternal = {
|
||||
getAll: function(callback) {
|
||||
Task.spawn(function*() {
|
||||
yield MozLoopService.register();
|
||||
|
||||
if (gRoomsListFetched) {
|
||||
callback(null, [...gRooms.values()]);
|
||||
return;
|
||||
}
|
||||
// Fetch the rooms from the server.
|
||||
let sessionType = MozLoopService.userProfile ? LOOP_SESSION_TYPE.FXA :
|
||||
LOOP_SESSION_TYPE.GUEST;
|
||||
let rooms = yield this.requestRoomList(sessionType);
|
||||
// Add each room to our in-memory Map using a locally unique
|
||||
// identifier.
|
||||
for (let room of rooms) {
|
||||
let id = MozLoopService.generateLocalID();
|
||||
room.localRoomID = id;
|
||||
// Next, request the detailed information for each room.
|
||||
// If the request fails the room data will not be added to the map.
|
||||
try {
|
||||
let details = yield this.requestRoomDetails(room.roomToken, sessionType);
|
||||
for (let attr in details) {
|
||||
room[attr] = details[attr]
|
||||
}
|
||||
gRooms.set(id, room);
|
||||
}
|
||||
catch (error) {log.warn("failed GETing room details for roomToken = " + room.roomToken + ": ", error)}
|
||||
}
|
||||
callback(null, [...gRooms.values()]);
|
||||
return;
|
||||
}.bind(this)).catch((error) => {log.error("getAll error:", error);
|
||||
callback(error)});
|
||||
return;
|
||||
},
|
||||
|
||||
getRoomData: function(roomID, callback) {
|
||||
if (gRooms.has(roomID)) {
|
||||
callback(null, gRooms.get(roomID));
|
||||
} else {
|
||||
callback(new Error("Room data not found or not fetched yet for room with ID " + roomID));
|
||||
}
|
||||
return;
|
||||
},
|
||||
|
||||
/**
|
||||
* Request list of all rooms associated with this account.
|
||||
*
|
||||
* @param {String} sessionType Indicates which hawkRequest endpoint to use.
|
||||
*
|
||||
* @returns {Promise} room list
|
||||
*/
|
||||
requestRoomList: function(sessionType) {
|
||||
return MozLoopService.hawkRequest(sessionType, "/rooms", "GET")
|
||||
.then(response => {
|
||||
let roomsList = JSON.parse(response.body);
|
||||
if (!Array.isArray(roomsList)) {
|
||||
// Force a reject in the returned promise.
|
||||
// To be caught by the caller using the returned Promise.
|
||||
throw new Error("Missing array of rooms in response.");
|
||||
}
|
||||
return roomsList;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Request information about a specific room from the server.
|
||||
*
|
||||
* @param {Object} token Room identifier returned from the LoopServer.
|
||||
* @param {String} sessionType Indicates which hawkRequest endpoint to use.
|
||||
*
|
||||
* @returns {Promise} room details
|
||||
*/
|
||||
requestRoomDetails: function(token, sessionType) {
|
||||
return MozLoopService.hawkRequest(sessionType, "/rooms/" + token, "GET")
|
||||
.then(response => JSON.parse(response.body));
|
||||
},
|
||||
|
||||
/**
|
||||
* Callback used to indicate changes to rooms data on the LoopServer.
|
||||
*
|
||||
* @param {Object} version Version number assigned to this change set.
|
||||
* @param {Object} channelID Notification channel identifier.
|
||||
*
|
||||
*/
|
||||
onNotification: function(version, channelID) {
|
||||
return;
|
||||
},
|
||||
});
|
||||
};
|
||||
Object.freeze(LoopRoomsInternal);
|
||||
|
||||
/**
|
||||
* The LoopRooms class.
|
||||
*
|
||||
* Each method that is a member of this class requires the last argument to be a
|
||||
* callback Function. MozLoopAPI will cause things to break if this invariant is
|
||||
* violated. You'll notice this as well in the documentation for each method.
|
||||
*/
|
||||
this.LoopRooms = {
|
||||
/**
|
||||
* Fetch a list of rooms that the currently registered user is a member of.
|
||||
*
|
||||
* @param {Function} callback Function that will be invoked once the operation
|
||||
* finished. The first argument passed will be an
|
||||
* `Error` object or `null`. The second argument will
|
||||
* be the list of rooms, if it was fetched successfully.
|
||||
*/
|
||||
getAll: function(callback) {
|
||||
return LoopRoomsInternal.getAll(callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the current stored version of the data for the indicated room.
|
||||
*
|
||||
* @param {String} roomID Local room identifier
|
||||
* @param {Function} callback Function that will be invoked once the operation
|
||||
* finished. The first argument passed will be an
|
||||
* `Error` object or `null`. The second argument will
|
||||
* be the list of rooms, if it was fetched successfully.
|
||||
*/
|
||||
getRoomData: function(roomID, callback) {
|
||||
return LoopRoomsInternal.getRoomData(roomID, callback);
|
||||
},
|
||||
};
|
||||
Object.freeze(LoopRooms);
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ Cu.import("resource://gre/modules/Services.jsm");
|
|||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource:///modules/loop/LoopCalls.jsm");
|
||||
Cu.import("resource:///modules/loop/MozLoopService.jsm");
|
||||
Cu.import("resource:///modules/loop/LoopRooms.jsm");
|
||||
Cu.import("resource:///modules/loop/LoopContacts.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LoopContacts",
|
||||
"resource:///modules/loop/LoopContacts.jsm");
|
||||
|
@ -124,6 +126,7 @@ function injectLoopAPI(targetWindow) {
|
|||
let ringerStopper;
|
||||
let appVersionInfo;
|
||||
let contactsAPI;
|
||||
let roomsAPI;
|
||||
|
||||
let api = {
|
||||
/**
|
||||
|
@ -245,6 +248,21 @@ function injectLoopAPI(targetWindow) {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the rooms API.
|
||||
*
|
||||
* @returns {Object} The rooms API object
|
||||
*/
|
||||
rooms: {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
if (roomsAPI) {
|
||||
return roomsAPI;
|
||||
}
|
||||
return roomsAPI = injectObjectAPI(LoopRooms, targetWindow);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Import a list of (new) contacts from an external data source.
|
||||
*
|
||||
|
|
|
@ -71,6 +71,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "LoopCalls",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "LoopRooms",
|
||||
"resource:///modules/loop/LoopRooms.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "roomsPushNotification",
|
||||
"resource:///modules/loop/LoopRooms.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MozLoopPushHandler",
|
||||
"resource:///modules/loop/MozLoopPushHandler.jsm");
|
||||
|
||||
|
@ -342,17 +345,18 @@ let MozLoopServiceInternal = {
|
|||
let options = mockWebSocket ? {mockWebSocket: mockWebSocket} : {};
|
||||
gPushHandler.initialize(options);
|
||||
|
||||
let callsRegGuest = registerForNotification(LoopCalls.channelIDs.Guest,
|
||||
let callsRegGuest = registerForNotification(MozLoopService.channelIDs.callsGuest,
|
||||
LoopCalls.onNotification);
|
||||
|
||||
let roomsRegGuest = registerForNotification(LoopRooms.channelIDs.Guest,
|
||||
LoopRooms.onNotification);
|
||||
|
||||
let callsRegFxA = registerForNotification(LoopCalls.channelIDs.FxA,
|
||||
|
||||
let roomsRegGuest = registerForNotification(MozLoopService.channelIDs.roomsGuest,
|
||||
roomsPushNotification);
|
||||
|
||||
let callsRegFxA = registerForNotification(MozLoopService.channelIDs.callsFxA,
|
||||
LoopCalls.onNotification);
|
||||
|
||||
let roomsRegFxA = registerForNotification(MozLoopService.channelIDs.roomsFxA,
|
||||
roomsPushNotification);
|
||||
|
||||
let roomsRegFxA = registerForNotification(LoopRooms.channelIDs.FxA,
|
||||
LoopRooms.onNotification);
|
||||
Promise.all([callsRegGuest, roomsRegGuest, callsRegFxA, roomsRegFxA])
|
||||
.then((pushUrls) => {
|
||||
return this.registerWithLoopServer(LOOP_SESSION_TYPE.GUEST,
|
||||
|
@ -516,7 +520,13 @@ let MozLoopServiceInternal = {
|
|||
* @return {Promise}
|
||||
*/
|
||||
registerWithLoopServer: function(sessionType, pushUrls, retry = true) {
|
||||
return this.hawkRequest(sessionType, "/registration", "POST", { simplePushURLs: pushUrls})
|
||||
// create a registration payload with a backwards compatible attribute (simplePushURL)
|
||||
// that will register only the calls notification.
|
||||
let msg = {
|
||||
simplePushURL: pushUrls.calls,
|
||||
simplePushURLs: pushUrls
|
||||
};
|
||||
return this.hawkRequest(sessionType, "/registration", "POST", msg)
|
||||
.then((response) => {
|
||||
// If this failed we got an invalid token. storeSessionToken rejects
|
||||
// the gRegisteredDeferred promise for us, so here we just need to
|
||||
|
@ -880,8 +890,8 @@ let gInitializeTimerFunc = (deferredInitialization, mockPushHandler, mockWebSock
|
|||
let registeredPromise =
|
||||
MozLoopServiceInternal.registerWithLoopServer(
|
||||
LOOP_SESSION_TYPE.FXA, {
|
||||
calls: gPushHandler.registeredChannels[LoopCalls.channelIDs.FxA],
|
||||
rooms: gPushHandler.registeredChannels[LoopRooms.channelIDs.FxA]
|
||||
calls: gPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA],
|
||||
rooms: gPushHandler.registeredChannels[MozLoopService.channelIDs.roomsFxA]
|
||||
});
|
||||
registeredPromise.then(() => {
|
||||
deferredInitialization.resolve("initialized to logged-in status");
|
||||
|
@ -905,6 +915,17 @@ let gInitializeTimerFunc = (deferredInitialization, mockPushHandler, mockWebSock
|
|||
this.MozLoopService = {
|
||||
_DNSService: gDNSService,
|
||||
|
||||
get channelIDs() {
|
||||
// Channel ids that will be registered with the PushServer for notifications
|
||||
return {
|
||||
callsFxA: "25389583-921f-4169-a426-a4673658944b",
|
||||
callsGuest: "801f754b-686b-43ec-bd83-1419bbf58388",
|
||||
roomsFxA: "6add272a-d316-477c-8335-f00f73dfde71",
|
||||
roomsGuest: "19d3f799-a8f3-4328-9822-b7cd02765832",
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
set initializeTimerFunc(value) {
|
||||
gInitializeTimerFunc = value;
|
||||
},
|
||||
|
@ -1127,6 +1148,21 @@ this.MozLoopService = {
|
|||
return uuidgen.generateUUID().toString();
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a new non-global id
|
||||
*
|
||||
* @param {Function} notUnique [optional] This function will be
|
||||
* applied to test the generated id for uniqueness
|
||||
* in the callers domain.
|
||||
*/
|
||||
generateLocalID: function(notUnique = ((id) => {return false})) {
|
||||
do {
|
||||
var id = Date.now().toString(36) + Math.floor((Math.random() * 4096)).toString(16);
|
||||
}
|
||||
while (notUnique(id));
|
||||
return id;
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieves MozLoopService "do not disturb" value.
|
||||
*
|
||||
|
@ -1265,8 +1301,8 @@ this.MozLoopService = {
|
|||
return tokenData;
|
||||
}).then(tokenData => {
|
||||
return gRegisteredDeferred.promise.then(Task.async(function*() {
|
||||
let callsUrl = gPushHandler.registeredChannels[LoopCalls.channelIDs.FxA],
|
||||
roomsUrl = gPushHandler.registeredChannels[LoopRooms.channelIDs.FxA];
|
||||
let callsUrl = gPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA],
|
||||
roomsUrl = gPushHandler.registeredChannels[MozLoopService.channelIDs.roomsFxA];
|
||||
if (callsUrl && roomsUrl) {
|
||||
yield MozLoopServiceInternal.registerWithLoopServer(
|
||||
LOOP_SESSION_TYPE.FXA, {calls: callsUrl, rooms: roomsUrl});
|
||||
|
@ -1314,8 +1350,8 @@ this.MozLoopService = {
|
|||
log.debug("logOutFromFxA");
|
||||
let callsPushUrl, roomsPushUrl;
|
||||
if (gPushHandler) {
|
||||
callsPushUrl = gPushHandler.registeredChannels[LoopCalls.channelIDs.FxA];
|
||||
roomsPushUrl = gPushHandler.registeredChannels[LoopRooms.channelIDs.FxA];
|
||||
callsPushUrl = gPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA];
|
||||
roomsPushUrl = gPushHandler.registeredChannels[MozLoopService.channelIDs.roomsFxA];
|
||||
}
|
||||
try {
|
||||
if (callsPushUrl) {
|
||||
|
|
|
@ -232,7 +232,9 @@ loop.Client = (function($) {
|
|||
this.mozLoop.hawkRequest(this.mozLoop.LOOP_SESSION_TYPE.FXA,
|
||||
"/calls", "POST", {
|
||||
calleeId: calleeIds,
|
||||
callType: callType
|
||||
callType: callType,
|
||||
channel: this.mozLoop.appVersionInfo ?
|
||||
this.mozLoop.appVersionInfo.channel : "unknown"
|
||||
},
|
||||
function (err, responseText) {
|
||||
if (err) {
|
||||
|
|
|
@ -619,8 +619,6 @@ loop.conversation = (function(mozL10n) {
|
|||
navigator.mozLoop.releaseCallData(callId);
|
||||
});
|
||||
|
||||
document.body.classList.add(loop.shared.utils.getTargetPlatform());
|
||||
|
||||
React.renderComponent(AppControllerView({
|
||||
localRoomStore: localRoomStore,
|
||||
store: conversationStore,
|
||||
|
|
|
@ -619,8 +619,6 @@ loop.conversation = (function(mozL10n) {
|
|||
navigator.mozLoop.releaseCallData(callId);
|
||||
});
|
||||
|
||||
document.body.classList.add(loop.shared.utils.getTargetPlatform());
|
||||
|
||||
React.renderComponent(<AppControllerView
|
||||
localRoomStore={localRoomStore}
|
||||
store={conversationStore}
|
||||
|
|
|
@ -717,8 +717,11 @@ loop.panel = (function(_, mozL10n) {
|
|||
UserIdentity({displayName: displayName}),
|
||||
AvailabilityDropdown(null)
|
||||
),
|
||||
AuthLink(null),
|
||||
SettingsDropdown(null)
|
||||
React.DOM.div({className: "signin-details"},
|
||||
AuthLink(null),
|
||||
React.DOM.div({className: "footer-signin-separator"}),
|
||||
SettingsDropdown(null)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -748,7 +751,6 @@ loop.panel = (function(_, mozL10n) {
|
|||
dispatcher: dispatcher}
|
||||
), document.querySelector("#main"));
|
||||
|
||||
document.body.classList.add(loop.shared.utils.getTargetPlatform());
|
||||
document.body.setAttribute("dir", mozL10n.getDirection());
|
||||
|
||||
// Notify the window that we've finished initalization and initial layout
|
||||
|
|
|
@ -717,8 +717,11 @@ loop.panel = (function(_, mozL10n) {
|
|||
<UserIdentity displayName={displayName} />
|
||||
<AvailabilityDropdown />
|
||||
</div>
|
||||
<AuthLink />
|
||||
<SettingsDropdown />
|
||||
<div className="signin-details">
|
||||
<AuthLink />
|
||||
<div className="footer-signin-separator" />
|
||||
<SettingsDropdown />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -748,7 +751,6 @@ loop.panel = (function(_, mozL10n) {
|
|||
dispatcher={dispatcher}
|
||||
/>, document.querySelector("#main"));
|
||||
|
||||
document.body.classList.add(loop.shared.utils.getTargetPlatform());
|
||||
document.body.setAttribute("dir", mozL10n.getDirection());
|
||||
|
||||
// Notify the window that we've finished initalization and initial layout
|
||||
|
|
|
@ -358,12 +358,6 @@ p {
|
|||
color: rgba(51, 51, 51, .5);
|
||||
}
|
||||
|
||||
.mac p,
|
||||
.windows p,
|
||||
.linux p {
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
/* Web panel */
|
||||
|
||||
.info-panel {
|
||||
|
|
|
@ -268,7 +268,7 @@ body {
|
|||
|
||||
.dropdown-menu {
|
||||
position: absolute;
|
||||
top: -28px;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: #fdfdfd;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,.3);
|
||||
|
@ -345,6 +345,10 @@ body[dir=rtl] .dropdown-menu-item {
|
|||
.dnd-status {
|
||||
border: 1px solid transparent;
|
||||
padding: 2px 4px;
|
||||
margin: 0;
|
||||
/* Undo the start border + padding so that unhovered dnd-status is aligned
|
||||
as if there was no additional spacing. */
|
||||
-moz-margin-start: calc(-1px + -4px);
|
||||
font-size: .9em;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
|
@ -377,10 +381,7 @@ body[dir=rtl] .dropdown-menu-item {
|
|||
|
||||
.signin-link {
|
||||
flex: 2 1 auto;
|
||||
margin-top: 14px;
|
||||
border-right: 1px solid #aaa;
|
||||
padding-right: 1em;
|
||||
margin-right: 1em;
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
@ -390,6 +391,12 @@ body[dir=rtl] .dropdown-menu-item {
|
|||
color: #888;
|
||||
}
|
||||
|
||||
.footer-signin-separator {
|
||||
border-right: 1px solid #aaa;
|
||||
height: 16px;
|
||||
margin: 0 1em;
|
||||
}
|
||||
|
||||
/* Settings (gear) menu */
|
||||
|
||||
.button-settings {
|
||||
|
@ -413,7 +420,6 @@ body[dir=rtl] .dropdown-menu-item {
|
|||
}
|
||||
|
||||
.footer .button-settings {
|
||||
margin-top: 17px; /* used to align the gear icon with the availability dropdown menu inner text */
|
||||
opacity: .6; /* used to "grey" the icon a little */
|
||||
}
|
||||
|
||||
|
@ -459,10 +465,22 @@ body[dir=rtl] .dropdown-menu-item {
|
|||
flex-wrap: nowrap;
|
||||
justify-content: space-between;
|
||||
align-content: stretch;
|
||||
align-items: flex-start;
|
||||
align-items: center;
|
||||
font-size: 1em;
|
||||
border-top: 1px solid #D1D1D1;
|
||||
background-color: #eaeaea;
|
||||
color: #7f7f7f;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.footer .signin-details {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
-moz-margin-start: 5px;
|
||||
}
|
||||
|
||||
.footer .user-identity {
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
|
|
@ -29,26 +29,6 @@ loop.shared.utils = (function(mozL10n) {
|
|||
return date.toLocaleDateString(navigator.language, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for adding different styles to the panel
|
||||
* @returns {String} Corresponds to the client platform
|
||||
* */
|
||||
function getTargetPlatform() {
|
||||
var platform="unknown_platform";
|
||||
|
||||
if (navigator.platform.indexOf("Win") !== -1) {
|
||||
platform = "windows";
|
||||
}
|
||||
if (navigator.platform.indexOf("Mac") !== -1) {
|
||||
platform = "mac";
|
||||
}
|
||||
if (navigator.platform.indexOf("Linux") !== -1) {
|
||||
platform = "linux";
|
||||
}
|
||||
|
||||
return platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for getting a boolean preference. It will either use the browser preferences
|
||||
* (if navigator.mozLoop is defined) or try to get them from localStorage.
|
||||
|
@ -133,7 +113,6 @@ loop.shared.utils = (function(mozL10n) {
|
|||
Helper: Helper,
|
||||
composeCallUrlEmail: composeCallUrlEmail,
|
||||
formatDate: formatDate,
|
||||
getTargetPlatform: getTargetPlatform,
|
||||
getBoolPreference: getBoolPreference
|
||||
};
|
||||
})(document.mozL10n || navigator.mozL10n);
|
||||
|
|
|
@ -115,7 +115,7 @@ loop.StandaloneClient = (function($) {
|
|||
method: "POST",
|
||||
contentType: "application/json",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({callType: callType})
|
||||
data: JSON.stringify({callType: callType, channel: "standalone"})
|
||||
});
|
||||
|
||||
req.done(function(sessionData) {
|
||||
|
|
|
@ -272,7 +272,23 @@ describe("loop.Client", function() {
|
|||
mozLoop.LOOP_SESSION_TYPE.FXA,
|
||||
"/calls",
|
||||
"POST",
|
||||
{ calleeId: calleeIds, callType: callType }
|
||||
{ calleeId: calleeIds, callType: callType, channel: "unknown" }
|
||||
);
|
||||
});
|
||||
|
||||
it("should include the channel when defined", function() {
|
||||
mozLoop.appVersionInfo = {
|
||||
channel: "beta"
|
||||
};
|
||||
|
||||
client.setupOutgoingCall(calleeIds, callType);
|
||||
|
||||
sinon.assert.calledOnce(hawkRequestStub);
|
||||
sinon.assert.calledWith(hawkRequestStub,
|
||||
mozLoop.LOOP_SESSION_TYPE.FXA,
|
||||
"/calls",
|
||||
"POST",
|
||||
{ calleeId: calleeIds, callType: callType, channel: "beta" }
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -256,8 +256,8 @@ add_task(function* basicAuthorizationAndRegistration() {
|
|||
|
||||
// Normally the same pushUrl would be registered but we change it in the test
|
||||
// to be able to check for success on the second registration.
|
||||
mockPushHandler.registeredChannels[LoopCalls.channelIDs.FxA] = "https://localhost/pushUrl/fxa-calls";
|
||||
mockPushHandler.registeredChannels[LoopRooms.channelIDs.FxA] = "https://localhost/pushUrl/fxa-rooms";
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA] = "https://localhost/pushUrl/fxa-calls";
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.roomsFxA] = "https://localhost/pushUrl/fxa-rooms";
|
||||
|
||||
statusChangedPromise = promiseObserverNotified("loop-status-changed");
|
||||
yield loadLoopPanel({loopURL: BASE_URL, stayOnline: true});
|
||||
|
@ -333,8 +333,8 @@ add_task(function* loginWithParams401() {
|
|||
add_task(function* logoutWithIncorrectPushURL() {
|
||||
yield resetFxA();
|
||||
let pushURL = "http://www.example.com/";
|
||||
mockPushHandler.registeredChannels[LoopCalls.channelIDs.FxA] = pushURL;
|
||||
mockPushHandler.registeredChannels[LoopRooms.channelIDs.FxA] = pushURL;
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA] = pushURL;
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.roomsFxA] = pushURL;
|
||||
|
||||
// Create a fake FxA hawk session token
|
||||
const fxASessionPref = MozLoopServiceInternal.getSessionTokenPrefName(LOOP_SESSION_TYPE.FXA);
|
||||
|
@ -343,7 +343,7 @@ add_task(function* logoutWithIncorrectPushURL() {
|
|||
yield MozLoopServiceInternal.registerWithLoopServer(LOOP_SESSION_TYPE.FXA, {calls: pushURL});
|
||||
let registrationResponse = yield promiseOAuthGetRegistration(BASE_URL);
|
||||
ise(registrationResponse.response.simplePushURLs.calls, pushURL, "Check registered push URL");
|
||||
mockPushHandler.registeredChannels[LoopCalls.channelIDs.FxA] = "http://www.example.com/invalid";
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA] = "http://www.example.com/invalid";
|
||||
let caught = false;
|
||||
yield MozLoopService.logOutFromFxA().catch((error) => {
|
||||
caught = true;
|
||||
|
@ -357,7 +357,7 @@ add_task(function* logoutWithIncorrectPushURL() {
|
|||
add_task(function* logoutWithNoPushURL() {
|
||||
yield resetFxA();
|
||||
let pushURL = "http://www.example.com/";
|
||||
mockPushHandler.registeredChannels[LoopCalls.channelIDs.FxA] = pushURL;
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA] = pushURL;
|
||||
|
||||
// Create a fake FxA hawk session token
|
||||
const fxASessionPref = MozLoopServiceInternal.getSessionTokenPrefName(LOOP_SESSION_TYPE.FXA);
|
||||
|
@ -366,8 +366,8 @@ add_task(function* logoutWithNoPushURL() {
|
|||
yield MozLoopServiceInternal.registerWithLoopServer(LOOP_SESSION_TYPE.FXA, {calls: pushURL});
|
||||
let registrationResponse = yield promiseOAuthGetRegistration(BASE_URL);
|
||||
ise(registrationResponse.response.simplePushURLs.calls, pushURL, "Check registered push URL");
|
||||
mockPushHandler.registeredChannels[LoopCalls.channelIDs.FxA] = null;
|
||||
mockPushHandler.registeredChannels[LoopRooms.channelIDs.FxA] = null;
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.callsFxA] = null;
|
||||
mockPushHandler.registeredChannels[MozLoopService.channelIDs.roomsFxA] = null;
|
||||
yield MozLoopService.logOutFromFxA();
|
||||
checkLoggedOutState();
|
||||
registrationResponse = yield promiseOAuthGetRegistration(BASE_URL);
|
||||
|
|
|
@ -128,7 +128,7 @@ describe("loop.StandaloneClient", function() {
|
|||
expect(requests).to.have.length.of(1);
|
||||
expect(requests[0].url).to.be.equal("http://fake.api/calls/fake");
|
||||
expect(requests[0].method).to.be.equal("POST");
|
||||
expect(requests[0].requestBody).to.be.equal('{"callType":"audio"}');
|
||||
expect(requests[0].requestBody).to.be.equal('{"callType":"audio","channel":"standalone"}');
|
||||
});
|
||||
|
||||
it("should receive call data for the given call", function() {
|
||||
|
|
|
@ -10,6 +10,7 @@ Cu.import("resource://testing-common/httpd.js");
|
|||
Cu.import("resource:///modules/loop/MozLoopService.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
Cu.import("resource:///modules/loop/LoopCalls.jsm");
|
||||
Cu.import("resource:///modules/loop/LoopRooms.jsm");
|
||||
const { MozLoopServiceInternal } = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "MozLoopPushHandler",
|
||||
|
|
|
@ -35,7 +35,7 @@ add_test(function test_busy_2guest_calls() {
|
|||
opened++;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.Guest);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsGuest);
|
||||
|
||||
waitForCondition(() => {return actionReceived && opened > 0}).then(() => {
|
||||
do_check_true(opened === 1, "should open only one chat window");
|
||||
|
@ -58,8 +58,8 @@ add_test(function test_busy_1fxa_1guest_calls() {
|
|||
opened++;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.FxA);
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.Guest);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsFxA);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsGuest);
|
||||
|
||||
waitForCondition(() => {return actionReceived && opened > 0}).then(() => {
|
||||
do_check_true(opened === 1, "should open only one chat window");
|
||||
|
@ -82,7 +82,7 @@ add_test(function test_busy_2fxa_calls() {
|
|||
opened++;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.FxA);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsFxA);
|
||||
|
||||
waitForCondition(() => {return actionReceived && opened > 0}).then(() => {
|
||||
do_check_true(opened === 1, "should open only one chat window");
|
||||
|
@ -105,8 +105,8 @@ add_test(function test_busy_1guest_1fxa_calls() {
|
|||
opened++;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.Guest);
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.FxA);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsGuest);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsFxA);
|
||||
|
||||
waitForCondition(() => {return actionReceived && opened > 0}).then(() => {
|
||||
do_check_true(opened === 1, "should open only one chat window");
|
||||
|
|
|
@ -37,7 +37,7 @@ add_test(function test_do_not_disturb_disabled_should_open_chat_window() {
|
|||
opened = true;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.Guest);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsGuest);
|
||||
|
||||
waitForCondition(function() opened).then(() => {
|
||||
run_next_test();
|
||||
|
@ -56,7 +56,7 @@ add_test(function test_do_not_disturb_enabled_shouldnt_open_chat_window() {
|
|||
opened = true;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.Guest);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsGuest);
|
||||
|
||||
do_timeout(500, function() {
|
||||
do_check_false(opened, "should not open a chat window");
|
||||
|
|
|
@ -16,7 +16,7 @@ add_test(function test_openChatWindow_on_notification() {
|
|||
opened = true;
|
||||
};
|
||||
|
||||
mockPushHandler.notify(1, LoopCalls.channelIDs.Guest);
|
||||
mockPushHandler.notify(1, MozLoopService.channelIDs.callsGuest);
|
||||
|
||||
waitForCondition(function() opened).then(() => {
|
||||
do_check_true(opened, "should open a chat window");
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
/* 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/. */
|
||||
|
||||
Cu.import("resource://services-common/utils.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Chat",
|
||||
"resource:///modules/Chat.jsm");
|
||||
let hasTheseProps = function(a, b) {
|
||||
for (let prop in a) {
|
||||
if (a[prop] != b[prop]) {
|
||||
do_print("hasTheseProps fail: prop = " + prop);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
let openChatOrig = Chat.open;
|
||||
|
||||
add_test(function test_getAllRooms() {
|
||||
|
||||
let roomList = [
|
||||
{ roomToken: "_nxD4V4FflQ",
|
||||
roomName: "First Room Name",
|
||||
roomUrl: "http://localhost:3000/rooms/_nxD4V4FflQ",
|
||||
maxSize: 2,
|
||||
currSize: 0,
|
||||
ctime: 1405517546 },
|
||||
{ roomToken: "QzBbvGmIZWU",
|
||||
roomName: "Second Room Name",
|
||||
roomUrl: "http://localhost:3000/rooms/QzBbvGmIZWU",
|
||||
maxSize: 2,
|
||||
currSize: 0,
|
||||
ctime: 140551741 },
|
||||
{ roomToken: "3jKS_Els9IU",
|
||||
roomName: "Third Room Name",
|
||||
roomUrl: "http://localhost:3000/rooms/3jKS_Els9IU",
|
||||
maxSize: 3,
|
||||
clientMaxSize: 2,
|
||||
currSize: 1,
|
||||
ctime: 1405518241 }
|
||||
]
|
||||
|
||||
let roomDetail = {
|
||||
roomName: "First Room Name",
|
||||
roomUrl: "http://localhost:3000/rooms/_nxD4V4FflQ",
|
||||
roomOwner: "Alexis",
|
||||
maxSize: 2,
|
||||
clientMaxSize: 2,
|
||||
creationTime: 1405517546,
|
||||
expiresAt: 1405534180,
|
||||
participants: [
|
||||
{ displayName: "Alexis", account: "alexis@example.com", roomConnectionId: "2a1787a6-4a73-43b5-ae3e-906ec1e763cb" },
|
||||
{ displayName: "Adam", roomConnectionId: "781f012b-f1ea-4ce1-9105-7cfc36fb4ec7" }
|
||||
]
|
||||
}
|
||||
|
||||
loopServer.registerPathHandler("/rooms", (request, response) => {
|
||||
response.setStatusLine(null, 200, "OK");
|
||||
response.write(JSON.stringify(roomList));
|
||||
response.processAsync();
|
||||
response.finish();
|
||||
});
|
||||
|
||||
let returnRoomDetails = function(response, roomName) {
|
||||
roomDetail.roomName = roomName;
|
||||
response.setStatusLine(null, 200, "OK");
|
||||
response.write(JSON.stringify(roomDetail));
|
||||
response.processAsync();
|
||||
response.finish();
|
||||
}
|
||||
|
||||
loopServer.registerPathHandler("/rooms/_nxD4V4FflQ", (request, response) => {
|
||||
returnRoomDetails(response, "First Room Name");
|
||||
});
|
||||
|
||||
loopServer.registerPathHandler("/rooms/QzBbvGmIZWU", (request, response) => {
|
||||
returnRoomDetails(response, "Second Room Name");
|
||||
});
|
||||
|
||||
loopServer.registerPathHandler("/rooms/3jKS_Els9IU", (request, response) => {
|
||||
returnRoomDetails(response, "Third Room Name");
|
||||
});
|
||||
|
||||
MozLoopService.register(mockPushHandler).then(() => {
|
||||
|
||||
LoopRooms.getAll((error, rooms) => {
|
||||
do_check_false(error);
|
||||
do_check_true(rooms);
|
||||
do_check_eq(rooms.length, 3);
|
||||
do_check_eq(rooms[0].roomName, "First Room Name");
|
||||
do_check_eq(rooms[1].roomName, "Second Room Name");
|
||||
do_check_eq(rooms[2].roomName, "Third Room Name");
|
||||
|
||||
let room = rooms[0];
|
||||
do_check_true(room.localRoomID);
|
||||
do_check_true(hasTheseProps(roomList[0], room));
|
||||
delete roomDetail.roomName;
|
||||
delete room.participants;
|
||||
delete roomDetail.participants;
|
||||
do_check_true(hasTheseProps(roomDetail, room));
|
||||
|
||||
LoopRooms.getRoomData(room.localRoomID, (error, roomData) => {
|
||||
do_check_false(error);
|
||||
do_check_true(hasTheseProps(room, roomData));
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function run_test()
|
||||
{
|
||||
setupFakeLoopServer();
|
||||
mockPushHandler.registrationPushURL = kEndPointUrl;
|
||||
|
||||
loopServer.registerPathHandler("/registration", (request, response) => {
|
||||
response.setStatusLine(null, 200, "OK");
|
||||
response.processAsync();
|
||||
response.finish();
|
||||
});
|
||||
|
||||
do_register_cleanup(function() {
|
||||
// Revert original Chat.open implementation
|
||||
Chat.open = openChatOrig;
|
||||
});
|
||||
|
||||
run_next_test();
|
||||
}
|
|
@ -21,3 +21,4 @@ skip-if = toolkit == 'gonk'
|
|||
[test_loopservice_token_send.js]
|
||||
[test_loopservice_token_validation.js]
|
||||
[test_loopservice_busy.js]
|
||||
[test_rooms_getdata.js]
|
||||
|
|
|
@ -21,5 +21,6 @@ navigator.mozLoop = {
|
|||
callback(null, []);
|
||||
},
|
||||
on: function() {}
|
||||
}
|
||||
},
|
||||
fxAEnabled: true
|
||||
};
|
||||
|
|
|
@ -537,10 +537,7 @@
|
|||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
var body = document.body;
|
||||
body.className = loop.shared.utils.getTargetPlatform();
|
||||
|
||||
React.renderComponent(App(null), body);
|
||||
React.renderComponent(App(null), document.body);
|
||||
|
||||
_renderComponentsInIframes();
|
||||
|
||||
|
|
|
@ -537,10 +537,7 @@
|
|||
}
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
var body = document.body;
|
||||
body.className = loop.shared.utils.getTargetPlatform();
|
||||
|
||||
React.renderComponent(<App />, body);
|
||||
React.renderComponent(<App />, document.body);
|
||||
|
||||
_renderComponentsInIframes();
|
||||
|
||||
|
|
|
@ -52,6 +52,20 @@
|
|||
|
||||
<!-- Short Description -->
|
||||
<div id="errorTrailerDesc">
|
||||
<div>
|
||||
<div class="radioRestoreContainer">
|
||||
<input class="radioRestoreButton" id="radioRestoreAll" type="radio"
|
||||
name="restore" checked="checked"/>
|
||||
<label class="radioRestoreLabel" for="radioRestoreAll">&welcomeback2.label.restoreAll;</label>
|
||||
</div>
|
||||
|
||||
<div class="radioRestoreContainer">
|
||||
<input class="radioRestoreButton" id="radioRestoreChoose" type="radio"
|
||||
name="restore"/>
|
||||
<label class="radioRestoreLabel" for="radioRestoreChoose">&welcomeback2.label.restoreSome;</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="tabList" flex="1" seltype="single" hidecolumnpicker="true"
|
||||
onclick="onListClick(event);" onkeydown="onListKeyDown(event);"
|
||||
|
|
|
@ -9,6 +9,7 @@ const Cr = Components.results;
|
|||
const Cu = Components.utils;
|
||||
|
||||
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
const POLARIS_ENABLED = "browser.polaris.enabled";
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
@ -397,6 +398,13 @@ BrowserGlue.prototype = {
|
|||
Services.obs.removeObserver(this, "browser-search-service");
|
||||
this._syncSearchEngines();
|
||||
break;
|
||||
case "nsPref:changed":
|
||||
if (data == POLARIS_ENABLED) {
|
||||
let enabled = Services.prefs.getBoolPref(POLARIS_ENABLED);
|
||||
Services.prefs.setBoolPref("privacy.donottrackheader.enabled", enabled);
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", enabled);
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.ui.enabled", enabled);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -443,6 +451,9 @@ BrowserGlue.prototype = {
|
|||
#endif
|
||||
os.addObserver(this, "browser-search-engine-modified", false);
|
||||
os.addObserver(this, "browser-search-service", false);
|
||||
#ifdef NIGHTLY_BUILD
|
||||
Services.prefs.addObserver(POLARIS_ENABLED, this, false);
|
||||
#endif
|
||||
},
|
||||
|
||||
// cleanup (called on application shutdown)
|
||||
|
@ -483,6 +494,9 @@ BrowserGlue.prototype = {
|
|||
os.removeObserver(this, "browser-search-service");
|
||||
// may have already been removed by the observer
|
||||
} catch (ex) {}
|
||||
#ifdef NIGHTLY_BUILD
|
||||
Services.prefs.removeObserver(POLARIS_ENABLED, this);
|
||||
#endif
|
||||
},
|
||||
|
||||
_onAppDefaults: function BG__onAppDefaults() {
|
||||
|
|
|
@ -20,6 +20,14 @@ window.onload = function() {
|
|||
anchor.setAttribute("href", baseURL + "troubleshooting");
|
||||
}
|
||||
|
||||
// wire up click handlers for the radio buttons if they exist.
|
||||
for (let radioId of ["radioRestoreAll", "radioRestoreChoose"]) {
|
||||
let button = document.getElementById(radioId);
|
||||
if (button) {
|
||||
button.addEventListener("click", updateTabListVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
// the crashed session state is kept inside a textbox so that SessionStore picks it up
|
||||
// (for when the tab is closed or the session crashes right again)
|
||||
var sessionData = document.getElementById("sessionData");
|
||||
|
@ -40,7 +48,17 @@ window.onload = function() {
|
|||
document.getElementById("errorTryAgain").focus();
|
||||
};
|
||||
|
||||
function isTreeViewVisible() {
|
||||
let tabList = document.getElementById("tabList");
|
||||
return tabList.hasAttribute("available");
|
||||
}
|
||||
|
||||
function initTreeView() {
|
||||
// If we aren't visible we initialize as we are made visible (and it's OK
|
||||
// to initialize multiple times)
|
||||
if (!isTreeViewVisible()) {
|
||||
return;
|
||||
}
|
||||
var tabList = document.getElementById("tabList");
|
||||
var winLabel = tabList.getAttribute("_window_label");
|
||||
|
||||
|
@ -75,31 +93,42 @@ function initTreeView() {
|
|||
}
|
||||
|
||||
// User actions
|
||||
function updateTabListVisibility() {
|
||||
let tabList = document.getElementById("tabList");
|
||||
if (document.getElementById("radioRestoreChoose").checked) {
|
||||
tabList.setAttribute("available", "true");
|
||||
} else {
|
||||
tabList.removeAttribute("available");
|
||||
}
|
||||
initTreeView();
|
||||
}
|
||||
|
||||
function restoreSession() {
|
||||
document.getElementById("errorTryAgain").disabled = true;
|
||||
|
||||
if (!gTreeData.some(aItem => aItem.checked)) {
|
||||
// This should only be possible when we have no "cancel" button, and thus
|
||||
// the "Restore session" button always remains enabled. In that case and
|
||||
// when nothing is selected, we just want a new session.
|
||||
startNewSession();
|
||||
return;
|
||||
}
|
||||
if (isTreeViewVisible()) {
|
||||
if (!gTreeData.some(aItem => aItem.checked)) {
|
||||
// This should only be possible when we have no "cancel" button, and thus
|
||||
// the "Restore session" button always remains enabled. In that case and
|
||||
// when nothing is selected, we just want a new session.
|
||||
startNewSession();
|
||||
return;
|
||||
}
|
||||
|
||||
// remove all unselected tabs from the state before restoring it
|
||||
var ix = gStateObject.windows.length - 1;
|
||||
for (var t = gTreeData.length - 1; t >= 0; t--) {
|
||||
if (treeView.isContainer(t)) {
|
||||
if (gTreeData[t].checked === 0)
|
||||
// this window will be restored partially
|
||||
gStateObject.windows[ix].tabs =
|
||||
gStateObject.windows[ix].tabs.filter(function(aTabData, aIx)
|
||||
gTreeData[t].tabs[aIx].checked);
|
||||
else if (!gTreeData[t].checked)
|
||||
// this window won't be restored at all
|
||||
gStateObject.windows.splice(ix, 1);
|
||||
ix--;
|
||||
// remove all unselected tabs from the state before restoring it
|
||||
var ix = gStateObject.windows.length - 1;
|
||||
for (var t = gTreeData.length - 1; t >= 0; t--) {
|
||||
if (treeView.isContainer(t)) {
|
||||
if (gTreeData[t].checked === 0)
|
||||
// this window will be restored partially
|
||||
gStateObject.windows[ix].tabs =
|
||||
gStateObject.windows[ix].tabs.filter(function(aTabData, aIx)
|
||||
gTreeData[t].tabs[aIx].checked);
|
||||
else if (!gTreeData[t].checked)
|
||||
// this window won't be restored at all
|
||||
gStateObject.windows.splice(ix, 1);
|
||||
ix--;
|
||||
}
|
||||
}
|
||||
}
|
||||
var stateString = JSON.stringify(gStateObject);
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<tree xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="tabList" flex="1" seltype="single" hidecolumnpicker="true"
|
||||
onclick="onListClick(event);" onkeydown="onListKeyDown(event);"
|
||||
_window_label="&restorepage.windowLabel;">
|
||||
available="true" _window_label="&restorepage.windowLabel;">
|
||||
<treecols>
|
||||
<treecol cycler="true" id="restore" type="checkbox" label="&restorepage.restoreHeader;"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
|
|
|
@ -2,3 +2,5 @@
|
|||
|
||||
[browser_bug538331.js]
|
||||
skip-if = e10s # Bug ?????? - child process crash, but only when run as part of the suite (ie, probably not actually this tests fault!?)
|
||||
|
||||
[browser_polaris_prefs.js]
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
const POLARIS_ENABLED = "browser.polaris.enabled";
|
||||
const PREF_DNT = "privacy.donottrackheader.enabled";
|
||||
const PREF_TP = "privacy.trackingprotection.enabled";
|
||||
const PREF_TPUI = "privacy.trackingprotection.ui.enabled";
|
||||
|
||||
let prefs = [PREF_DNT, PREF_TP, PREF_TPUI];
|
||||
|
||||
function spinEventLoop() {
|
||||
return new Promise((resolve) => executeSoon(resolve));
|
||||
};
|
||||
|
||||
// Spin event loop before checking so that polaris pref observer can set
|
||||
// dependent prefs.
|
||||
function* assertPref(pref, enabled) {
|
||||
yield spinEventLoop();
|
||||
let prefEnabled = Services.prefs.getBoolPref(pref);
|
||||
Assert.equal(prefEnabled, enabled, "Checking state of pref " + pref + ".");
|
||||
};
|
||||
|
||||
function* testPrefs(test) {
|
||||
for (let pref of prefs) {
|
||||
yield test(pref);
|
||||
}
|
||||
}
|
||||
|
||||
add_task(function* test_default_values() {
|
||||
Assert.ok(!Services.prefs.getBoolPref(POLARIS_ENABLED), POLARIS_ENABLED + " is disabled by default.");
|
||||
Assert.ok(!Services.prefs.getBoolPref(PREF_TPUI), PREF_TPUI + "is disabled by default.");
|
||||
});
|
||||
|
||||
add_task(function* test_changing_pref_changes_tracking() {
|
||||
function* testPref(pref) {
|
||||
Services.prefs.setBoolPref(POLARIS_ENABLED, true);
|
||||
yield assertPref(pref, true);
|
||||
Services.prefs.setBoolPref(POLARIS_ENABLED, false);
|
||||
yield assertPref(pref, false);
|
||||
Services.prefs.setBoolPref(POLARIS_ENABLED, true);
|
||||
yield assertPref(pref, true);
|
||||
}
|
||||
yield testPrefs(testPref);
|
||||
});
|
||||
|
||||
add_task(function* test_prefs_can_be_changed_individually() {
|
||||
function* testPref(pref) {
|
||||
Services.prefs.setBoolPref(POLARIS_ENABLED, true);
|
||||
yield assertPref(pref, true);
|
||||
Services.prefs.setBoolPref(pref, false);
|
||||
yield assertPref(pref, false);
|
||||
yield assertPref(POLARIS_ENABLED, true);
|
||||
Services.prefs.setBoolPref(POLARIS_ENABLED, false);
|
||||
yield assertPref(pref, false);
|
||||
Services.prefs.setBoolPref(pref, true);
|
||||
yield assertPref(pref, true);
|
||||
yield assertPref(POLARIS_ENABLED, false);
|
||||
}
|
||||
yield testPrefs(testPref);
|
||||
});
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "gcc.tar.xz"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "gcc.tar.xz"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"filename": "clang.tar.bz2"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 168202,
|
||||
"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
|
||||
"size": 168320,
|
||||
"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ skip-if = true # Bug 1047124
|
|||
skip-if = true # Bug 1047124
|
||||
[browser_profiler_recording-selected-02.js]
|
||||
skip-if = true # Bug 1047124
|
||||
[browser_profiler_recording-selected-03.js]
|
||||
skip-if = true # Bug 1047124
|
||||
[browser_profiler_recording-utils.js]
|
||||
skip-if = true # Bug 1047124
|
||||
[browser_profiler_recordings-clear.js]
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests if the profiler UI does not forget that recording is active when
|
||||
* selected recording changes. Bug 1060885.
|
||||
*/
|
||||
|
||||
let test = Task.async(function*() {
|
||||
let [target, debuggee, panel] = yield initFrontend(SIMPLE_URL);
|
||||
let { $, EVENTS, RecordingsListView, ProfileView } = panel.panelWin;
|
||||
|
||||
yield startRecording(panel);
|
||||
yield stopRecording(panel, { waitForDisplay: true });
|
||||
|
||||
yield startRecording(panel);
|
||||
yield stopRecording(panel, { waitForDisplay: true });
|
||||
|
||||
yield startRecording(panel);
|
||||
|
||||
info("Selecting recording #0 and waiting for it to be displayed.");
|
||||
let selected = panel.panelWin.once(EVENTS.RECORDING_DISPLAYED);
|
||||
RecordingsListView.selectedIndex = 0;
|
||||
yield selected;
|
||||
|
||||
ok($("#record-button").hasAttribute("checked"),
|
||||
"Button is still checked after selecting another item.");
|
||||
|
||||
ok(!$("#record-button").hasAttribute("locked"),
|
||||
"Button is not locked after selecting another item.");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
});
|
|
@ -150,9 +150,10 @@ function* stopRecording(panel, { waitForDisplay }) {
|
|||
|
||||
if (waitForDisplay) {
|
||||
yield displayed;
|
||||
|
||||
ok(!button.hasAttribute("checked"),
|
||||
"The record button should not be checked anymore.");
|
||||
if (!win.RecordingsListView.getItemForPredicate(e => e.isRecording)) {
|
||||
ok(!button.hasAttribute("checked"),
|
||||
"The record button should not be checked anymore.");
|
||||
}
|
||||
ok(!button.hasAttribute("locked"),
|
||||
"The record button should not be locked anymore.");
|
||||
}
|
||||
|
|
|
@ -202,7 +202,12 @@ let RecordingsListView = Heritage.extend(WidgetMethods, {
|
|||
yield ProfileView.addTabAndPopulate(recordingData, 0, durationMillis);
|
||||
ProfileView.showTabbedBrowser();
|
||||
|
||||
$("#record-button").removeAttribute("checked");
|
||||
// Only clear the checked state if there's nothing recording.
|
||||
if (!this.getItemForPredicate(e => e.isRecording)) {
|
||||
$("#record-button").removeAttribute("checked");
|
||||
}
|
||||
|
||||
// But don't leave it locked in any case.
|
||||
$("#record-button").removeAttribute("locked");
|
||||
|
||||
window.emit(EVENTS.RECORDING_DISPLAYED);
|
||||
|
|
|
@ -57,7 +57,7 @@ function test() {
|
|||
|
||||
// Create an ArrayBuffer of 80 bytes to test TypedArrays. 80 bytes is
|
||||
// enough to get 10 items in all different TypedArrays.
|
||||
jsterm.execute("let buf = ArrayBuffer(80);");
|
||||
jsterm.execute("let buf = new ArrayBuffer(80);");
|
||||
|
||||
// Array
|
||||
yield testNotSorted("Array(0,1,2,3,4,5,6,7,8,9,10)");
|
||||
|
@ -66,7 +66,7 @@ function test() {
|
|||
|
||||
// Typed arrays.
|
||||
for (let type of typedArrayTypes) {
|
||||
yield testNotSorted(type + "(buf)");
|
||||
yield testNotSorted("new " + type + "(buf)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ const Cu = Components.utils;
|
|||
Cu.import('resource:///modules/devtools/gDevTools.jsm');
|
||||
const {require} = Cu.import('resource://gre/modules/devtools/Loader.jsm', {}).devtools;
|
||||
const {Services} = Cu.import('resource://gre/modules/Services.jsm');
|
||||
const {Devices} = Cu.import("resource://gre/modules/devtools/Devices.jsm");
|
||||
const {AppManager} = require('devtools/webide/app-manager');
|
||||
const {AppActorFront} = require('devtools/app-actor-front');
|
||||
const {Connection} = require('devtools/client/connection-manager');
|
||||
|
@ -227,8 +226,7 @@ let Monitor = {
|
|||
*/
|
||||
pollB2GInfo: function() {
|
||||
if (AppManager.selectedRuntime) {
|
||||
let id = AppManager.selectedRuntime.id;
|
||||
let device = Devices.getByName(id);
|
||||
let device = AppManager.selectedRuntime.device;
|
||||
if (device && device.shell) {
|
||||
device.shell('b2g-info').then(s => {
|
||||
let lines = s.split('\n');
|
||||
|
|
|
@ -35,12 +35,6 @@
|
|||
<input data-pref="devtools.webide.templatesURL"/>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label title="&prefs_options_enablelocalruntime_tooltip;">
|
||||
<input type="checkbox" data-pref="devtools.webide.enableLocalRuntime"/>
|
||||
<span>&prefs_options_enablelocalruntime;</span>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label title="&prefs_options_rememberlastproject_tooltip;">
|
||||
<input type="checkbox" data-pref="devtools.webide.restoreLastProject"/>
|
||||
|
|
|
@ -7,8 +7,7 @@ const {Services} = Cu.import("resource://gre/modules/Services.jsm");
|
|||
const {require} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
|
||||
const {AppManager} = require("devtools/webide/app-manager");
|
||||
const {Connection} = require("devtools/client/connection-manager");
|
||||
const {Devices} = Cu.import("resource://gre/modules/devtools/Devices.jsm");
|
||||
const {USBRuntime} = require("devtools/webide/runtimes");
|
||||
const {RuntimeTypes} = require("devtools/webide/runtimes");
|
||||
const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties");
|
||||
|
||||
window.addEventListener("load", function onLoad() {
|
||||
|
@ -86,8 +85,8 @@ function CheckLockState() {
|
|||
AppManager.connection.status == Connection.Status.CONNECTED) {
|
||||
|
||||
// ADB check
|
||||
if (AppManager.selectedRuntime instanceof USBRuntime) {
|
||||
let device = Devices.getByName(AppManager.selectedRuntime.id);
|
||||
if (AppManager.selectedRuntime.type === RuntimeTypes.USB) {
|
||||
let device = AppManager.selectedRuntime.device;
|
||||
if (device && device.summonRoot) {
|
||||
device.isRoot().then(isRoot => {
|
||||
if (isRoot) {
|
||||
|
@ -127,16 +126,16 @@ function CheckLockState() {
|
|||
}
|
||||
|
||||
function EnableCertApps() {
|
||||
let device = Devices.getByName(AppManager.selectedRuntime.id);
|
||||
let device = AppManager.selectedRuntime.device;
|
||||
device.shell(
|
||||
"stop b2g && " +
|
||||
"cd /data/b2g/mozilla/*.default/ && " +
|
||||
"echo 'user_pref(\"devtools.debugger.forbid-certified-apps\", false);' >> prefs.js && " +
|
||||
"start b2g"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function RootADB() {
|
||||
let device = Devices.getByName(AppManager.selectedRuntime.id);
|
||||
let device = AppManager.selectedRuntime.device;
|
||||
device.summonRoot().then(CheckLockState, (e) => console.error(e));
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ const {GetAvailableAddons} = require("devtools/webide/addons");
|
|||
const {GetTemplatesJSON, GetAddonsJSON} = require("devtools/webide/remote-resources");
|
||||
const utils = require("devtools/webide/utils");
|
||||
const Telemetry = require("devtools/shared/telemetry");
|
||||
const {RuntimeScanners, WiFiScanner} = require("devtools/webide/runtimes");
|
||||
|
||||
const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties");
|
||||
|
||||
|
@ -148,7 +149,10 @@ let UI = {
|
|||
case "list-tabs-response":
|
||||
this.updateCommands();
|
||||
break;
|
||||
case "runtime":
|
||||
case "runtime-details":
|
||||
this.updateRuntimeButton();
|
||||
break;
|
||||
case "runtime-changed":
|
||||
this.updateRuntimeButton();
|
||||
this.saveLastConnectedRuntime();
|
||||
break;
|
||||
|
@ -305,17 +309,17 @@ let UI = {
|
|||
/********** RUNTIME **********/
|
||||
|
||||
updateRuntimeList: function() {
|
||||
let wifiHeaderNode = document.querySelector("#runtime-header-wifi-devices");
|
||||
if (AppManager.isWiFiScanningEnabled) {
|
||||
let wifiHeaderNode = document.querySelector("#runtime-header-wifi");
|
||||
if (WiFiScanner.allowed) {
|
||||
wifiHeaderNode.removeAttribute("hidden");
|
||||
} else {
|
||||
wifiHeaderNode.setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
let USBListNode = document.querySelector("#runtime-panel-usbruntime");
|
||||
let WiFiListNode = document.querySelector("#runtime-panel-wifi-devices");
|
||||
let simulatorListNode = document.querySelector("#runtime-panel-simulators");
|
||||
let customListNode = document.querySelector("#runtime-panel-custom");
|
||||
let usbListNode = document.querySelector("#runtime-panel-usb");
|
||||
let wifiListNode = document.querySelector("#runtime-panel-wifi");
|
||||
let simulatorListNode = document.querySelector("#runtime-panel-simulator");
|
||||
let otherListNode = document.querySelector("#runtime-panel-other");
|
||||
|
||||
let noHelperNode = document.querySelector("#runtime-panel-noadbhelper");
|
||||
let noUSBNode = document.querySelector("#runtime-panel-nousbdevice");
|
||||
|
@ -326,25 +330,27 @@ let UI = {
|
|||
noHelperNode.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
if (AppManager.runtimeList.usb.length == 0 && Devices.helperAddonInstalled) {
|
||||
let runtimeList = AppManager.runtimeList;
|
||||
|
||||
if (runtimeList.usb.length === 0 && Devices.helperAddonInstalled) {
|
||||
noUSBNode.removeAttribute("hidden");
|
||||
} else {
|
||||
noUSBNode.setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
for (let [type, parent] of [
|
||||
["usb", USBListNode],
|
||||
["wifi", WiFiListNode],
|
||||
["usb", usbListNode],
|
||||
["wifi", wifiListNode],
|
||||
["simulator", simulatorListNode],
|
||||
["custom", customListNode],
|
||||
["other", otherListNode],
|
||||
]) {
|
||||
while (parent.hasChildNodes()) {
|
||||
parent.firstChild.remove();
|
||||
}
|
||||
for (let runtime of AppManager.runtimeList[type]) {
|
||||
for (let runtime of runtimeList[type]) {
|
||||
let panelItemNode = document.createElement("toolbarbutton");
|
||||
panelItemNode.className = "panel-item runtime-panel-item-" + type;
|
||||
panelItemNode.setAttribute("label", runtime.getName());
|
||||
panelItemNode.setAttribute("label", runtime.name);
|
||||
parent.appendChild(panelItemNode);
|
||||
let r = runtime;
|
||||
panelItemNode.addEventListener("click", () => {
|
||||
|
@ -366,18 +372,18 @@ let UI = {
|
|||
|
||||
type = type.toLowerCase();
|
||||
|
||||
// Local connection is mapped to AppManager.runtimeList.custom array
|
||||
// Local connection is mapped to AppManager.runtimeList.other array
|
||||
if (type == "local") {
|
||||
type = "custom";
|
||||
type = "other";
|
||||
}
|
||||
|
||||
// We support most runtimes except simulator, that needs to be manually
|
||||
// launched
|
||||
if (type == "usb" || type == "wifi" || type == "custom") {
|
||||
if (type == "usb" || type == "wifi" || type == "other") {
|
||||
for (let runtime of AppManager.runtimeList[type]) {
|
||||
// Some runtimes do not expose getID function and don't support
|
||||
// autoconnect (like remote connection)
|
||||
if (typeof(runtime.getID) == "function" && runtime.getID() == id) {
|
||||
// Some runtimes do not expose an id and don't support autoconnect (like
|
||||
// remote connection)
|
||||
if (runtime.id == id) {
|
||||
this.connectToRuntime(runtime);
|
||||
}
|
||||
}
|
||||
|
@ -385,10 +391,10 @@ let UI = {
|
|||
},
|
||||
|
||||
connectToRuntime: function(runtime) {
|
||||
let name = runtime.getName();
|
||||
let name = runtime.name;
|
||||
let promise = AppManager.connectToRuntime(runtime);
|
||||
promise.then(() => this.initConnectionTelemetry());
|
||||
return this.busyUntil(promise, "connecting to runtime");
|
||||
return this.busyUntil(promise, "connecting to runtime " + name);
|
||||
},
|
||||
|
||||
updateRuntimeButton: function() {
|
||||
|
@ -396,15 +402,16 @@ let UI = {
|
|||
if (!AppManager.selectedRuntime) {
|
||||
labelNode.setAttribute("value", Strings.GetStringFromName("runtimeButton_label"));
|
||||
} else {
|
||||
let name = AppManager.selectedRuntime.getName();
|
||||
let name = AppManager.selectedRuntime.name;
|
||||
labelNode.setAttribute("value", name);
|
||||
}
|
||||
},
|
||||
|
||||
saveLastConnectedRuntime: function () {
|
||||
if (AppManager.selectedRuntime &&
|
||||
typeof(AppManager.selectedRuntime.getID) === "function") {
|
||||
this.lastConnectedRuntime = AppManager.selectedRuntime.type + ":" + AppManager.selectedRuntime.getID();
|
||||
AppManager.selectedRuntime.id !== undefined) {
|
||||
this.lastConnectedRuntime = AppManager.selectedRuntime.type + ":" +
|
||||
AppManager.selectedRuntime.id;
|
||||
} else {
|
||||
this.lastConnectedRuntime = "";
|
||||
}
|
||||
|
@ -1125,7 +1132,7 @@ let Cmds = {
|
|||
},
|
||||
|
||||
showRuntimePanel: function() {
|
||||
AppManager.scanForWiFiRuntimes();
|
||||
RuntimeScanners.scan();
|
||||
|
||||
let panel = document.querySelector("#runtime-panel");
|
||||
let anchor = document.querySelector("#runtime-panel-button > .panel-button-anchor");
|
||||
|
|
|
@ -151,17 +151,17 @@
|
|||
<!-- Runtime panel -->
|
||||
<panel id="runtime-panel" type="arrow" position="bottomcenter topright" consumeoutsideclicks="true" animate="false">
|
||||
<vbox flex="1">
|
||||
<label class="panel-header">&runtimePanel_USBDevices;</label>
|
||||
<label class="panel-header">&runtimePanel_usb;</label>
|
||||
<toolbarbutton class="panel-item" label="&runtimePanel_nousbdevice;" id="runtime-panel-nousbdevice" command="cmd_showTroubleShooting"/>
|
||||
<toolbarbutton class="panel-item" label="&runtimePanel_noadbhelper;" id="runtime-panel-noadbhelper" command="cmd_showAddons"/>
|
||||
<vbox id="runtime-panel-usbruntime"></vbox>
|
||||
<label class="panel-header" id="runtime-header-wifi-devices">&runtimePanel_WiFiDevices;</label>
|
||||
<vbox id="runtime-panel-wifi-devices"></vbox>
|
||||
<label class="panel-header">&runtimePanel_simulators;</label>
|
||||
<vbox id="runtime-panel-simulators"></vbox>
|
||||
<vbox id="runtime-panel-usb"></vbox>
|
||||
<label class="panel-header" id="runtime-header-wifi">&runtimePanel_wifi;</label>
|
||||
<vbox id="runtime-panel-wifi"></vbox>
|
||||
<label class="panel-header">&runtimePanel_simulator;</label>
|
||||
<vbox id="runtime-panel-simulator"></vbox>
|
||||
<toolbarbutton class="panel-item" label="&runtimePanel_installsimulator;" id="runtime-panel-installsimulator" command="cmd_showAddons"/>
|
||||
<label class="panel-header">&runtimePanel_custom;</label>
|
||||
<vbox id="runtime-panel-custom"></vbox>
|
||||
<label class="panel-header">&runtimePanel_other;</label>
|
||||
<vbox id="runtime-panel-other"></vbox>
|
||||
<vbox flex="1" id="runtime-actions">
|
||||
<toolbarbutton class="panel-item" id="runtime-details" command="cmd_showRuntimeDetails"/>
|
||||
<toolbarbutton class="panel-item" id="runtime-permissions" command="cmd_showPermissionsTable"/>
|
||||
|
|
|
@ -7,11 +7,9 @@ const {Cu} = require("chrome");
|
|||
let { Promise: promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
|
||||
|
||||
const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
const {Devices} = Cu.import("resource://gre/modules/devtools/Devices.jsm");
|
||||
const {Services} = Cu.import("resource://gre/modules/Services.jsm");
|
||||
const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
const {Simulator} = Cu.import("resource://gre/modules/devtools/Simulator.jsm");
|
||||
const {EventEmitter} = Cu.import("resource://gre/modules/devtools/event-emitter.js");
|
||||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const {TextEncoder, OS} = Cu.import("resource://gre/modules/osfile.jsm", {});
|
||||
const {AppProjects} = require("devtools/app-manager/app-projects");
|
||||
const TabStore = require("devtools/webide/tab-store");
|
||||
|
@ -22,26 +20,20 @@ const {getDeviceFront} = require("devtools/server/actors/device");
|
|||
const {getPreferenceFront} = require("devtools/server/actors/preference");
|
||||
const {setTimeout} = require("sdk/timers");
|
||||
const {Task} = Cu.import("resource://gre/modules/Task.jsm", {});
|
||||
const {USBRuntime, WiFiRuntime, SimulatorRuntime,
|
||||
gLocalRuntime, gRemoteRuntime} = require("devtools/webide/runtimes");
|
||||
const discovery = require("devtools/toolkit/discovery/discovery");
|
||||
const {RuntimeScanners, RuntimeTypes} = require("devtools/webide/runtimes");
|
||||
const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
const Telemetry = require("devtools/shared/telemetry");
|
||||
|
||||
const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties");
|
||||
|
||||
const WIFI_SCANNING_PREF = "devtools.remote.wifi.scan";
|
||||
|
||||
exports.AppManager = AppManager = {
|
||||
let AppManager = exports.AppManager = {
|
||||
|
||||
// FIXME: will break when devtools/app-manager will be removed:
|
||||
DEFAULT_PROJECT_ICON: "chrome://browser/skin/devtools/app-manager/default-app-icon.png",
|
||||
DEFAULT_PROJECT_NAME: "--",
|
||||
|
||||
init: function() {
|
||||
let host = Services.prefs.getCharPref("devtools.debugger.remote-host");
|
||||
let port = Services.prefs.getIntPref("devtools.debugger.remote-port");
|
||||
|
||||
this.connection = ConnectionManager.createConnection("localhost", port);
|
||||
this.onConnectionChanged = this.onConnectionChanged.bind(this);
|
||||
this.connection.on(Connection.Events.STATUS_CHANGED, this.onConnectionChanged);
|
||||
|
@ -52,33 +44,22 @@ exports.AppManager = AppManager = {
|
|||
this.tabStore.on("navigate", this.onTabNavigate);
|
||||
this.tabStore.on("closed", this.onTabClosed);
|
||||
|
||||
this.runtimeList = {
|
||||
usb: [],
|
||||
wifi: [],
|
||||
simulator: [],
|
||||
custom: [gRemoteRuntime]
|
||||
};
|
||||
if (Services.prefs.getBoolPref("devtools.webide.enableLocalRuntime")) {
|
||||
this.runtimeList.custom.push(gLocalRuntime);
|
||||
}
|
||||
this.trackUSBRuntimes();
|
||||
this.trackWiFiRuntimes();
|
||||
this.trackSimulatorRuntimes();
|
||||
this._clearRuntimeList();
|
||||
this._rebuildRuntimeList = this._rebuildRuntimeList.bind(this);
|
||||
RuntimeScanners.on("runtime-list-updated", this._rebuildRuntimeList);
|
||||
RuntimeScanners.enable();
|
||||
this._rebuildRuntimeList();
|
||||
|
||||
this.onInstallProgress = this.onInstallProgress.bind(this);
|
||||
|
||||
this.observe = this.observe.bind(this);
|
||||
Services.prefs.addObserver(WIFI_SCANNING_PREF, this, false);
|
||||
|
||||
this._telemetry = new Telemetry();
|
||||
},
|
||||
|
||||
uninit: function() {
|
||||
this.selectedProject = null;
|
||||
this.selectedRuntime = null;
|
||||
this.untrackUSBRuntimes();
|
||||
this.untrackWiFiRuntimes();
|
||||
this.untrackSimulatorRuntimes();
|
||||
RuntimeScanners.off("runtime-list-updated", this._rebuildRuntimeList);
|
||||
RuntimeScanners.disable();
|
||||
this.runtimeList = null;
|
||||
this.tabStore.off("navigate", this.onTabNavigate);
|
||||
this.tabStore.off("closed", this.onTabClosed);
|
||||
|
@ -88,17 +69,6 @@ exports.AppManager = AppManager = {
|
|||
this._listTabsResponse = null;
|
||||
this.connection.disconnect();
|
||||
this.connection = null;
|
||||
Services.prefs.removeObserver(WIFI_SCANNING_PREF, this);
|
||||
},
|
||||
|
||||
observe: function(subject, topic, data) {
|
||||
if (data !== WIFI_SCANNING_PREF) {
|
||||
return;
|
||||
}
|
||||
// Cycle WiFi tracking to reflect the new value
|
||||
this.untrackWiFiRuntimes();
|
||||
this.trackWiFiRuntimes();
|
||||
this._updateWiFiRuntimes();
|
||||
},
|
||||
|
||||
update: function(what, details) {
|
||||
|
@ -334,7 +304,7 @@ exports.AppManager = AppManager = {
|
|||
this.selectedProject.type == "tab")) {
|
||||
this.selectedProject = null;
|
||||
}
|
||||
this.update("runtime");
|
||||
this.update("runtime-changed");
|
||||
},
|
||||
|
||||
get selectedRuntime() {
|
||||
|
@ -607,89 +577,41 @@ exports.AppManager = AppManager = {
|
|||
|
||||
/* RUNTIME LIST */
|
||||
|
||||
trackUSBRuntimes: function() {
|
||||
this._updateUSBRuntimes = this._updateUSBRuntimes.bind(this);
|
||||
Devices.on("register", this._updateUSBRuntimes);
|
||||
Devices.on("unregister", this._updateUSBRuntimes);
|
||||
Devices.on("addon-status-updated", this._updateUSBRuntimes);
|
||||
this._updateUSBRuntimes();
|
||||
_clearRuntimeList: function() {
|
||||
this.runtimeList = {
|
||||
usb: [],
|
||||
wifi: [],
|
||||
simulator: [],
|
||||
other: []
|
||||
};
|
||||
},
|
||||
untrackUSBRuntimes: function() {
|
||||
Devices.off("register", this._updateUSBRuntimes);
|
||||
Devices.off("unregister", this._updateUSBRuntimes);
|
||||
Devices.off("addon-status-updated", this._updateUSBRuntimes);
|
||||
},
|
||||
_updateUSBRuntimes: function() {
|
||||
this.runtimeList.usb = [];
|
||||
for (let id of Devices.available()) {
|
||||
let r = new USBRuntime(id);
|
||||
this.runtimeList.usb.push(r);
|
||||
r.updateNameFromADB().then(
|
||||
() => {
|
||||
this.update("runtimelist");
|
||||
// Also update the runtime button label, if the currently selected
|
||||
// runtime name changes
|
||||
if (r == this.selectedRuntime) {
|
||||
this.update("runtime");
|
||||
}
|
||||
},
|
||||
() => {});
|
||||
|
||||
_rebuildRuntimeList: function() {
|
||||
let runtimes = RuntimeScanners.listRuntimes();
|
||||
this._clearRuntimeList();
|
||||
|
||||
// Reorganize runtimes by type
|
||||
for (let runtime of runtimes) {
|
||||
switch (runtime.type) {
|
||||
case RuntimeTypes.USB:
|
||||
this.runtimeList.usb.push(runtime);
|
||||
break;
|
||||
case RuntimeTypes.WIFI:
|
||||
this.runtimeList.wifi.push(runtime);
|
||||
break;
|
||||
case RuntimeTypes.SIMULATOR:
|
||||
this.runtimeList.simulator.push(runtime);
|
||||
break;
|
||||
default:
|
||||
this.runtimeList.other.push(runtime);
|
||||
}
|
||||
}
|
||||
|
||||
this.update("runtime-details");
|
||||
this.update("runtimelist");
|
||||
},
|
||||
|
||||
get isWiFiScanningEnabled() {
|
||||
return Services.prefs.getBoolPref(WIFI_SCANNING_PREF);
|
||||
},
|
||||
scanForWiFiRuntimes: function() {
|
||||
if (!this.isWiFiScanningEnabled) {
|
||||
return;
|
||||
}
|
||||
discovery.scan();
|
||||
},
|
||||
trackWiFiRuntimes: function() {
|
||||
if (!this.isWiFiScanningEnabled) {
|
||||
return;
|
||||
}
|
||||
this._updateWiFiRuntimes = this._updateWiFiRuntimes.bind(this);
|
||||
discovery.on("devtools-device-added", this._updateWiFiRuntimes);
|
||||
discovery.on("devtools-device-updated", this._updateWiFiRuntimes);
|
||||
discovery.on("devtools-device-removed", this._updateWiFiRuntimes);
|
||||
this._updateWiFiRuntimes();
|
||||
},
|
||||
untrackWiFiRuntimes: function() {
|
||||
if (!this.isWiFiScanningEnabled) {
|
||||
return;
|
||||
}
|
||||
discovery.off("devtools-device-added", this._updateWiFiRuntimes);
|
||||
discovery.off("devtools-device-updated", this._updateWiFiRuntimes);
|
||||
discovery.off("devtools-device-removed", this._updateWiFiRuntimes);
|
||||
},
|
||||
_updateWiFiRuntimes: function() {
|
||||
this.runtimeList.wifi = [];
|
||||
for (let device of discovery.getRemoteDevicesWithService("devtools")) {
|
||||
this.runtimeList.wifi.push(new WiFiRuntime(device));
|
||||
}
|
||||
this.update("runtimelist");
|
||||
},
|
||||
|
||||
trackSimulatorRuntimes: function() {
|
||||
this._updateSimulatorRuntimes = this._updateSimulatorRuntimes.bind(this);
|
||||
Simulator.on("register", this._updateSimulatorRuntimes);
|
||||
Simulator.on("unregister", this._updateSimulatorRuntimes);
|
||||
this._updateSimulatorRuntimes();
|
||||
},
|
||||
untrackSimulatorRuntimes: function() {
|
||||
Simulator.off("register", this._updateSimulatorRuntimes);
|
||||
Simulator.off("unregister", this._updateSimulatorRuntimes);
|
||||
},
|
||||
_updateSimulatorRuntimes: function() {
|
||||
this.runtimeList.simulator = [];
|
||||
for (let version of Simulator.availableVersions()) {
|
||||
this.runtimeList.simulator.push(new SimulatorRuntime(version));
|
||||
}
|
||||
this.update("runtimelist");
|
||||
},
|
||||
/* MANIFEST UTILS */
|
||||
|
||||
writeManifest: function(project) {
|
||||
if (project.type != "packaged") {
|
||||
|
@ -707,6 +629,6 @@ exports.AppManager = AppManager = {
|
|||
let array = encoder.encode(text);
|
||||
return OS.File.writeAtomic(manifestPath, array, {tmpPath: manifestPath + ".tmp"});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
EventEmitter.decorate(AppManager);
|
||||
|
|
|
@ -9,50 +9,413 @@ const {Simulator} = Cu.import("resource://gre/modules/devtools/Simulator.jsm");
|
|||
const {ConnectionManager, Connection} = require("devtools/client/connection-manager");
|
||||
const {DebuggerServer} = require("resource://gre/modules/devtools/dbg-server.jsm");
|
||||
const discovery = require("devtools/toolkit/discovery/discovery");
|
||||
const EventEmitter = require("devtools/toolkit/event-emitter");
|
||||
const promise = require("promise");
|
||||
|
||||
const Strings = Services.strings.createBundle("chrome://browser/locale/devtools/webide.properties");
|
||||
|
||||
// These type strings are used for logging events to Telemetry
|
||||
let RuntimeTypes = {
|
||||
usb: "USB",
|
||||
wifi: "WIFI",
|
||||
simulator: "SIMULATOR",
|
||||
remote: "REMOTE",
|
||||
local: "LOCAL"
|
||||
/**
|
||||
* Runtime and Scanner API
|
||||
*
|
||||
* |RuntimeScanners| maintains a set of |Scanner| objects that produce one or
|
||||
* more |Runtime|s to connect to. Add-ons can extend the set of known runtimes
|
||||
* by registering additional |Scanner|s that emit them.
|
||||
*
|
||||
* Each |Scanner| must support the following API:
|
||||
*
|
||||
* enable()
|
||||
* Bind any event handlers and start any background work the scanner needs to
|
||||
* maintain an updated set of |Runtime|s.
|
||||
* Called when the first consumer (such as WebIDE) actively interested in
|
||||
* maintaining the |Runtime| list enables the registry.
|
||||
* disable()
|
||||
* Unbind any event handlers and stop any background work the scanner needs to
|
||||
* maintain an updated set of |Runtime|s.
|
||||
* Called when the last consumer (such as WebIDE) actively interested in
|
||||
* maintaining the |Runtime| list disables the registry.
|
||||
* emits "runtime-list-updated"
|
||||
* If the set of runtimes a |Scanner| manages has changed, it must emit this
|
||||
* event to notify consumers of changes.
|
||||
* scan()
|
||||
* Actively refreshes the list of runtimes the scanner knows about. If your
|
||||
* scanner uses an active scanning approach (as opposed to listening for
|
||||
* events when changes occur), the bulk of the work would be done here.
|
||||
* @return Promise
|
||||
* Should be resolved when scanning is complete. If scanning has no
|
||||
* well-defined end point, you can resolve immediately, as long as
|
||||
* update event is emitted later when changes are noticed.
|
||||
* listRuntimes()
|
||||
* Return the current list of runtimes known to the |Scanner| instance.
|
||||
* @return Iterable
|
||||
*
|
||||
* Each |Runtime| must support the following API:
|
||||
*
|
||||
* |type| field
|
||||
* The |type| must be one of the values from the |RuntimeTypes| object. This
|
||||
* is used for Telemetry and to support displaying sets of |Runtime|s
|
||||
* categorized by type.
|
||||
* |id| field
|
||||
* An identifier that is unique in the set of all runtimes with the same
|
||||
* |type|. WebIDE tries to save the last used runtime via type + id, and
|
||||
* tries to locate it again in the next session, so this value should attempt
|
||||
* to be stable across Firefox sessions.
|
||||
* |name| field
|
||||
* A user-visible label to identify the runtime that will be displayed in a
|
||||
* runtime list.
|
||||
* connect()
|
||||
* Configure the passed |connection| object with any settings need to
|
||||
* successfully connect to the runtime, and call the |connection|'s connect()
|
||||
* method.
|
||||
* @param Connection connection
|
||||
* A |Connection| object from the DevTools |ConnectionManager|.
|
||||
* @return Promise
|
||||
* Resolved once you've called the |connection|'s connect() method.
|
||||
*/
|
||||
|
||||
/* SCANNER REGISTRY */
|
||||
|
||||
let RuntimeScanners = {
|
||||
|
||||
_enabledCount: 0,
|
||||
_scanners: new Set(),
|
||||
|
||||
get enabled() {
|
||||
return !!this._enabledCount;
|
||||
},
|
||||
|
||||
add(scanner) {
|
||||
if (this.enabled) {
|
||||
// Enable any scanner added while globally enabled
|
||||
this._enableScanner(scanner);
|
||||
}
|
||||
this._scanners.add(scanner);
|
||||
this._emitUpdated();
|
||||
},
|
||||
|
||||
remove(scanner) {
|
||||
this._scanners.delete(scanner);
|
||||
if (this.enabled) {
|
||||
// Disable any scanner removed while globally enabled
|
||||
this._disableScanner(scanner);
|
||||
}
|
||||
this._emitUpdated();
|
||||
},
|
||||
|
||||
has(scanner) {
|
||||
return this._scanners.has(scanner);
|
||||
},
|
||||
|
||||
scan() {
|
||||
if (!this.enabled) {
|
||||
return promise.resolve();
|
||||
}
|
||||
|
||||
if (this._scanPromise) {
|
||||
return this._scanPromise;
|
||||
}
|
||||
|
||||
let promises = [];
|
||||
|
||||
for (let scanner of this._scanners) {
|
||||
promises.push(scanner.scan());
|
||||
}
|
||||
|
||||
this._scanPromise = promise.all(promises);
|
||||
|
||||
// Reset pending promise
|
||||
this._scanPromise.then(() => {
|
||||
this._scanPromise = null;
|
||||
}, () => {
|
||||
this._scanPromise = null;
|
||||
});
|
||||
|
||||
return this._scanPromise;
|
||||
},
|
||||
|
||||
listRuntimes: function*() {
|
||||
for (let scanner of this._scanners) {
|
||||
for (let runtime of scanner.listRuntimes()) {
|
||||
yield runtime;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_emitUpdated() {
|
||||
this.emit("runtime-list-updated");
|
||||
},
|
||||
|
||||
enable() {
|
||||
if (this._enabledCount++ !== 0) {
|
||||
// Already enabled scanners during a previous call
|
||||
return;
|
||||
}
|
||||
this._emitUpdated = this._emitUpdated.bind(this);
|
||||
for (let scanner of this._scanners) {
|
||||
this._enableScanner(scanner);
|
||||
}
|
||||
},
|
||||
|
||||
_enableScanner(scanner) {
|
||||
scanner.enable();
|
||||
scanner.on("runtime-list-updated", this._emitUpdated);
|
||||
},
|
||||
|
||||
disable() {
|
||||
if (--this._enabledCount !== 0) {
|
||||
// Already disabled scanners during a previous call
|
||||
return;
|
||||
}
|
||||
for (let scanner of this._scanners) {
|
||||
this._disableScanner(scanner);
|
||||
}
|
||||
},
|
||||
|
||||
_disableScanner(scanner) {
|
||||
scanner.off("runtime-list-updated", this._emitUpdated);
|
||||
scanner.disable();
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
function USBRuntime(id) {
|
||||
this.id = id;
|
||||
EventEmitter.decorate(RuntimeScanners);
|
||||
|
||||
exports.RuntimeScanners = RuntimeScanners;
|
||||
|
||||
/* SCANNERS */
|
||||
|
||||
let SimulatorScanner = {
|
||||
|
||||
_runtimes: [],
|
||||
|
||||
enable() {
|
||||
this._updateRuntimes = this._updateRuntimes.bind(this);
|
||||
Simulator.on("register", this._updateRuntimes);
|
||||
Simulator.on("unregister", this._updateRuntimes);
|
||||
this._updateRuntimes();
|
||||
},
|
||||
|
||||
disable() {
|
||||
Simulator.off("register", this._updateRuntimes);
|
||||
Simulator.off("unregister", this._updateRuntimes);
|
||||
},
|
||||
|
||||
_emitUpdated() {
|
||||
this.emit("runtime-list-updated");
|
||||
},
|
||||
|
||||
_updateRuntimes() {
|
||||
this._runtimes = [];
|
||||
for (let version of Simulator.availableVersions()) {
|
||||
this._runtimes.push(new SimulatorRuntime(version));
|
||||
}
|
||||
this._emitUpdated();
|
||||
},
|
||||
|
||||
scan() {
|
||||
return promise.resolve();
|
||||
},
|
||||
|
||||
listRuntimes: function() {
|
||||
return this._runtimes;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
EventEmitter.decorate(SimulatorScanner);
|
||||
RuntimeScanners.add(SimulatorScanner);
|
||||
|
||||
/**
|
||||
* TODO: Remove this comaptibility layer in the future (bug 1085393)
|
||||
* This runtime exists to support the ADB Helper add-on below version 0.7.0.
|
||||
*
|
||||
* This scanner will list all ADB devices as runtimes, even if they may or may
|
||||
* not actually connect (since the |DeprecatedUSBRuntime| assumes a Firefox OS
|
||||
* device).
|
||||
*/
|
||||
let DeprecatedAdbScanner = {
|
||||
|
||||
_runtimes: [],
|
||||
|
||||
enable() {
|
||||
this._updateRuntimes = this._updateRuntimes.bind(this);
|
||||
Devices.on("register", this._updateRuntimes);
|
||||
Devices.on("unregister", this._updateRuntimes);
|
||||
Devices.on("addon-status-updated", this._updateRuntimes);
|
||||
this._updateRuntimes();
|
||||
},
|
||||
|
||||
disable() {
|
||||
Devices.off("register", this._updateRuntimes);
|
||||
Devices.off("unregister", this._updateRuntimes);
|
||||
Devices.off("addon-status-updated", this._updateRuntimes);
|
||||
},
|
||||
|
||||
_emitUpdated() {
|
||||
this.emit("runtime-list-updated");
|
||||
},
|
||||
|
||||
_updateRuntimes() {
|
||||
this._runtimes = [];
|
||||
for (let id of Devices.available()) {
|
||||
let runtime = new DeprecatedUSBRuntime(id);
|
||||
this._runtimes.push(runtime);
|
||||
runtime.updateNameFromADB().then(() => {
|
||||
this._emitUpdated();
|
||||
}, () => {});
|
||||
}
|
||||
this._emitUpdated();
|
||||
},
|
||||
|
||||
scan() {
|
||||
return promise.resolve();
|
||||
},
|
||||
|
||||
listRuntimes: function() {
|
||||
return this._runtimes;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
EventEmitter.decorate(DeprecatedAdbScanner);
|
||||
RuntimeScanners.add(DeprecatedAdbScanner);
|
||||
|
||||
// ADB Helper 0.7.0 and later will replace this scanner on startup
|
||||
exports.DeprecatedAdbScanner = DeprecatedAdbScanner;
|
||||
|
||||
let WiFiScanner = {
|
||||
|
||||
_runtimes: [],
|
||||
|
||||
init() {
|
||||
this.updateRegistration();
|
||||
Services.prefs.addObserver(this.ALLOWED_PREF, this, false);
|
||||
},
|
||||
|
||||
enable() {
|
||||
this._updateRuntimes = this._updateRuntimes.bind(this);
|
||||
discovery.on("devtools-device-added", this._updateRuntimes);
|
||||
discovery.on("devtools-device-updated", this._updateRuntimes);
|
||||
discovery.on("devtools-device-removed", this._updateRuntimes);
|
||||
this._updateRuntimes();
|
||||
},
|
||||
|
||||
disable() {
|
||||
discovery.off("devtools-device-added", this._updateRuntimes);
|
||||
discovery.off("devtools-device-updated", this._updateRuntimes);
|
||||
discovery.off("devtools-device-removed", this._updateRuntimes);
|
||||
},
|
||||
|
||||
_emitUpdated() {
|
||||
this.emit("runtime-list-updated");
|
||||
},
|
||||
|
||||
_updateRuntimes() {
|
||||
this._runtimes = [];
|
||||
for (let device of discovery.getRemoteDevicesWithService("devtools")) {
|
||||
this._runtimes.push(new WiFiRuntime(device));
|
||||
}
|
||||
this._emitUpdated();
|
||||
},
|
||||
|
||||
scan() {
|
||||
discovery.scan();
|
||||
return promise.resolve();
|
||||
},
|
||||
|
||||
listRuntimes: function() {
|
||||
return this._runtimes;
|
||||
},
|
||||
|
||||
ALLOWED_PREF: "devtools.remote.wifi.scan",
|
||||
|
||||
get allowed() {
|
||||
return Services.prefs.getBoolPref(this.ALLOWED_PREF);
|
||||
},
|
||||
|
||||
updateRegistration() {
|
||||
if (this.allowed) {
|
||||
RuntimeScanners.add(WiFiScanner);
|
||||
} else {
|
||||
RuntimeScanners.remove(WiFiScanner);
|
||||
}
|
||||
this._emitUpdated();
|
||||
},
|
||||
|
||||
observe(subject, topic, data) {
|
||||
if (data !== WiFiScanner.ALLOWED_PREF) {
|
||||
return;
|
||||
}
|
||||
WiFiScanner.updateRegistration();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
EventEmitter.decorate(WiFiScanner);
|
||||
WiFiScanner.init();
|
||||
|
||||
exports.WiFiScanner = WiFiScanner;
|
||||
|
||||
let StaticScanner = {
|
||||
enable() {},
|
||||
disable() {},
|
||||
scan() { return promise.resolve(); },
|
||||
listRuntimes() { return [gRemoteRuntime, gLocalRuntime]; }
|
||||
};
|
||||
|
||||
EventEmitter.decorate(StaticScanner);
|
||||
RuntimeScanners.add(StaticScanner);
|
||||
|
||||
/* RUNTIMES */
|
||||
|
||||
// These type strings are used for logging events to Telemetry.
|
||||
// You must update Histograms.json if new types are added.
|
||||
let RuntimeTypes = exports.RuntimeTypes = {
|
||||
USB: "USB",
|
||||
WIFI: "WIFI",
|
||||
SIMULATOR: "SIMULATOR",
|
||||
REMOTE: "REMOTE",
|
||||
LOCAL: "LOCAL",
|
||||
OTHER: "OTHER"
|
||||
};
|
||||
|
||||
/**
|
||||
* TODO: Remove this comaptibility layer in the future (bug 1085393)
|
||||
* This runtime exists to support the ADB Helper add-on below version 0.7.0.
|
||||
*
|
||||
* This runtime assumes it is connecting to a Firefox OS device.
|
||||
*/
|
||||
function DeprecatedUSBRuntime(id) {
|
||||
this._id = id;
|
||||
}
|
||||
|
||||
USBRuntime.prototype = {
|
||||
type: RuntimeTypes.usb,
|
||||
DeprecatedUSBRuntime.prototype = {
|
||||
type: RuntimeTypes.USB,
|
||||
get device() {
|
||||
return Devices.getByName(this._id);
|
||||
},
|
||||
connect: function(connection) {
|
||||
let device = Devices.getByName(this.id);
|
||||
if (!device) {
|
||||
return promise.reject("Can't find device: " + this.getName());
|
||||
if (!this.device) {
|
||||
return promise.reject("Can't find device: " + this.name);
|
||||
}
|
||||
return device.connect().then((port) => {
|
||||
return this.device.connect().then((port) => {
|
||||
connection.host = "localhost";
|
||||
connection.port = port;
|
||||
connection.connect();
|
||||
});
|
||||
},
|
||||
getID: function() {
|
||||
return this.id;
|
||||
get id() {
|
||||
return this._id;
|
||||
},
|
||||
getName: function() {
|
||||
return this._productModel || this.id;
|
||||
get name() {
|
||||
return this._productModel || this._id;
|
||||
},
|
||||
updateNameFromADB: function() {
|
||||
if (this._productModel) {
|
||||
return promise.resolve();
|
||||
return promise.reject();
|
||||
}
|
||||
let device = Devices.getByName(this.id);
|
||||
let deferred = promise.defer();
|
||||
if (device && device.shell) {
|
||||
device.shell("getprop ro.product.model").then(stdout => {
|
||||
if (this.device && this.device.shell) {
|
||||
this.device.shell("getprop ro.product.model").then(stdout => {
|
||||
this._productModel = stdout;
|
||||
deferred.resolve();
|
||||
}, () => {});
|
||||
|
@ -62,43 +425,49 @@ USBRuntime.prototype = {
|
|||
}
|
||||
return deferred.promise;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// For testing use only
|
||||
exports._DeprecatedUSBRuntime = DeprecatedUSBRuntime;
|
||||
|
||||
function WiFiRuntime(deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
WiFiRuntime.prototype = {
|
||||
type: RuntimeTypes.wifi,
|
||||
type: RuntimeTypes.WIFI,
|
||||
connect: function(connection) {
|
||||
let service = discovery.getRemoteService("devtools", this.deviceName);
|
||||
if (!service) {
|
||||
return promise.reject("Can't find device: " + this.getName());
|
||||
return promise.reject("Can't find device: " + this.name);
|
||||
}
|
||||
connection.host = service.host;
|
||||
connection.port = service.port;
|
||||
connection.connect();
|
||||
return promise.resolve();
|
||||
},
|
||||
getID: function() {
|
||||
get id() {
|
||||
return this.deviceName;
|
||||
},
|
||||
getName: function() {
|
||||
get name() {
|
||||
return this.deviceName;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// For testing use only
|
||||
exports._WiFiRuntime = WiFiRuntime;
|
||||
|
||||
function SimulatorRuntime(version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
SimulatorRuntime.prototype = {
|
||||
type: RuntimeTypes.simulator,
|
||||
type: RuntimeTypes.SIMULATOR,
|
||||
connect: function(connection) {
|
||||
let port = ConnectionManager.getFreeTCPPort();
|
||||
let simulator = Simulator.getByVersion(this.version);
|
||||
if (!simulator || !simulator.launch) {
|
||||
return promise.reject("Can't find simulator: " + this.getName());
|
||||
return promise.reject("Can't find simulator: " + this.name);
|
||||
}
|
||||
return simulator.launch({port: port}).then(() => {
|
||||
connection.host = "localhost";
|
||||
|
@ -108,16 +477,23 @@ SimulatorRuntime.prototype = {
|
|||
connection.connect();
|
||||
});
|
||||
},
|
||||
getID: function() {
|
||||
get id() {
|
||||
return this.version;
|
||||
},
|
||||
getName: function() {
|
||||
get name() {
|
||||
let simulator = Simulator.getByVersion(this.version);
|
||||
if (!simulator) {
|
||||
return "Unknown";
|
||||
}
|
||||
return Simulator.getByVersion(this.version).appinfo.label;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
// For testing use only
|
||||
exports._SimulatorRuntime = SimulatorRuntime;
|
||||
|
||||
let gLocalRuntime = {
|
||||
type: RuntimeTypes.local,
|
||||
type: RuntimeTypes.LOCAL,
|
||||
connect: function(connection) {
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
|
@ -128,16 +504,19 @@ let gLocalRuntime = {
|
|||
connection.connect();
|
||||
return promise.resolve();
|
||||
},
|
||||
getName: function() {
|
||||
get id() {
|
||||
return "local";
|
||||
},
|
||||
get name() {
|
||||
return Strings.GetStringFromName("local_runtime");
|
||||
},
|
||||
getID: function () {
|
||||
return "local";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// For testing use only
|
||||
exports._gLocalRuntime = gLocalRuntime;
|
||||
|
||||
let gRemoteRuntime = {
|
||||
type: RuntimeTypes.remote,
|
||||
type: RuntimeTypes.REMOTE,
|
||||
connect: function(connection) {
|
||||
let win = Services.wm.getMostRecentWindow("devtools:webide");
|
||||
if (!win) {
|
||||
|
@ -159,13 +538,10 @@ let gRemoteRuntime = {
|
|||
connection.connect();
|
||||
return promise.resolve();
|
||||
},
|
||||
getName: function() {
|
||||
get name() {
|
||||
return Strings.GetStringFromName("remote_runtime");
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
exports.USBRuntime = USBRuntime;
|
||||
exports.WiFiRuntime = WiFiRuntime;
|
||||
exports.SimulatorRuntime = SimulatorRuntime;
|
||||
exports.gRemoteRuntime = gRemoteRuntime;
|
||||
exports.gLocalRuntime = gLocalRuntime;
|
||||
// For testing use only
|
||||
exports._gRemoteRuntime = gRemoteRuntime;
|
||||
|
|
|
@ -43,7 +43,7 @@ function connectToLocal(win) {
|
|||
win.AppManager.connection.once(
|
||||
win.Connection.Events.CONNECTED,
|
||||
() => deferred.resolve());
|
||||
win.document.querySelectorAll(".runtime-panel-item-custom")[1].click();
|
||||
win.document.querySelectorAll(".runtime-panel-item-other")[1].click();
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ if (window.location === "chrome://browser/content/browser.xul") {
|
|||
}
|
||||
|
||||
Services.prefs.setBoolPref("devtools.webide.enabled", true);
|
||||
Services.prefs.setBoolPref("devtools.webide.enableLocalRuntime", true);
|
||||
|
||||
Services.prefs.setCharPref("devtools.webide.addonsURL", TEST_BASE + "addons/simulators.json");
|
||||
Services.prefs.setCharPref("devtools.webide.simulatorAddonsURL", TEST_BASE + "addons/fxos_#SLASHED_VERSION#_simulator-#OS#.xpi");
|
||||
|
@ -33,7 +32,6 @@ Services.prefs.setCharPref("devtools.webide.templatesURL", TEST_BASE + "template
|
|||
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("devtools.webide.enabled");
|
||||
Services.prefs.clearUserPref("devtools.webide.enableLocalRuntime");
|
||||
Services.prefs.clearUserPref("devtools.webide.autoinstallADBHelper");
|
||||
Services.prefs.clearUserPref("devtools.webide.autoinstallFxdtAdapters");
|
||||
});
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
return promise.resolve();
|
||||
},
|
||||
|
||||
getID: function() {
|
||||
get id() {
|
||||
return "fakeRuntime";
|
||||
},
|
||||
|
||||
getName: function() {
|
||||
get name() {
|
||||
return "fakeRuntime";
|
||||
}
|
||||
};
|
||||
|
|
|
@ -34,11 +34,11 @@
|
|||
yield documentIsLoaded(permIframe.contentWindow.document);
|
||||
yield documentIsLoaded(infoIframe.contentWindow.document);
|
||||
|
||||
win.AppManager.update("runtimelist");
|
||||
win.AppManager._rebuildRuntimeList();
|
||||
|
||||
let panelNode = win.document.querySelector("#runtime-panel");
|
||||
let items = panelNode.querySelectorAll(".runtime-panel-item-custom");
|
||||
is(items.length, 2, "Found 2 custom runtimes button");
|
||||
let items = panelNode.querySelectorAll(".runtime-panel-item-other");
|
||||
is(items.length, 2, "Found 2 other runtimes button");
|
||||
|
||||
let deferred = promise.defer();
|
||||
win.AppManager.on("app-manager-update", function onUpdate(e,w) {
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
return promise.resolve();
|
||||
},
|
||||
|
||||
getName: function() {
|
||||
get name() {
|
||||
return "fakeRuntime";
|
||||
}
|
||||
});
|
||||
|
@ -110,7 +110,7 @@
|
|||
ok(!isPlayActive(), "play button is disabled 4");
|
||||
ok(!isStopActive(), "stop button is disabled 4");
|
||||
|
||||
win.document.querySelectorAll(".runtime-panel-item-custom")[1].click();
|
||||
win.document.querySelectorAll(".runtime-panel-item-other")[1].click();
|
||||
|
||||
yield waitForUpdate(win, "list-tabs-response");
|
||||
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
|
||||
<script type="application/javascript;version=1.8">
|
||||
const Telemetry = require("devtools/shared/telemetry");
|
||||
const { USBRuntime, WiFiRuntime, SimulatorRuntime, gRemoteRuntime,
|
||||
gLocalRuntime } = require("devtools/webide/runtimes");
|
||||
const { _DeprecatedUSBRuntime, _WiFiRuntime, _SimulatorRuntime,
|
||||
_gRemoteRuntime, _gLocalRuntime, RuntimeTypes }
|
||||
= require("devtools/webide/runtimes");
|
||||
|
||||
// Because we need to gather stats for the period of time that a tool has
|
||||
// been opened we make use of setTimeout() to create tool active times.
|
||||
|
@ -55,7 +56,7 @@
|
|||
// We use the real runtimes here (and switch out some functionality)
|
||||
// so we can ensure that logging happens as it would in real use.
|
||||
|
||||
let usb = new USBRuntime("fakeUSB");
|
||||
let usb = new _DeprecatedUSBRuntime("fakeUSB");
|
||||
// Use local pipe instead
|
||||
usb.connect = function(connection) {
|
||||
ok(connection, win.AppManager.connection, "connection is valid");
|
||||
|
@ -65,7 +66,7 @@
|
|||
};
|
||||
win.AppManager.runtimeList.usb.push(usb);
|
||||
|
||||
let wifi = new WiFiRuntime("fakeWiFi");
|
||||
let wifi = new _WiFiRuntime("fakeWiFi");
|
||||
// Use local pipe instead
|
||||
wifi.connect = function(connection) {
|
||||
ok(connection, win.AppManager.connection, "connection is valid");
|
||||
|
@ -75,7 +76,7 @@
|
|||
};
|
||||
win.AppManager.runtimeList.wifi.push(wifi);
|
||||
|
||||
let sim = new SimulatorRuntime("fakeSimulator");
|
||||
let sim = new _SimulatorRuntime("fakeSimulator");
|
||||
// Use local pipe instead
|
||||
sim.connect = function(connection) {
|
||||
ok(connection, win.AppManager.connection, "connection is valid");
|
||||
|
@ -83,12 +84,14 @@
|
|||
connection.connect();
|
||||
return promise.resolve();
|
||||
};
|
||||
sim.getName = function() {
|
||||
return this.version;
|
||||
};
|
||||
Object.defineProperty(sim, "name", {
|
||||
get() {
|
||||
return this.version;
|
||||
}
|
||||
});
|
||||
win.AppManager.runtimeList.simulator.push(sim);
|
||||
|
||||
let remote = gRemoteRuntime;
|
||||
let remote = _gRemoteRuntime;
|
||||
// Use local pipe instead
|
||||
remote.connect = function(connection) {
|
||||
ok(connection, win.AppManager.connection, "connection is valid");
|
||||
|
@ -96,8 +99,12 @@
|
|||
connection.connect();
|
||||
return promise.resolve();
|
||||
};
|
||||
let local = gLocalRuntime;
|
||||
win.AppManager.runtimeList.custom = [gRemoteRuntime, gLocalRuntime];
|
||||
let local = _gLocalRuntime;
|
||||
|
||||
let other = Object.create(_gLocalRuntime);
|
||||
other.type = RuntimeTypes.OTHER;
|
||||
|
||||
win.AppManager.runtimeList.other = [remote, local, other];
|
||||
|
||||
win.AppManager.update("runtimelist");
|
||||
}
|
||||
|
@ -164,7 +171,7 @@
|
|||
|
||||
ok(okay, "All " + histId + " entries have time > 0");
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_CONNECTION_RESULT") {
|
||||
ok(value.length === 5, histId + " has 5 connection results");
|
||||
ok(value.length === 6, histId + " has 6 connection results");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
return !!element;
|
||||
|
@ -175,7 +182,7 @@
|
|||
ok(value.length === 1 && !!value[0],
|
||||
histId + " has 1 successful connection");
|
||||
} else if (histId === "DEVTOOLS_WEBIDE_CONNECTION_TIME_SECONDS") {
|
||||
ok(value.length === 5, histId + " has 5 connection results");
|
||||
ok(value.length === 6, histId + " has 6 connection results");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
return element > 0;
|
||||
|
@ -183,7 +190,7 @@
|
|||
|
||||
ok(okay, "All " + histId + " connections have time > 0");
|
||||
} else if (histId.endsWith("USED")) {
|
||||
ok(value.length === 5, histId + " has 5 connection actions");
|
||||
ok(value.length === 6, histId + " has 6 connection actions");
|
||||
|
||||
let okay = value.every(function(element) {
|
||||
return !element;
|
||||
|
@ -239,9 +246,11 @@
|
|||
yield waitForTime(TOOL_DELAY);
|
||||
yield connectToRuntime(win, "simulator");
|
||||
yield waitForTime(TOOL_DELAY);
|
||||
yield connectToRuntime(win, "custom", 0 /* remote */);
|
||||
yield connectToRuntime(win, "other", 0 /* remote */);
|
||||
yield waitForTime(TOOL_DELAY);
|
||||
yield connectToRuntime(win, "custom", 1 /* local */);
|
||||
yield connectToRuntime(win, "other", 1 /* local */);
|
||||
yield waitForTime(TOOL_DELAY);
|
||||
yield connectToRuntime(win, "other", 2 /* other */);
|
||||
yield waitForTime(TOOL_DELAY);
|
||||
yield closeWebIDE(win);
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
|
|||
padding: 12px 0 0;
|
||||
}
|
||||
|
||||
#runtime-panel-custom {
|
||||
#runtime-panel-other {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
|
|||
#runtime-panel-installsimulator,
|
||||
.runtime-panel-item-usb,
|
||||
.runtime-panel-item-wifi,
|
||||
.runtime-panel-item-custom,
|
||||
.runtime-panel-item-other,
|
||||
.runtime-panel-item-simulator {
|
||||
list-style-image: url("icons.png");
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ panel > .panel-arrowcontainer > .panel-arrowcontent {
|
|||
#runtime-panel-installsimulator { -moz-image-region: rect(0px,438px,26px,412px) }
|
||||
.runtime-panel-item-usb { -moz-image-region: rect(52px,438px,78px,412px) }
|
||||
.runtime-panel-item-wifi { -moz-image-region: rect(208px,438px,234px,412px) }
|
||||
.runtime-panel-item-custom { -moz-image-region: rect(26px,438px,52px,412px) }
|
||||
.runtime-panel-item-other { -moz-image-region: rect(26px,438px,52px,412px) }
|
||||
.runtime-panel-item-simulator { -moz-image-region: rect(0px,438px,26px,412px) }
|
||||
|
||||
#runtime-actions {
|
||||
|
|
|
@ -8,7 +8,6 @@ pref("devtools.webide.templatesURL", "https://code.cdn.mozilla.net/templates/lis
|
|||
pref("devtools.webide.autoinstallADBHelper", true);
|
||||
pref("devtools.webide.autoinstallFxdtAdapters", false);
|
||||
pref("devtools.webide.restoreLastProject", true);
|
||||
pref("devtools.webide.enableLocalRuntime", true);
|
||||
pref("devtools.webide.addonsURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/index.json");
|
||||
pref("devtools.webide.simulatorAddonsURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/#VERSION#/#OS#/fxos_#SLASHED_VERSION#_simulator-#OS#-latest.xpi");
|
||||
pref("devtools.webide.simulatorAddonID", "fxos_#SLASHED_VERSION#_simulator@mozilla.org");
|
||||
|
|
|
@ -63,10 +63,10 @@
|
|||
<!ENTITY projectPanel_myProjects "My Projects">
|
||||
<!ENTITY projectPanel_runtimeApps "Runtime Apps">
|
||||
<!ENTITY projectPanel_tabs "Tabs">
|
||||
<!ENTITY runtimePanel_USBDevices "USB Devices">
|
||||
<!ENTITY runtimePanel_WiFiDevices "Wi-Fi Devices">
|
||||
<!ENTITY runtimePanel_simulators "Simulators">
|
||||
<!ENTITY runtimePanel_custom "Custom">
|
||||
<!ENTITY runtimePanel_usb "USB Devices">
|
||||
<!ENTITY runtimePanel_wifi "Wi-Fi Devices">
|
||||
<!ENTITY runtimePanel_simulator "Simulators">
|
||||
<!ENTITY runtimePanel_other "Other">
|
||||
<!ENTITY runtimePanel_installsimulator "Install Simulator">
|
||||
<!ENTITY runtimePanel_noadbhelper "Install ADB Helper">
|
||||
<!ENTITY runtimePanel_nousbdevice "Can't see your device?">
|
||||
|
@ -101,8 +101,6 @@
|
|||
<!ENTITY prefs_general_title "General">
|
||||
<!ENTITY prefs_restore "Restore Defaults">
|
||||
<!ENTITY prefs_simulators "Manage Simulators">
|
||||
<!ENTITY prefs_options_enablelocalruntime "Enable local runtime">
|
||||
<!ENTITY prefs_options_enablelocalruntime_tooltip "Allow WebIDE to connect to its own runtime (running browser instance)">
|
||||
<!ENTITY prefs_options_rememberlastproject "Remember last project">
|
||||
<!ENTITY prefs_options_rememberlastproject_tooltip "Restore previous project when WebIDE starts">
|
||||
<!ENTITY prefs_options_templatesurl "Templates URL">
|
||||
|
|
|
@ -1477,9 +1477,6 @@ Tab.prototype = {
|
|||
// stop about:blank from loading
|
||||
browser.stop();
|
||||
|
||||
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
|
||||
fl.renderMode = Ci.nsIFrameLoader.RENDER_MODE_ASYNC_SCROLL;
|
||||
|
||||
return browser;
|
||||
},
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ const Cu = Components.utils;
|
|||
|
||||
// The minimum sizes for the auto-resize panel code, minimum size necessary to
|
||||
// properly show the error page in the panel.
|
||||
const PANEL_MIN_HEIGHT = 200;
|
||||
const PANEL_MIN_HEIGHT = 190;
|
||||
const PANEL_MIN_WIDTH = 330;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
|
|
@ -187,6 +187,9 @@ browser.jar:
|
|||
skin/classic/browser/tabbrowser/tab-stroke-start.png (tabbrowser/tab-stroke-start.png)
|
||||
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
|
||||
skin/classic/browser/tabbrowser/tab-separator.png (tabbrowser/tab-separator.png)
|
||||
|
||||
skin/classic/browser/tabbrowser/pendingpaint.png (../shared/tabbrowser/pendingpaint.png)
|
||||
|
||||
skin/classic/browser/tabview/edit-light.png (tabview/edit-light.png)
|
||||
skin/classic/browser/tabview/search.png (tabview/search.png)
|
||||
skin/classic/browser/tabview/stack-expander.png (tabview/stack-expander.png)
|
||||
|
|
|
@ -302,6 +302,8 @@ browser.jar:
|
|||
skin/classic/browser/tabbrowser/tab-background-start@2x.png (tabbrowser/tab-background-start@2x.png)
|
||||
skin/classic/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
|
||||
|
||||
skin/classic/browser/tabbrowser/pendingpaint.png (../shared/tabbrowser/pendingpaint.png)
|
||||
|
||||
# NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in
|
||||
# Makefile.in with a non-default marker of "%" and the result of that gets packaged.
|
||||
skin/classic/browser/tabbrowser/tab-selected-end.svg (tab-selected-end.svg)
|
||||
|
|
|
@ -3,6 +3,7 @@ body {
|
|||
margin-top: 2em;
|
||||
font: message-box;
|
||||
font-size: 100%;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
p {
|
||||
|
|
|
@ -4,4 +4,39 @@
|
|||
|
||||
#errorPageContainer {
|
||||
background-image: url("chrome://global/skin/icons/information-64.png");
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* tablist starts out hidden, but JS may make it visible in response to
|
||||
clicks on the radio buttons by setting an "available" attribute.
|
||||
*/
|
||||
#tabList {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#tabList[available] {
|
||||
display: -moz-box;
|
||||
}
|
||||
|
||||
.radioRestoreContainer {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.radioRestoreButton {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.radioRestoreButton:-moz-focusring {
|
||||
outline: 1px dotted black;
|
||||
}
|
||||
|
||||
.radioChooseLabel {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
/* We want errorTrailerDesc to have the same padding-top as errorShortDesc
|
||||
has padding-bottom
|
||||
*/
|
||||
#errorTrailerDesc {
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 155 KiB |
|
@ -208,6 +208,8 @@ browser.jar:
|
|||
skin/classic/browser/tabbrowser/tab-background-end@2x.png (tabbrowser/tab-background-end@2x.png)
|
||||
skin/classic/browser/tabbrowser/tab-overflow-indicator.png (../shared/tabbrowser/tab-overflow-indicator.png)
|
||||
|
||||
skin/classic/browser/tabbrowser/pendingpaint.png (../shared/tabbrowser/pendingpaint.png)
|
||||
|
||||
# NOTE: The following two files (tab-selected-end.svg, tab-selected-start.svg) get pre-processed in
|
||||
# Makefile.in with a non-default marker of "%" and the result of that gets packaged.
|
||||
skin/classic/browser/tabbrowser/tab-selected-end.svg (tab-selected-end.svg)
|
||||
|
|
|
@ -61,6 +61,9 @@ ROBOCOP_FILES := \
|
|||
$(wildcard $(TESTPATH)/test*.js) \
|
||||
$(wildcard $(TESTPATH)/robocop*.js) \
|
||||
$(wildcard $(TESTPATH)/*.xml) \
|
||||
$(wildcard $(TESTPATH)/*.ogg) \
|
||||
$(wildcard $(TESTPATH)/*.mp4) \
|
||||
$(wildcard $(TESTPATH)/*.webm) \
|
||||
$(wildcard $(TESTPATH)/*.swf) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ CERT_StartCertificateRequestAttributes
|
|||
CERT_SubjectPublicKeyInfoTemplate DATA
|
||||
CERT_TimeChoiceTemplate DATA
|
||||
CERT_VerifyCertificate
|
||||
CERT_VerifyCertName
|
||||
CERT_VerifySignedDataWithPublicKeyInfo
|
||||
DER_AsciiToTime_Util
|
||||
DER_DecodeTimeChoice_Util
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "nsAttrAndChildArray.h"
|
||||
#include "mozFlushType.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "nsAttrAndChildArray.h" // member
|
||||
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
|
||||
#include "nsIContent.h" // base class
|
||||
#include "nsIDOMXPathNSResolver.h" // base class
|
||||
#include "nsINodeList.h" // base class
|
||||
#include "nsIWeakReference.h" // base class
|
||||
#include "nsNodeUtils.h" // class member nsNodeUtils::CloneNodeImpl
|
||||
|
@ -83,29 +82,6 @@ private:
|
|||
nsINode* mNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* A tearoff class for FragmentOrElement to implement additional interfaces
|
||||
*/
|
||||
class nsNode3Tearoff : public nsIDOMXPathNSResolver
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsNode3Tearoff)
|
||||
|
||||
NS_DECL_NSIDOMXPATHNSRESOLVER
|
||||
|
||||
explicit nsNode3Tearoff(nsINode *aNode) : mNode(aNode)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~nsNode3Tearoff() {}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* A class that implements nsIWeakReference
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,6 @@ class nsIDOMDocumentType;
|
|||
class nsIDOMElement;
|
||||
class nsIDOMNodeFilter;
|
||||
class nsIDOMNodeList;
|
||||
class nsIDOMXPathNSResolver;
|
||||
class nsIHTMLCollection;
|
||||
class nsILayoutHistoryState;
|
||||
class nsILoadContext;
|
||||
|
@ -125,6 +124,7 @@ class TreeWalker;
|
|||
class UndoManager;
|
||||
class XPathEvaluator;
|
||||
class XPathExpression;
|
||||
class XPathNSResolver;
|
||||
class XPathResult;
|
||||
template<typename> class OwningNonNull;
|
||||
template<typename> class Sequence;
|
||||
|
@ -135,8 +135,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
|
|||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x42a263db, 0x6ac6, 0x40ff, \
|
||||
{ 0x89, 0xe2, 0x25, 0x12, 0xe4, 0xbc, 0x2d, 0x2d } }
|
||||
{ 0xbab5b447, 0x7e23, 0x4cdd, \
|
||||
{ 0xac, 0xe5, 0xaa, 0x04, 0x26, 0x87, 0x2b, 0x97 } }
|
||||
|
||||
// Enum for requesting a particular type of document when creating a doc
|
||||
enum DocumentFlavor {
|
||||
|
@ -2318,13 +2318,12 @@ public:
|
|||
void LoadBindingDocument(const nsAString& aURI, mozilla::ErrorResult& rv);
|
||||
mozilla::dom::XPathExpression*
|
||||
CreateExpression(const nsAString& aExpression,
|
||||
nsIDOMXPathNSResolver* aResolver,
|
||||
mozilla::dom::XPathNSResolver* aResolver,
|
||||
mozilla::ErrorResult& rv);
|
||||
already_AddRefed<nsIDOMXPathNSResolver>
|
||||
CreateNSResolver(nsINode* aNodeResolver, mozilla::ErrorResult& rv);
|
||||
nsINode* CreateNSResolver(nsINode& aNodeResolver);
|
||||
already_AddRefed<mozilla::dom::XPathResult>
|
||||
Evaluate(JSContext* aCx, const nsAString& aExpression, nsINode* aContextNode,
|
||||
nsIDOMXPathNSResolver* aResolver, uint16_t aType,
|
||||
mozilla::dom::XPathNSResolver* aResolver, uint16_t aType,
|
||||
JS::Handle<JSObject*> aResult, mozilla::ErrorResult& rv);
|
||||
// Touch event handlers already on nsINode
|
||||
already_AddRefed<mozilla::dom::Touch>
|
||||
|
|
|
@ -16,7 +16,7 @@ interface nsIDOMElement;
|
|||
interface nsITabParent;
|
||||
interface nsILoadContext;
|
||||
|
||||
[scriptable, builtinclass, uuid(55a772b8-855a-4c5f-b4a1-284b6b3bec28)]
|
||||
[scriptable, builtinclass, uuid(7600aa92-88dc-491c-896d-0564159b6a66)]
|
||||
interface nsIFrameLoader : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -116,24 +116,6 @@ interface nsIFrameLoader : nsISupports
|
|||
*/
|
||||
void requestNotifyAfterRemotePaint();
|
||||
|
||||
/**
|
||||
* The default rendering mode is synchronous scrolling. In this
|
||||
* mode, it's an error to try to set a target viewport.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_DEFAULT = 0x00000000;
|
||||
|
||||
/**
|
||||
* When asynchronous scrolling is enabled, a target viewport can be
|
||||
* set to transform content pixels wrt its CSS viewport.
|
||||
*
|
||||
* NB: when async scrolling is enabled, it's the *user's*
|
||||
* responsibility to update the target scroll offset. In effect,
|
||||
* the platform hands over control of scroll offset to the user.
|
||||
*/
|
||||
const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001;
|
||||
|
||||
attribute unsigned long renderMode;
|
||||
|
||||
/**
|
||||
* The default event mode automatically forwards the events
|
||||
* handled in EventStateManager::HandleCrossProcessEvent to
|
||||
|
|
|
@ -106,8 +106,6 @@ NS_INTERFACE_TABLE_HEAD(Attr)
|
|||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(Attr)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
||||
new nsNodeSupportsWeakRefTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
|
||||
new nsNode3Tearoff(this))
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(Attr)
|
||||
|
|
|
@ -448,23 +448,6 @@ nsChildContentList::IndexOf(nsIContent* aContent)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(nsNode3Tearoff, mNode)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNode3Tearoff)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mNode)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNode3Tearoff)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3Tearoff)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
|
||||
nsAString& aNamespaceURI)
|
||||
{
|
||||
mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIHTMLCollection*
|
||||
FragmentOrElement::Children()
|
||||
{
|
||||
|
@ -1962,8 +1945,6 @@ NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
|
|||
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
||||
new nsNodeSupportsWeakRefTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
|
||||
new nsNode3Tearoff(this))
|
||||
// DOM bindings depend on the identity pointer being the
|
||||
// same as nsINode (which nsIContent inherits).
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
||||
|
|
|
@ -99,7 +99,6 @@
|
|||
|
||||
#include "nsBidiUtils.h"
|
||||
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
|
||||
|
@ -210,6 +209,7 @@
|
|||
#include "nsISecurityConsoleMessage.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "mozilla/dom/XPathEvaluator.h"
|
||||
#include "mozilla/dom/XPathNSResolverBinding.h"
|
||||
#include "mozilla/dom/XPathResult.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDocumentActivity.h"
|
||||
|
@ -1778,8 +1778,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
|
|||
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMXPathEvaluator)
|
||||
NS_INTERFACE_TABLE_END
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDocument)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
|
||||
new nsNode3Tearoff(this))
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
|
@ -12314,22 +12312,21 @@ nsIDocument::Constructor(const GlobalObject& aGlobal,
|
|||
|
||||
XPathExpression*
|
||||
nsIDocument::CreateExpression(const nsAString& aExpression,
|
||||
nsIDOMXPathNSResolver* aResolver,
|
||||
XPathNSResolver* aResolver,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
return XPathEvaluator()->CreateExpression(aExpression, aResolver, rv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMXPathNSResolver>
|
||||
nsIDocument::CreateNSResolver(nsINode* aNodeResolver,
|
||||
ErrorResult& rv)
|
||||
nsINode*
|
||||
nsIDocument::CreateNSResolver(nsINode& aNodeResolver)
|
||||
{
|
||||
return XPathEvaluator()->CreateNSResolver(aNodeResolver, rv);
|
||||
return XPathEvaluator()->CreateNSResolver(aNodeResolver);
|
||||
}
|
||||
|
||||
already_AddRefed<XPathResult>
|
||||
nsIDocument::Evaluate(JSContext* aCx, const nsAString& aExpression,
|
||||
nsINode* aContextNode, nsIDOMXPathNSResolver* aResolver,
|
||||
nsINode* aContextNode, XPathNSResolver* aResolver,
|
||||
uint16_t aType, JS::Handle<JSObject*> aResult,
|
||||
ErrorResult& rv)
|
||||
{
|
||||
|
@ -12337,16 +12334,9 @@ nsIDocument::Evaluate(JSContext* aCx, const nsAString& aExpression,
|
|||
aType, aResult, rv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::CreateNSResolver(nsIDOMNode* aNodeResolver,
|
||||
nsIDOMXPathNSResolver** aResult)
|
||||
{
|
||||
return XPathEvaluator()->CreateNSResolver(aNodeResolver, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::Evaluate(const nsAString& aExpression, nsIDOMNode* aContextNode,
|
||||
nsIDOMXPathNSResolver* aResolver, uint16_t aType,
|
||||
nsIDOMNode* aResolver, uint16_t aType,
|
||||
nsISupports* aInResult, nsISupports** aResult)
|
||||
{
|
||||
return XPathEvaluator()->Evaluate(aExpression, aContextNode, aResolver, aType,
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsAttrAndChildArray.h"
|
||||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
|
|
@ -171,7 +171,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
|
|||
, mCurrentRemoteFrame(nullptr)
|
||||
, mRemoteBrowser(nullptr)
|
||||
, mChildID(0)
|
||||
, mRenderMode(RENDER_MODE_DEFAULT)
|
||||
, mEventMode(EVENT_MODE_NORMAL_DISPATCH)
|
||||
, mPendingFrameSent(false)
|
||||
{
|
||||
|
@ -1952,24 +1951,6 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetRenderMode(uint32_t* aRenderMode)
|
||||
{
|
||||
*aRenderMode = mRenderMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::SetRenderMode(uint32_t aRenderMode)
|
||||
{
|
||||
if (aRenderMode == mRenderMode) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mRenderMode = aRenderMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::GetEventMode(uint32_t* aEventMode)
|
||||
{
|
||||
|
|
|
@ -69,11 +69,6 @@ protected:
|
|||
~nsFrameLoader();
|
||||
|
||||
public:
|
||||
bool AsyncScrollEnabled() const
|
||||
{
|
||||
return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
|
||||
}
|
||||
|
||||
static nsFrameLoader* Create(mozilla::dom::Element* aOwner,
|
||||
bool aNetworkCreated);
|
||||
|
||||
|
@ -367,11 +362,6 @@ private:
|
|||
TabParent* mRemoteBrowser;
|
||||
uint64_t mChildID;
|
||||
|
||||
// See nsIFrameLoader.idl. Short story, if !(mRenderMode &
|
||||
// RENDER_MODE_ASYNC_SCROLL), all the fields below are ignored in
|
||||
// favor of what content tells.
|
||||
uint32_t mRenderMode;
|
||||
|
||||
// See nsIFrameLoader.idl. EVENT_MODE_NORMAL_DISPATCH automatically
|
||||
// forwards some input events to out-of-process content.
|
||||
uint32_t mEventMode;
|
||||
|
|
|
@ -130,8 +130,6 @@ NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)
|
|||
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
||||
new nsNodeSupportsWeakRefTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
|
||||
new nsNode3Tearoff(this))
|
||||
// DOM bindings depend on the identity pointer being the
|
||||
// same as nsINode (which nsIContent inherits).
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
||||
|
|
|
@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429785
|
|||
const serv = Components.classes["@mozilla.org/consoleservice;1"]
|
||||
.getService(Components.interfaces.nsIConsoleService);
|
||||
var listener = {
|
||||
QueryInteface : function(iid) {
|
||||
QueryInterface : function(iid) {
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsIConsoleListener)) {
|
||||
throw Components.results.NS_NOINTERFACE;
|
||||
|
|
|
@ -31,7 +31,7 @@ function checkData(xhr, data, mapped, cb) {
|
|||
ok(ct.indexOf("mem-mapped") == -1, "Data is not memory-mapped");
|
||||
}
|
||||
ok(xhr.response, "Data is non-null");
|
||||
var str = String.fromCharCode.apply(null, Uint8Array(xhr.response));
|
||||
var str = String.fromCharCode.apply(null, new Uint8Array(xhr.response));
|
||||
ok(str == data, "Data is correct");
|
||||
cb();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ function is(a, b, msg) {
|
|||
|
||||
function checkData(response, data_head, cb) {
|
||||
ok(response, "Data is non-null");
|
||||
var str = String.fromCharCode.apply(null, Uint8Array(response));
|
||||
var str = String.fromCharCode.apply(null, new Uint8Array(response));
|
||||
ok(str.length == data_head.length + gPaddingSize, "Data size is correct");
|
||||
ok(str.slice(0, data_head.length) == data_head, "Data head is correct");
|
||||
ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
|
||||
|
|
|
@ -228,7 +228,7 @@ GetAppPaths(nsCString &aAppPath, nsCString &aAppBinaryPath)
|
|||
}
|
||||
|
||||
void
|
||||
GMPChild::OnChannelConnected(int32_t aPid)
|
||||
GMPChild::StartMacSandbox()
|
||||
{
|
||||
nsAutoCString pluginDirectoryPath, pluginFilePath;
|
||||
if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
|
||||
|
@ -253,13 +253,6 @@ GMPChild::OnChannelConnected(int32_t aPid)
|
|||
NS_WARNING(err.get());
|
||||
MOZ_CRASH("sandbox_init() failed");
|
||||
}
|
||||
|
||||
if (!LoadPluginLibrary(mPluginPath)) {
|
||||
err.AppendPrintf("Failed to load GMP plugin \"%s\"",
|
||||
mPluginPath.c_str());
|
||||
NS_WARNING(err.get());
|
||||
MOZ_CRASH("Failed to load GMP plugin");
|
||||
}
|
||||
}
|
||||
#endif // XP_MACOSX && MOZ_GMP_SANDBOX
|
||||
|
||||
|
@ -332,6 +325,8 @@ GMPChild::RecvStartPlugin()
|
|||
|
||||
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
|
||||
mozilla::SandboxTarget::Instance()->StartSandbox();
|
||||
#elif defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
StartMacSandbox();
|
||||
#endif
|
||||
|
||||
return LoadPluginLibrary(mPluginPath);
|
||||
|
|
|
@ -25,10 +25,6 @@ public:
|
|||
GMPChild();
|
||||
virtual ~GMPChild();
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
void OnChannelConnected(int32_t aPid);
|
||||
#endif
|
||||
|
||||
bool Init(const std::string& aPluginPath,
|
||||
base::ProcessHandle aParentProcessHandle,
|
||||
MessageLoop* aIOLoop,
|
||||
|
@ -51,6 +47,10 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
void StartMacSandbox();
|
||||
#endif
|
||||
|
||||
virtual bool RecvSetNodeId(const nsCString& aNodeId) MOZ_OVERRIDE;
|
||||
virtual bool RecvStartPlugin() MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "MockMediaDecoderOwner.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
#include "mtransport/runnable_utils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -19,6 +18,8 @@ using namespace mozilla::dom;
|
|||
class TestBinding
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TestBinding);
|
||||
|
||||
nsRefPtr<MP4Decoder> decoder;
|
||||
nsRefPtr<MockMediaResource> resource;
|
||||
nsRefPtr<MP4Reader> reader;
|
||||
|
@ -35,14 +36,17 @@ public:
|
|||
decoder->SetResource(resource);
|
||||
|
||||
reader->Init(nullptr);
|
||||
}
|
||||
|
||||
void Init() {
|
||||
nsCOMPtr<nsIThread> thread;
|
||||
nsresult rv = NS_NewThread(getter_AddRefs(thread),
|
||||
WrapRunnable(this, &TestBinding::ReadMetadata));
|
||||
NS_NewRunnableMethod(this, &TestBinding::ReadMetadata));
|
||||
EXPECT_EQ(NS_OK, rv);
|
||||
thread->Shutdown();
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~TestBinding()
|
||||
{
|
||||
decoder = nullptr;
|
||||
|
@ -51,7 +55,6 @@ public:
|
|||
SharedThreadPool::SpinUntilShutdown();
|
||||
}
|
||||
|
||||
private:
|
||||
void ReadMetadata()
|
||||
{
|
||||
MediaInfo info;
|
||||
|
@ -62,13 +65,14 @@ private:
|
|||
|
||||
TEST(MP4Reader, BufferedRange)
|
||||
{
|
||||
TestBinding b;
|
||||
nsRefPtr<TestBinding> b = new TestBinding();
|
||||
b->Init();
|
||||
|
||||
// Video 3-4 sec, audio 2.986666-4.010666 sec
|
||||
b.resource->MockAddBufferedRange(248400, 327455);
|
||||
b->resource->MockAddBufferedRange(248400, 327455);
|
||||
|
||||
nsRefPtr<TimeRanges> ranges = new TimeRanges();
|
||||
EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(1U, ranges->Length());
|
||||
double start = 0;
|
||||
EXPECT_EQ(NS_OK, ranges->Start(0, &start));
|
||||
|
@ -80,15 +84,16 @@ TEST(MP4Reader, BufferedRange)
|
|||
|
||||
TEST(MP4Reader, BufferedRangeMissingLastByte)
|
||||
{
|
||||
TestBinding b;
|
||||
nsRefPtr<TestBinding> b = new TestBinding();
|
||||
b->Init();
|
||||
|
||||
// Dropping the last byte of the video
|
||||
b.resource->MockClearBufferedRanges();
|
||||
b.resource->MockAddBufferedRange(248400, 324912);
|
||||
b.resource->MockAddBufferedRange(324913, 327455);
|
||||
b->resource->MockClearBufferedRanges();
|
||||
b->resource->MockAddBufferedRange(248400, 324912);
|
||||
b->resource->MockAddBufferedRange(324913, 327455);
|
||||
|
||||
nsRefPtr<TimeRanges> ranges = new TimeRanges();
|
||||
EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(1U, ranges->Length());
|
||||
double start = 0;
|
||||
EXPECT_EQ(NS_OK, ranges->Start(0, &start));
|
||||
|
@ -100,15 +105,16 @@ TEST(MP4Reader, BufferedRangeMissingLastByte)
|
|||
|
||||
TEST(MP4Reader, BufferedRangeSyncFrame)
|
||||
{
|
||||
TestBinding b;
|
||||
nsRefPtr<TestBinding> b = new TestBinding();
|
||||
b->Init();
|
||||
|
||||
// Check that missing the first byte at 2 seconds skips right through to 3
|
||||
// seconds because of a missing sync frame
|
||||
b.resource->MockClearBufferedRanges();
|
||||
b.resource->MockAddBufferedRange(146336, 327455);
|
||||
b->resource->MockClearBufferedRanges();
|
||||
b->resource->MockAddBufferedRange(146336, 327455);
|
||||
|
||||
nsRefPtr<TimeRanges> ranges = new TimeRanges();
|
||||
EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(1U, ranges->Length());
|
||||
double start = 0;
|
||||
EXPECT_EQ(NS_OK, ranges->Start(0, &start));
|
||||
|
@ -120,7 +126,8 @@ TEST(MP4Reader, BufferedRangeSyncFrame)
|
|||
|
||||
TEST(MP4Reader, CompositionOrder)
|
||||
{
|
||||
TestBinding b("mediasource_test.mp4");
|
||||
nsRefPtr<TestBinding> b = new TestBinding("mediasource_test.mp4");
|
||||
b->Init();
|
||||
|
||||
// The first 5 video samples of this file are:
|
||||
// Video timescale=2500
|
||||
|
@ -145,27 +152,27 @@ TEST(MP4Reader, CompositionOrder)
|
|||
// 10 12616 580 9226 1015 Yes
|
||||
// 11 13220 581 10241 1014 Yes
|
||||
|
||||
b.resource->MockClearBufferedRanges();
|
||||
b->resource->MockClearBufferedRanges();
|
||||
// First two frames in decoding + first audio frame
|
||||
b.resource->MockAddBufferedRange(48, 5503); // Video 1
|
||||
b.resource->MockAddBufferedRange(5503, 5648); // Video 2
|
||||
b.resource->MockAddBufferedRange(6228, 6803); // Video 3
|
||||
b->resource->MockAddBufferedRange(48, 5503); // Video 1
|
||||
b->resource->MockAddBufferedRange(5503, 5648); // Video 2
|
||||
b->resource->MockAddBufferedRange(6228, 6803); // Video 3
|
||||
|
||||
// Audio - 5 frames; 0 - 139206 us
|
||||
b.resource->MockAddBufferedRange(5648, 6228);
|
||||
b.resource->MockAddBufferedRange(6803, 7383);
|
||||
b.resource->MockAddBufferedRange(7618, 8199);
|
||||
b.resource->MockAddBufferedRange(8199, 8779);
|
||||
b.resource->MockAddBufferedRange(8962, 9563);
|
||||
b.resource->MockAddBufferedRange(9734, 10314);
|
||||
b.resource->MockAddBufferedRange(10314, 10895);
|
||||
b.resource->MockAddBufferedRange(11207, 11787);
|
||||
b.resource->MockAddBufferedRange(12035, 12616);
|
||||
b.resource->MockAddBufferedRange(12616, 13196);
|
||||
b.resource->MockAddBufferedRange(13220, 13901);
|
||||
b->resource->MockAddBufferedRange(5648, 6228);
|
||||
b->resource->MockAddBufferedRange(6803, 7383);
|
||||
b->resource->MockAddBufferedRange(7618, 8199);
|
||||
b->resource->MockAddBufferedRange(8199, 8779);
|
||||
b->resource->MockAddBufferedRange(8962, 9563);
|
||||
b->resource->MockAddBufferedRange(9734, 10314);
|
||||
b->resource->MockAddBufferedRange(10314, 10895);
|
||||
b->resource->MockAddBufferedRange(11207, 11787);
|
||||
b->resource->MockAddBufferedRange(12035, 12616);
|
||||
b->resource->MockAddBufferedRange(12616, 13196);
|
||||
b->resource->MockAddBufferedRange(13220, 13901);
|
||||
|
||||
nsRefPtr<TimeRanges> ranges = new TimeRanges();
|
||||
EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(2U, ranges->Length());
|
||||
|
||||
double start = 0;
|
||||
|
@ -185,7 +192,8 @@ TEST(MP4Reader, CompositionOrder)
|
|||
|
||||
TEST(MP4Reader, Normalised)
|
||||
{
|
||||
TestBinding b("mediasource_test.mp4");
|
||||
nsRefPtr<TestBinding> b = new TestBinding("mediasource_test.mp4");
|
||||
b->Init();
|
||||
|
||||
// The first 5 video samples of this file are:
|
||||
// Video timescale=2500
|
||||
|
@ -210,11 +218,11 @@ TEST(MP4Reader, Normalised)
|
|||
// 10 12616 580 9226 1015 Yes
|
||||
// 11 13220 581 10241 1014 Yes
|
||||
|
||||
b.resource->MockClearBufferedRanges();
|
||||
b.resource->MockAddBufferedRange(48, 13901);
|
||||
b->resource->MockClearBufferedRanges();
|
||||
b->resource->MockAddBufferedRange(48, 13901);
|
||||
|
||||
nsRefPtr<TimeRanges> ranges = new TimeRanges();
|
||||
EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
|
||||
EXPECT_EQ(1U, ranges->Length());
|
||||
|
||||
double start = 0;
|
||||
|
|
|
@ -27,7 +27,7 @@ function bail(message)
|
|||
function ArrayBufferToString(arr)
|
||||
{
|
||||
var str = '';
|
||||
var view = Uint8Array(arr);
|
||||
var view = new Uint8Array(arr);
|
||||
for (var i = 0; i < view.length; i++) {
|
||||
str += String.fromCharCode(view[i]);
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ function ArrayBufferToString(arr)
|
|||
|
||||
function StringToArrayBuffer(str)
|
||||
{
|
||||
var arr = ArrayBuffer(str.length);
|
||||
var view = Uint8Array(arr);
|
||||
var arr = new ArrayBuffer(str.length);
|
||||
var view = new Uint8Array(arr);
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
view[i] = str.charCodeAt(i);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
@ -428,13 +427,7 @@ nsXULTemplateQueryProcessorXML::CreateExpression(const nsAString& aExpr,
|
|||
nsINode* aNode,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXPathNSResolver> nsResolver =
|
||||
aNode->OwnerDoc()->CreateNSResolver(aNode, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mEvaluator->CreateExpression(aExpr, nsResolver, aRv);
|
||||
return mEvaluator->CreateExpression(aExpr, aNode, aRv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
var data = xhr.response;
|
||||
ok(data, "Data is non-null");
|
||||
var str = String.fromCharCode.apply(null, Uint8Array(data));
|
||||
var str = String.fromCharCode.apply(null, new Uint8Array(data));
|
||||
is(str.length, data_head.length + gPaddingSize, "Data size is correct");
|
||||
is(str.slice(0, data_head.length), data_head, "Data head is correct");
|
||||
ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
|
||||
|
|
|
@ -91,7 +91,6 @@
|
|||
#include "nsITreeView.h"
|
||||
#include "nsIXULTemplateBuilder.h"
|
||||
#endif
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
|
||||
#include "nsIEventListenerService.h"
|
||||
#include "nsIMessageManager.h"
|
||||
|
@ -247,9 +246,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(XPathNSResolver, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(MozSmsMessage, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
|
@ -694,10 +690,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(XPathNSResolver, nsIDOMXPathNSResolver)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathNSResolver)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MozSmsMessage, nsIDOMMozSmsMessage)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsMessage)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
|
|
@ -32,9 +32,6 @@ DOMCI_CLASS(XULTreeBuilder)
|
|||
DOMCI_CLASS(CSSMozDocumentRule)
|
||||
DOMCI_CLASS(CSSSupportsRule)
|
||||
|
||||
// DOM Level 3 XPath objects
|
||||
DOMCI_CLASS(XPathNSResolver)
|
||||
|
||||
DOMCI_CLASS(MozSmsMessage)
|
||||
DOMCI_CLASS(MozMmsMessage)
|
||||
DOMCI_CLASS(MozMobileMessageThread)
|
||||
|
|
|
@ -1863,5 +1863,4 @@ addExternalIface('StackFrame', nativeType='nsIStackFrame',
|
|||
headerFile='nsIException.h', notflattened=True)
|
||||
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
|
||||
notflattened=True)
|
||||
addExternalIface('XPathNSResolver')
|
||||
addExternalIface('XULCommandDispatcher')
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
* 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 "mozilla/gfx/2D.h"
|
||||
#include "mozilla/ipc/DocumentRendererParent.h"
|
||||
|
||||
#include "gfx2DGlue.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "gfxPattern.h"
|
||||
#include "nsICanvasRenderingContextInternal.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -31,23 +33,18 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
|
|||
if (!mCanvas || !mCanvasContext)
|
||||
return;
|
||||
|
||||
DrawTarget* drawTarget = mCanvasContext->GetDrawTarget();
|
||||
Rect rect(0, 0, aSize.width, aSize.height);
|
||||
MaybeSnapToDevicePixels(rect, *drawTarget, true);
|
||||
RefPtr<DataSourceSurface> dataSurface =
|
||||
Factory::CreateWrappingDataSourceSurface(reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aData).BeginWriting()),
|
||||
aSize.width * 4,
|
||||
IntSize(aSize.width, aSize.height),
|
||||
SurfaceFormat::B8G8R8A8);
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(dataSurface, Matrix());
|
||||
SurfacePattern pattern(dataSurface, ExtendMode::CLAMP);
|
||||
drawTarget->FillRect(rect, pattern);
|
||||
|
||||
gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));
|
||||
mCanvasContext->NewPath();
|
||||
mCanvasContext->PixelSnappedRectangleAndSetPattern(rect, pat);
|
||||
mCanvasContext->Fill();
|
||||
|
||||
// get rid of the pattern surface ref, because aData is very
|
||||
// likely to go away shortly
|
||||
mCanvasContext->SetColor(gfxRGBA(1,1,1,1));
|
||||
|
||||
gfxRect damageRect = mCanvasContext->UserToDevice(rect);
|
||||
gfxRect damageRect = mCanvasContext->UserToDevice(ThebesRect(rect));
|
||||
mCanvas->Redraw(damageRect);
|
||||
}
|
||||
|
||||
|
|
|
@ -909,6 +909,11 @@ WebGLContext::SetDimensions(int32_t sWidth, int32_t sHeight)
|
|||
mViewportWidth = mWidth;
|
||||
mViewportHeight = mHeight;
|
||||
|
||||
// Update mOptions.
|
||||
mOptions.depth = gl->Caps().depth;
|
||||
mOptions.stencil = gl->Caps().stencil;
|
||||
mOptions.antialias = gl->Caps().antialias;
|
||||
|
||||
// Make sure that we clear this out, otherwise
|
||||
// we'll end up displaying random memory
|
||||
gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
|
||||
|
@ -925,9 +930,9 @@ WebGLContext::SetDimensions(int32_t sWidth, int32_t sHeight)
|
|||
|
||||
MOZ_ASSERT(gl->Caps().color);
|
||||
MOZ_ASSERT(gl->Caps().alpha == mOptions.alpha);
|
||||
MOZ_ASSERT(gl->Caps().depth == mOptions.depth || !gl->Caps().depth);
|
||||
MOZ_ASSERT(gl->Caps().stencil == mOptions.stencil || !gl->Caps().stencil);
|
||||
MOZ_ASSERT(gl->Caps().antialias == mOptions.antialias || !gl->Caps().antialias);
|
||||
MOZ_ASSERT(gl->Caps().depth == mOptions.depth);
|
||||
MOZ_ASSERT(gl->Caps().stencil == mOptions.stencil);
|
||||
MOZ_ASSERT(gl->Caps().antialias == mOptions.antialias);
|
||||
MOZ_ASSERT(gl->Caps().preserve == mOptions.preserveDrawingBuffer);
|
||||
|
||||
if (gl->WorkAroundDriverBugs() && gl->IsANGLE()) {
|
||||
|
|
|
@ -4,31 +4,30 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLVertexAttribData.h"
|
||||
#include "WebGLShader.h"
|
||||
#include "WebGLProgram.h"
|
||||
#include "WebGLUniformLocation.h"
|
||||
#include "WebGLFramebuffer.h"
|
||||
#include "WebGLRenderbuffer.h"
|
||||
#include "WebGLTexture.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
#include "GLContext.h"
|
||||
#include "CanvasUtils.h"
|
||||
#include "WebGLContextUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "angle/ShaderLang.h"
|
||||
#include "CanvasUtils.h"
|
||||
#include "GLContext.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#include "angle/ShaderLang.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContextUtils.h"
|
||||
#include "WebGLFramebuffer.h"
|
||||
#include "WebGLProgram.h"
|
||||
#include "WebGLRenderbuffer.h"
|
||||
#include "WebGLShader.h"
|
||||
#include "WebGLTexture.h"
|
||||
#include "WebGLUniformLocation.h"
|
||||
#include "WebGLVertexArray.h"
|
||||
#include "WebGLVertexAttribData.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_COCOA)
|
||||
#include "nsCocoaFeatures.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -1668,7 +1667,10 @@ WebGLContext::InitAndValidateGL()
|
|||
|
||||
#ifdef XP_MACOSX
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
gl->Vendor() == gl::GLVendor::ATI) {
|
||||
gl->Vendor() == gl::GLVendor::ATI &&
|
||||
nsCocoaFeatures::OSXVersionMajor() == 10 &&
|
||||
nsCocoaFeatures::OSXVersionMinor() < 9)
|
||||
{
|
||||
// The Mac ATI driver, in all known OSX version up to and including 10.8,
|
||||
// renders points sprites upside-down. Apple bug 11778921
|
||||
gl->fPointParameterf(LOCAL_GL_POINT_SPRITE_COORD_ORIGIN, LOCAL_GL_LOWER_LEFT);
|
||||
|
|
|
@ -61,7 +61,7 @@ let gTestCases = [
|
|||
// Create with array buffer view data.
|
||||
{
|
||||
text: "Kunming is in Yunnan province of China.",
|
||||
get data() { return Uint8Array(str2array(this.text)); },
|
||||
get data() { return new Uint8Array(str2array(this.text)); },
|
||||
shouldPass: true,
|
||||
mode: "replace"
|
||||
},
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче