Skip to content

Commit

Permalink
Merge fx-team to central, a=merge
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 9LaKI6lIClP
  • Loading branch information
KWierso committed Feb 26, 2016
2 parents ce31ad5 + 3e28971 commit f5d0907
Show file tree
Hide file tree
Showing 256 changed files with 3,003 additions and 2,349 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ browser/extensions/loop/**

# devtools/ exclusions
devtools/*.js
devtools/client/animationinspector/**
devtools/client/canvasdebugger/**
devtools/client/commandline/**
devtools/client/debugger/**
Expand All @@ -92,7 +91,6 @@ devtools/client/framework/**
devtools/client/inspector/computed/**
devtools/client/inspector/fonts/**
devtools/client/inspector/markup/test/**
devtools/client/inspector/rules/**
devtools/client/inspector/shared/test/**
devtools/client/inspector/test/**
devtools/client/inspector/*.js
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ID
/.mozconfig*
/mozconfig
/configure
/old-configure
/config.cache
/config.log
/.clang_complete
Expand All @@ -40,6 +41,7 @@ _OPT.OBJ/

# SpiderMonkey configury
js/src/configure
js/src/old-configure
js/src/autom4te.cache
# SpiderMonkey test result logs
js/src/tests/results-*.html
Expand Down
2 changes: 2 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
^\.mozconfig
^mozconfig*
^configure$
^old-configure$
^config\.cache$
^config\.log$
^\.clang_complete
Expand All @@ -37,6 +38,7 @@ _OPT\.OBJ/

# SpiderMonkey configury
^js/src/configure$
^js/src/old-configure$
^js/src/autom4te.cache$
# SpiderMonkey test result logs
^js/src/tests/results-.*\.(html|txt)$
Expand Down
10 changes: 8 additions & 2 deletions browser/base/content/social-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ addEventListener("DOMContentLoaded", function() {
var gDOMTitleChangedByUs = false;
addEventListener("DOMTitleChanged", function(e) {
if (!gDOMTitleChangedByUs) {
sendAsyncMessage("DOMTitleChanged", {
sendAsyncMessage("Social:DOMTitleChanged", {
title: e.target.title
});
}
gDOMTitleChangedByUs = false;
});
var gHookedWindowCloseForPanelClose = false;

// Error handling class used to listen for network errors in the social frames
// and replace them with a social-specific error page
Expand Down Expand Up @@ -117,6 +118,10 @@ SocialErrorListener = {
sendAsyncMessage("Social:FocusEnsured");
break;
case "Social:HookWindowCloseForPanelClose":
if (gHookedWindowCloseForPanelClose) {
break;
}
gHookedWindowCloseForPanelClose = true;
// We allow window.close() to close the panel, so add an event handler for
// this, then cancel the event (so the window itself doesn't die) and
// close the panel instead.
Expand All @@ -127,7 +132,6 @@ SocialErrorListener = {
dwu.allowScriptsToClose();

content.addEventListener("DOMWindowClose", function _mozSocialDOMWindowClose(evt) {
sendAsyncMessage("DOMWindowClose");
// preventDefault stops the default window.close() function being called,
// which doesn't actually close anything but causes things to get into
// a bad state (an internal 'closed' flag is set and debug builds start
Expand All @@ -136,6 +140,8 @@ SocialErrorListener = {
// default close behaviour, so even if we took no action above, we avoid
// the default close from doing anything.
evt.preventDefault();

sendAsyncMessage("Social:DOMWindowClose");
}, true);
break;
case "Social:ListenForEvents":
Expand Down
6 changes: 3 additions & 3 deletions browser/base/content/socialchat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
this._callbacks = null;
}
mm.addMessageListener("DOMTitleChanged", this);
mm.addMessageListener("Social:DOMTitleChanged", this);
mm.sendAsyncMessage("WaitForDOMContentLoaded");
mm.addMessageListener("DOMContentLoaded", function DOMContentLoaded(event) {
Expand Down Expand Up @@ -216,7 +216,7 @@
// attached to a browser, we'll need to add the message listeners to
// the new messageManager. This is not a bug in swapDocShells, merely
// a design decision.
content.messageManager.addMessageListener("DOMTitleChanged", content);
content.messageManager.addMessageListener("Social:DOMTitleChanged", content);
]]></body>
</method>

Expand Down Expand Up @@ -326,7 +326,7 @@
<parameter name="aMessage" />
<body><![CDATA[
switch (aMessage.name) {
case "DOMTitleChanged":
case "Social:DOMTitleChanged":
this.setTitle();
break;
}
Expand Down
22 changes: 0 additions & 22 deletions browser/components/feeds/WebContentConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -901,28 +901,6 @@ WebContentConverterRegistrarContent.prototype = {
// do nothing, the next branch might have values
}
}

// We need to do this _after_ registering all of the available handlers,
// so that getWebContentHandlerByURI can return successfully.
let autoBranch;
try {
autoBranch = ps.getBranch(PREF_CONTENTHANDLERS_AUTO);
} catch (e) {
// No auto branch yet, that's fine
//LOG("WCCR.init: There is no auto branch, benign");
}

if (autoBranch) {
for (let type of autoBranch.getChildList("")) {
let uri = autoBranch.getCharPref(type);
if (uri) {
let handler = this.getWebContentHandlerByURI(type, uri);
if (handler) {
this._setAutoHandler(type, handler);
}
}
}
}
},

_typeIsRegistered(contentType, uri) {
Expand Down
6 changes: 5 additions & 1 deletion browser/components/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ EXTRA_JS_MODULES += [
]

BROWSER_CHROME_MANIFESTS += [
'test/browser.ini'
'tests/browser/browser.ini'
]

XPCSHELL_TESTS_MANIFESTS += [
'tests/unit/xpcshell.ini'
]

if CONFIG['MOZ_SAFE_BROWSING']:
Expand Down
2 changes: 1 addition & 1 deletion browser/components/search/content/search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
var textBox = this._textbox;
// Save the current value in the form history
if (aData && !PrivateBrowsingUtils.isWindowPrivate(window)) {
if (aData && !PrivateBrowsingUtils.isWindowPrivate(window) && this.FormHistory.enabled) {
this.FormHistory.update(
{ op : "bump",
fieldname : textBox.getAttribute("autocompletesearchparam"),
Expand Down
5 changes: 0 additions & 5 deletions browser/components/test/.eslintrc

This file was deleted.

5 changes: 5 additions & 0 deletions browser/components/tests/browser/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"../../../../testing/mochitest/browser.eslintrc"
]
}
File renamed without changes.
32 changes: 32 additions & 0 deletions browser/components/tests/unit/distribution.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Distribution Configuration File
# Test of distribution preferences

[Global]
id=disttest
version=1.0
about=Test distribution file

[Preferences]
distribution.test.string="Test String"
distribution.test.string.noquotes=Test String
distribution.test.int=777
distribution.test.bool.true=true
distribution.test.bool.false=false

[LocalizablePreferences]
distribution.test.locale="%LOCALE%"
distribution.test.reset="Set"
distribution.test.locale.set="First Set"
distribution.test.language.set="First Set"

[LocalizablePreferences-en]
distribution.test.language.en="en"
distribution.test.language.set="Second Set"

[LocalizablePreferences-en-US]
distribution.test.locale.en-US="en-US"
distribution.test.reset=
distribution.test.locale.set="Second Set"

[LocalizablePreferences-de]
distribution.test.locale.de="de"
81 changes: 81 additions & 0 deletions browser/components/tests/unit/test_distribution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

/**
* Tests that preferences are properly set by distribution.ini
*/

var Ci = Components.interfaces;
var Cc = Components.classes;
var Cr = Components.results;
var Cu = Components.utils;

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/LoadContextInfo.jsm");

// Import common head.
var commonFile = do_get_file("../../../../toolkit/components/places/tests/head_common.js", false);
if (commonFile) {
let uri = Services.io.newFileURI(commonFile);
Services.scriptloader.loadSubScript(uri.spec, this);
}

const TOPICDATA_DISTRIBUTION_CUSTOMIZATION = "force-distribution-customization";
const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";

function run_test() {
// Set special pref to load distribution.ini from the profile folder.
Services.prefs.setBoolPref("distribution.testing.loadFromProfile", true);

// Copy distribution.ini file to the profile dir.
let distroDir = gProfD.clone();
distroDir.leafName = "distribution";
let iniFile = distroDir.clone();
iniFile.append("distribution.ini");
if (iniFile.exists()) {
iniFile.remove(false);
print("distribution.ini already exists, did some test forget to cleanup?");
}

let testDistributionFile = gTestDir.clone();
testDistributionFile.append("distribution.ini");
testDistributionFile.copyTo(distroDir, "distribution.ini");
Assert.ok(testDistributionFile.exists());

run_next_test();
}

do_register_cleanup(function () {
// Remove the distribution file, even if the test failed, otherwise all
// next tests will import it.
let iniFile = gProfD.clone();
iniFile.leafName = "distribution";
iniFile.append("distribution.ini");
if (iniFile.exists()) {
iniFile.remove(false);
}
Assert.ok(!iniFile.exists());
});

add_task(function* () {
// Force distribution.
let glue = Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIObserver)
glue.observe(null, TOPIC_BROWSERGLUE_TEST, TOPICDATA_DISTRIBUTION_CUSTOMIZATION);

Assert.equal(Services.prefs.getCharPref("distribution.test.string"), "Test String");
Assert.throws(() => Services.prefs.getCharPref("distribution.test.string.noquotes"));
Assert.equal(Services.prefs.getIntPref("distribution.test.int"), 777);
Assert.equal(Services.prefs.getBoolPref("distribution.test.bool.true"), true);
Assert.equal(Services.prefs.getBoolPref("distribution.test.bool.false"), false);
Assert.equal(Services.prefs.getComplexValue("distribution.test.locale", Ci.nsIPrefLocalizedString).data, "en-US");
Assert.equal(Services.prefs.getComplexValue("distribution.test.language.en", Ci.nsIPrefLocalizedString).data, "en");
Assert.equal(Services.prefs.getComplexValue("distribution.test.locale.en-US", Ci.nsIPrefLocalizedString).data, "en-US");
Assert.throws(() => Services.prefs.getComplexValue("distribution.test.locale.de", Ci.nsIPrefLocalizedString));
// This value was never set because of the empty locale specific pref
// This testcase currently fails - the value is set to "undefined" - it should not be set at all (throw)
// Assert.throws(() => Services.prefs.getComplexValue("distribution.test.reset", Ci.nsIPrefLocalizedString));
// This value was overriden by a locale specific setting
Assert.equal(Services.prefs.getComplexValue("distribution.test.locale.set", Ci.nsIPrefLocalizedString).data, "Second Set");
// This value was overriden by a language specific setting
Assert.equal(Services.prefs.getComplexValue("distribution.test.language.set", Ci.nsIPrefLocalizedString).data, "Second Set");
});
7 changes: 7 additions & 0 deletions browser/components/tests/unit/xpcshell.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[DEFAULT]
firefox-appdir = browser
skip-if = toolkit == 'android' || toolkit == 'gonk'
support-files =
distribution.ini

[test_distribution.js]
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ var MozLoopServiceInternal = {
2 * 32, true);
}

if (payloadObj) {
// Later versions of Firefox will do utf-8 encoding of the request, but
// we need to do it ourselves for older versions.
if (!gHawkClient.willUTF8EncodeRequests && payloadObj) {
// Note: we must copy the object rather than mutate it, to avoid
// mutating the values of the object passed in.
let newPayloadObj = {};
Expand Down Expand Up @@ -999,7 +1001,7 @@ var MozLoopServiceInternal = {

// Handle window.close correctly on the chatbox.
mm.sendAsyncMessage("Social:HookWindowCloseForPanelClose");
messageName = "DOMWindowClose";
messageName = "Social:DOMWindowClose";
mm.addMessageListener(messageName, listeners[messageName] = () => {
// Remove message listeners.
for (let name of Object.getOwnPropertyNames(listeners)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
Cu.import("resource://services-common/utils.js");

add_task(function* request_with_unicode() {
const unicodeName = "yøü";
// Note unicodeName must be unicode, not utf-8
const unicodeName = "y\xf8\xfc"; // "yøü"

loopServer.registerPathHandler("/fake", (request, response) => {
let body = CommonUtils.readBytesFromInputStream(request.bodyInputStream);
let jsonBody = JSON.parse(body);
Assert.equal(jsonBody.name, CommonUtils.encodeUTF8(unicodeName));
let jsonBody = JSON.parse(CommonUtils.decodeUTF8(body));
Assert.equal(jsonBody.name, unicodeName);

response.setStatusLine(null, 200, "OK");
response.processAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import os
import sys
import time
import urlparse
sys.path.insert(1, os.path.dirname(os.path.abspath(__file__)))

Expand Down Expand Up @@ -77,6 +78,8 @@ def switch_to_chatbox(self):
self.marionette.set_context("chrome")
self.marionette.switch_to_frame()

# Added time lapse to allow for DOM to catch up
time.sleep(2)
# XXX should be using wait_for_element_displayed, but need to wait
# for Marionette bug 1094246 to be fixed.
chatbox = self.wait_for_element_exists(By.TAG_NAME, 'chatbox')
Expand Down Expand Up @@ -130,7 +133,7 @@ def standalone_load_and_join_room(self, url):
# Assumes the standalone or the conversation window is selected first.
def check_video(self, selector):
video = self.wait_for_element_displayed(By.CSS_SELECTOR,
selector, 20)
selector, 30)
self.wait_for_element_attribute_to_be_false(video, "paused")
self.assertEqual(video.get_attribute("ended"), "false")

Expand Down
1 change: 0 additions & 1 deletion browser/modules/Chat.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ var Chat = {
// even on platforms where getZOrderDOMWindowEnumerator is broken
// (ie. Linux). This will handle most cases, but won't work if the
// foreground window is a popup.

let mostRecent = Services.wm.getMostRecentWindow("navigator:browser");
if (isWindowGoodForChats(mostRecent))
return mostRecent;
Expand Down
Loading

0 comments on commit f5d0907

Please sign in to comment.