Skip to content

Commit

Permalink
merge fx-team to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Apr 23, 2015
2 parents 997a9de + 113727c commit 51a4f46
Show file tree
Hide file tree
Showing 68 changed files with 1,639 additions and 709 deletions.
7 changes: 3 additions & 4 deletions CLOBBER
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.

Bug 1155718: Merge Bluetooth v1/v2 files for all simple cases
Bug 1038068: Check add-on signatures and refuse to install unsigned or broken add-ons

This patch set renames source files. This requires updating the
build system's dependency information from scratch. The issue has
been reported in bug 1154232.
Not sure why this needs a clobber but tests perma-failed when they don't on
try.
3 changes: 3 additions & 0 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ pref("extensions.hotfix.certs.1.sha1Fingerprint", "91:53:98:0C:C1:86:DF:47:8F:35
// See the SCOPE constants in AddonManager.jsm for values to use here.
pref("extensions.autoDisableScopes", 15);

// Don't require signed add-ons by default
pref("xpinstall.signatures.required", false);

// Dictionary download preference
pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/");

Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/test/general/browser_fxa_oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ let gTests = [
Assert.ok(tabOpened);
Assert.equal(tokenData.code, "code1");
Assert.equal(tokenData.state, "state");
Assert.equal(keys.kAr, "kAr");
Assert.equal(keys.kBr, "kBr");
Assert.deepEqual(keys.kAr, {k: "kAr"});
Assert.deepEqual(keys.kBr, {k: "kBr"});
resolve();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
state: "state",
code: "code1",
closeWindow: "signin",
keys: { kAr: 'kAr', kBr: 'kBr' },
// Keys normally contain more information, but this is enough
// to keep Loop's tests happy.
keys: { kAr: { k: 'kAr' }, kBr: { k: 'kBr' }},
},
},
},
Expand Down
28 changes: 21 additions & 7 deletions browser/components/loop/LoopRooms.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ let LoopRoomsInternal = {
* information.
*/
promiseEncryptRoomData: Task.async(function* (roomData) {
// For now, disable encryption/context if context is disabled, or if
// FxA is turned on.
if (!MozLoopService.getLoopPref("contextInConverations.enabled") ||
this.sessionType == LOOP_SESSION_TYPE.FXA) {
// XXX We should only return unencrypted data whilst we're still working
// on context. Once bug 1115340 is fixed, this function should no longer be
// here.
function getUnencryptedData() {
var serverRoomData = extend({}, roomData);
delete serverRoomData.decryptedContext;

Expand All @@ -218,6 +218,11 @@ let LoopRoomsInternal = {
};
}

// For now, disable encryption/context if context is disabled
if (!MozLoopService.getLoopPref("contextInConverations.enabled")) {
return getUnencryptedData();
}

var newRoomData = extend({}, roomData);

if (!newRoomData.context) {
Expand All @@ -227,7 +232,17 @@ let LoopRoomsInternal = {
// First get the room key.
let key = yield this.promiseGetOrCreateRoomKey(newRoomData);

newRoomData.context.wrappedKey = yield this.promiseEncryptedRoomKey(key);
try {
newRoomData.context.wrappedKey = yield this.promiseEncryptedRoomKey(key);
}
catch (ex) {
// XXX Bug 1153788 should remove this, then we can remove the whole
// try/catch.
if (ex.message == "FxA re-register not implemented") {
return getUnencryptedData();
}
return Promise.reject(ex);
}

// Now encrypt the actual data.
newRoomData.context.value = yield loopCrypto.encryptBytes(key,
Expand Down Expand Up @@ -654,8 +669,7 @@ let LoopRoomsInternal = {
};

// If we're not encrypting currently, then only send the roomName.
if (!Services.prefs.getBoolPref("loop.contextInConverations.enabled") ||
this.sessionType == LOOP_SESSION_TYPE.FXA) {
if (!Services.prefs.getBoolPref("loop.contextInConverations.enabled")) {
sendData = {
roomName: newRoomName
};
Expand Down
18 changes: 15 additions & 3 deletions browser/components/loop/MozLoopService.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,9 @@ let MozLoopServiceInternal = {

gFxAOAuthClientPromise = this.promiseFxAOAuthParameters().then(
parameters => {
// Add the fact that we want keys to the parameters.
parameters.keys = true;

try {
gFxAOAuthClient = new FxAccountsOAuthClient({
parameters: parameters,
Expand Down Expand Up @@ -1031,7 +1034,10 @@ let MozLoopServiceInternal = {
* @param {Deferred} deferred used to resolve the gFxAOAuthClientPromise
* @param {Object} result (with code and state)
*/
_fxAOAuthComplete: function(deferred, result) {
_fxAOAuthComplete: function(deferred, result, keys) {
if (keys.kBr) {
Services.prefs.setCharPref("loop.key.fxa", keys.kBr.k);
}
gFxAOAuthClientPromise = null;
// Note: The state was already verified in FxAccountsOAuthClient.
deferred.resolve(result);
Expand Down Expand Up @@ -1331,8 +1337,14 @@ this.MozLoopService = {
return new Promise((resolve, reject) => {
if (this.userProfile) {
// We're an FxA user.
// XXX Bug 1153788 will implement this for FxA.
reject(new Error("unimplemented"));
if (Services.prefs.prefHasUserValue("loop.key.fxa")) {
resolve(MozLoopService.getLoopPref("key.fxa"));
return;
}

// XXX If we don't have a key for FxA yet, then simply reject for now.
// We'll create some sign-in/sign-out UX in bug 1153788.
reject(new Error("FxA re-register not implemented"));
return;
}

Expand Down
12 changes: 12 additions & 0 deletions browser/components/loop/content/shared/js/mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,18 @@ loop.shared.mixins = (function() {
rootObject.removeEventListener("resize", this.updateVideoContainer);
},

/**
* Resets the dimensions cache, e.g. for when the session is ended, and
* before a new session, so that we always ensure we see an update when a
* new session is started.
*/
resetDimensionsCache: function() {
this._videoDimensionsCache = {
local: {},
remote: {}
};
},

/**
* Whenever the dimensions change of a video stream, this function is called
* by `updateVideoDimensions` to store the new values and notifies the callee
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,12 @@ loop.standaloneRoomViews = (function(mozL10n) {
this.updateVideoContainer();
}

if (nextState.roomState === ROOM_STATES.INIT ||
nextState.roomState === ROOM_STATES.GATHER ||
nextState.roomState === ROOM_STATES.READY) {
this.resetDimensionsCache();
}

// When screen sharing stops.
if (this.state.receivingScreenShare && !nextState.receivingScreenShare) {
// Remove the custom screenshare styles on the remote camera.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,12 @@ loop.standaloneRoomViews = (function(mozL10n) {
this.updateVideoContainer();
}

if (nextState.roomState === ROOM_STATES.INIT ||
nextState.roomState === ROOM_STATES.GATHER ||
nextState.roomState === ROOM_STATES.READY) {
this.resetDimensionsCache();
}

// When screen sharing stops.
if (this.state.receivingScreenShare && !nextState.receivingScreenShare) {
// Remove the custom screenshare styles on the remote camera.
Expand Down
2 changes: 1 addition & 1 deletion browser/components/loop/test/mochitest/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ support-files =
google_service.sjs
head.js
loop_fxa.sjs
../../../../base/content/test/general/browser_fxa_oauth.html
../../../../base/content/test/general/browser_fxa_oauth_with_keys.html

[browser_CardDavImporter.js]
[browser_fxa_login.js]
Expand Down
2 changes: 1 addition & 1 deletion browser/components/loop/test/mochitest/loop_fxa.sjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function params(request, response) {
*/
function oauth_authorization(request, response) {
response.setStatusLine(request.httpVersion, 302, "Found");
response.setHeader("Location", "browser_fxa_oauth.html");
response.setHeader("Location", "browser_fxa_oauth_with_keys.html");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@ describe("loop.standaloneRoomViews", function() {

sinon.assert.calledOnce(view.updateVideoContainer);
});

it("should reset the video dimensions cache when the gather state is entered", function() {
activeRoomStore.setStoreState({roomState: ROOM_STATES.SESSION_CONNECTED});

var view = mountTestComponent();

activeRoomStore.setStoreState({roomState: ROOM_STATES.GATHER});

expect(view._videoDimensionsCache).eql({
local: {},
remote: {}
});
})
});

describe("#publishStream", function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* global Services, Assert */

const kGuestKeyPref = "loop.key";
const kFxAKeyPref = "loop.key.fxa";

do_register_cleanup(function() {
Services.prefs.clearUserPref(kGuestKeyPref);
Expand Down Expand Up @@ -33,12 +34,25 @@ add_task(function* test_guestGetKey() {
Assert.equal(key, kFakeKey, "should return existing key");
});

add_task(function* test_fxaGetKnownKey() {
const kFakeKey = "75312468";
// Set the userProfile to look like we're logged into FxA with a key stored.
MozLoopServiceInternal.fxAOAuthTokenData = { token_type: "bearer" };
MozLoopServiceInternal.fxAOAuthProfile = { email: "[email protected]" };
Services.prefs.setCharPref(kFxAKeyPref, kFakeKey);

let key = yield MozLoopService.promiseProfileEncryptionKey();

Assert.equal(key, kFakeKey, "should return existing key");
});

add_task(function* test_fxaGetKey() {
// Set the userProfile to look like we're logged into FxA.
// Set the userProfile to look like we're logged into FxA without a key stored.
MozLoopServiceInternal.fxAOAuthTokenData = { token_type: "bearer" };
MozLoopServiceInternal.fxAOAuthProfile = { email: "[email protected]" };
Services.prefs.clearUserPref(kFxAKeyPref);

// Currently unimplemented, add a test when we implement the code.
yield Assert.rejects(MozLoopService.promiseProfileEncryptionKey(),
/unimplemented/, "should reject as unimplemented");
/not implemented/, "should reject as unimplemented");
});
6 changes: 4 additions & 2 deletions browser/locales/en-US/chrome/browser/browser.properties
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,22 @@ addonsInstalledNeedsRestart=#1 will be installed after you restart #3.;#2 add-on
addonInstallRestartButton=Restart Now
addonInstallRestartButton.accesskey=R

# LOCALIZATION NOTE (addonError-1, addonError-2, addonError-3, addonError-4):
# LOCALIZATION NOTE (addonError-1, addonError-2, addonError-3, addonError-4, addonError-5):
# #1 is the add-on name, #2 is the host name, #3 is the application name
# #4 is the application version
addonError-1=The add-on could not be downloaded because of a connection failure on #2.
addonError-2=The add-on from #2 could not be installed because it does not match the add-on #3 expected.
addonError-3=The add-on downloaded from #2 could not be installed because it appears to be corrupt.
addonError-4=#1 could not be installed because #3 cannot modify the needed file.
addonError-5=#3 has prevented this site from installing an unverified add-on.

# LOCALIZATION NOTE (addonLocalError-1, addonLocalError-2, addonLocalError-3, addonLocalError-4, addonErrorIncompatible, addonErrorBlocklisted):
# LOCALIZATION NOTE (addonLocalError-1, addonLocalError-2, addonLocalError-3, addonLocalError-4, addonLocalError-5, addonErrorIncompatible, addonErrorBlocklisted):
# #1 is the add-on name, #3 is the application name, #4 is the application version
addonLocalError-1=This add-on could not be installed because of a filesystem error.
addonLocalError-2=This add-on could not be installed because it does not match the add-on #3 expected.
addonLocalError-3=This add-on could not be installed because it appears to be corrupt.
addonLocalError-4=#1 could not be installed because #3 cannot modify the needed file.
addonLocalError-5=This add-on could not be installed because it has not been verified.
addonErrorIncompatible=#1 could not be installed because it is not compatible with #3 #4.
addonErrorBlocklisted=#1 could not be installed because it has a high risk of causing stability or security problems.

Expand Down
1 change: 0 additions & 1 deletion ipc/chromium/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ UNIFIED_SOURCES += [
'src/base/pickle.cc',
'src/base/rand_util.cc',
'src/base/revocable_store.cc',
'src/base/scoped_temp_dir.cc',
'src/base/string_piece.cc',
'src/base/string_util.cc',
'src/base/thread.cc',
Expand Down
10 changes: 2 additions & 8 deletions ipc/chromium/src/base/file_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ void AppendToPath(std::wstring* path, const std::wstring& new_ending) {
path->push_back(FilePath::kSeparators[0]);
path->append(new_ending);
}
bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
bool recursive) {
return CopyDirectory(FilePath::FromWStringHack(from_path),
FilePath::FromWStringHack(to_path),
recursive);
}
bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) {
return CopyFile(FilePath::FromWStringHack(from_path),
FilePath::FromWStringHack(to_path));
Expand Down Expand Up @@ -172,8 +166,8 @@ bool CreateTemporaryFileName(std::wstring* temp_file) {
*temp_file = temp_file_path.ToWStringHack();
return true;
}
bool Delete(const std::wstring& path, bool recursive) {
return Delete(FilePath::FromWStringHack(path), recursive);
bool Delete(const std::wstring& path) {
return Delete(FilePath::FromWStringHack(path));
}
bool DirectoryExists(const std::wstring& path) {
return DirectoryExists(FilePath::FromWStringHack(path));
Expand Down
24 changes: 3 additions & 21 deletions ipc/chromium/src/base/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <sys/stat.h>
#elif defined(OS_POSIX)
#include <sys/types.h>
#include <fts.h>
#include <sys/stat.h>
#endif

Expand Down Expand Up @@ -87,34 +86,17 @@ void ReplaceExtension(std::wstring* file_name, const std::wstring& extension);

// Deletes the given path, whether it's a file or a directory.
// If it's a directory, it's perfectly happy to delete all of the
// directory's contents. Passing true to recursive deletes
// subdirectories and their contents as well.
// directory's contents.
// Returns true if successful, false otherwise.
//
// WARNING: USING THIS WITH recursive==true IS EQUIVALENT
// TO "rm -rf", SO USE WITH CAUTION.
bool Delete(const FilePath& path, bool recursive);
bool Delete(const FilePath& path);
// Deprecated temporary compatibility function.
bool Delete(const std::wstring& path, bool recursive);
bool Delete(const std::wstring& path);

// Copies a single file. Use CopyDirectory to copy directories.
bool CopyFile(const FilePath& from_path, const FilePath& to_path);
// Deprecated temporary compatibility function.
bool CopyFile(const std::wstring& from_path, const std::wstring& to_path);

// Copies the given path, and optionally all subdirectories and their contents
// as well.
// If there are files existing under to_path, always overwrite.
// Returns true if successful, false otherwise.
// Dont't use wildcards on the names, it may stop working without notice.
//
// If you only need to copy a file use CopyFile, it's faster.
bool CopyDirectory(const FilePath& from_path, const FilePath& to_path,
bool recursive);
// Deprecated temporary compatibility function.
bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
bool recursive);

// Returns true if the given path exists on the local filesystem,
// false otherwise.
bool PathExists(const FilePath& path);
Expand Down
Loading

0 comments on commit 51a4f46

Please sign in to comment.