Merge fx-team to m-c a=merge

This commit is contained in:
Wes Kocher 2014-08-27 16:55:46 -07:00
commit dc607659f0
9 changed files with 79 additions and 7 deletions

View File

@ -10,6 +10,9 @@
<!ENTITY dntTrackingNotOkay.accesskey "n">
<!ENTITY dntTrackingOkay.label2 "Tell sites that I want to be tracked">
<!ENTITY dntTrackingOkay.accesskey "h">
<!ENTITY trackingProtection.label "Prevent sites from tracking me">
<!ENTITY trackingProtection.accesskey "m">
<!ENTITY trackingProtectionLearnMore.label "Learn more">
<!ENTITY doNotTrackInfo.label "Learn More">
<!ENTITY history.label "History">

View File

@ -89,6 +89,9 @@ class ChromeCast implements GeckoMediaPlayer {
remoteMediaPlayer.setOnStatusUpdatedListener(this);
remoteMediaPlayer.setOnMetadataUpdatedListener(this);
mSessionId = result.getSessionId();
if (!verifySession(callback)) {
return;
}
try {
Cast.CastApi.setMessageReceivedCallbacks(apiClient, remoteMediaPlayer.getNamespace(), remoteMediaPlayer);

View File

@ -239,7 +239,7 @@ interface nsIBrowserSearchInitObserver : nsISupports
void onInitComplete(in nsresult aStatus);
};
[scriptable, uuid(939d74a4-5b01-463c-80c7-4301f0c0f9ef)]
[scriptable, uuid(4a4ce87d-7cb9-4975-a267-345f6a49bb8f)]
interface nsIBrowserSearchService : nsISupports
{
/**
@ -327,13 +327,17 @@ interface nsIBrowserSearchService : nsISupports
* @param url
* The URL to which search queries should be sent.
* Must not be null.
*
* @param extensionID [optional]
* Optional: The correct extensionID if called by an add-on.
*/
void addEngineWithDetails(in AString name,
in AString iconURL,
in AString alias,
in AString description,
in AString method,
in AString url);
in AString url,
[optional] in AString extensionID);
/**
* Un-hides all engines installed in the directory corresponding to

View File

@ -457,14 +457,16 @@ function getUnfilteredSearchTokens(searchString)
function stripPrefix(spec)
{
["http://", "https://", "ftp://"].some(scheme => {
if (spec.startsWith(scheme)) {
// Strip protocol if not directly followed by a space
if (spec.startsWith(scheme) && spec[scheme.length] != " ") {
spec = spec.slice(scheme.length);
return true;
}
return false;
});
if (spec.startsWith("www.")) {
// Strip www. if not directly followed by a space
if (spec.startsWith("www.") && spec[4] != " ") {
spec = spec.slice(4);
}
return spec;

View File

@ -0,0 +1,41 @@
/* 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/. */
add_task(function* test_protocol_trimming() {
for (let prot of ["http", "https", "ftp"]) {
let visit = {
// Include the protocol in the query string to ensure we get matches (see bug 1059395)
uri: NetUtil.newURI(prot + "://www.mozilla.org/test/?q=" + prot + encodeURIComponent("://") + "www.foo"),
title: "Test title",
transition: TRANSITION_TYPED
};
yield promiseAddVisits(visit);
let matches = [{uri: visit.uri, title: visit.title}];
let inputs = [
prot + "://",
prot + ":// ",
prot + ":// mo",
prot + "://mo te",
prot + "://www.",
prot + "://www. ",
prot + "://www. mo",
prot + "://www.mo te",
"www.",
"www. ",
"www. mo",
"www.mo te"
];
for (let input of inputs) {
do_log_info("Searching for: " + input);
yield check_autocomplete({
search: input,
matches: matches
});
}
yield cleanup();
}
});

View File

@ -11,6 +11,7 @@ tail =
[test_autocomplete_on_value_removed_479089.js]
[test_autoFill_default_behavior.js]
[test_avoid_middle_complete.js]
[test_avoid_stripping_to_empty_tokens.js]
[test_casing.js]
[test_do_not_trim.js]
[test_download_embed_bookmarks.js]

View File

@ -1127,6 +1127,8 @@ Engine.prototype = {
_iconUpdateURL: null,
/* Deferred serialization task. */
_lazySerializeTask: null,
/* The extension ID if added by an extension. */
_extensionID: null,
/**
* Retrieves the data from the engine's file. If the engine's dataType is
@ -1673,7 +1675,7 @@ Engine.prototype = {
*/
_initFromMetadata: function SRCH_ENG_initMetaData(aName, aIconURL, aAlias,
aDescription, aMethod,
aTemplate) {
aTemplate, aExtensionID) {
ENSURE_WARN(!this._readOnly,
"Can't call _initFromMetaData on a readonly engine!",
Cr.NS_ERROR_FAILURE);
@ -1684,6 +1686,7 @@ Engine.prototype = {
this.alias = aAlias;
this._description = aDescription;
this._setIcon(aIconURL, true);
this._extensionID = aExtensionID;
this._serializeToFile();
},
@ -1861,6 +1864,9 @@ Engine.prototype = {
case "IconUpdateUrl":
this._iconUpdateURL = child.textContent;
break;
case "ExtensionID":
this._extensionID = child.textContent;
breakk;
}
}
if (!this.name || (this._urls.length == 0))
@ -2205,6 +2211,9 @@ Engine.prototype = {
this._readOnly = false;
this._iconURI = makeURI(aJson._iconURL);
this._iconMapObj = aJson._iconMapObj;
if (aJson.extensionID) {
this._extensionID = aJson.extensionID;
}
for (let i = 0; i < aJson._urls.length; ++i) {
let url = aJson._urls[i];
let engineURL = new EngineURL(url.type || URLTYPE_SEARCH_HTML,
@ -2256,6 +2265,9 @@ Engine.prototype = {
json._dataType = this._dataType;
if (!this._readOnly || !aFilter)
json._readOnly = this._readOnly;
if (this._extensionID) {
json.extensionID = this._extensionID;
}
return json;
},
@ -2301,6 +2313,10 @@ Engine.prototype = {
appendTextNode(MOZSEARCH_NS_10, "IconUpdateUrl", this._iconUpdateURL);
appendTextNode(MOZSEARCH_NS_10, "SearchForm", this._searchForm);
if (this._extensionID) {
appendTextNode(MOZSEARCH_NS_10, "ExtensionID", this._extensionID);
}
for (var i = 0; i < this._urls.length; ++i)
this._urls[i]._serializeToElement(doc, docElem);
docElem.appendChild(doc.createTextNode("\n"));
@ -3953,7 +3969,7 @@ SearchService.prototype = {
addEngineWithDetails: function SRCH_SVC_addEWD(aName, aIconURL, aAlias,
aDescription, aMethod,
aTemplate) {
aTemplate, aExtensionID) {
this._ensureInitialized();
if (!aName)
FAIL("Invalid name passed to addEngineWithDetails!");
@ -3966,7 +3982,7 @@ SearchService.prototype = {
var engine = new Engine(getSanitizedFile(aName), SEARCH_DATA_XML, false);
engine._initFromMetadata(aName, aIconURL, aAlias, aDescription,
aMethod, aTemplate);
aMethod, aTemplate, aExtensionID);
this._addEngineToStore(engine);
},

View File

@ -11,6 +11,7 @@
"_name": "Test search engine",
"_hidden": false,
"description": "A test search engine (based on Google search)",
"extension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3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA",
"_urls": [

View File

@ -183,6 +183,7 @@ let EXPECTED_ENGINE = {
searchForm: "http://www.google.com/",
type: Ci.nsISearchEngine.TYPE_MOZSEARCH,
wrappedJSObject: {
_extensionID: "test-addon-id@mozilla.org",
"_iconURL": "data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6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