mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to birch.
This commit is contained in:
commit
ad2b2a17f9
@ -472,6 +472,10 @@ pref("dom.disable_window_move_resize", false);
|
||||
// prevent JS from monkeying with window focus, etc
|
||||
pref("dom.disable_window_flip", true);
|
||||
|
||||
// Disable touch events on Desktop Firefox by default until they are properly
|
||||
// supported (bug 736048)
|
||||
pref("dom.w3c_touch_events.enabled", 0);
|
||||
|
||||
// popups.policy 1=allow,2=reject
|
||||
pref("privacy.popups.policy", 1);
|
||||
pref("privacy.popups.usecustom", true);
|
||||
|
@ -294,13 +294,6 @@ function onSearchSubmit(aEvent)
|
||||
let searchURL = document.documentElement.getAttribute("searchEngineURL");
|
||||
|
||||
if (searchURL && searchTerms.length > 0) {
|
||||
const SEARCH_TOKENS = {
|
||||
"_searchTerms_": encodeURIComponent(searchTerms)
|
||||
}
|
||||
for (let key in SEARCH_TOKENS) {
|
||||
searchURL = searchURL.replace(key, SEARCH_TOKENS[key]);
|
||||
}
|
||||
|
||||
// Send an event that a search was performed. This was originally
|
||||
// added so Firefox Health Report could record that a search from
|
||||
// about:home had occurred.
|
||||
@ -308,7 +301,42 @@ function onSearchSubmit(aEvent)
|
||||
let event = new CustomEvent("AboutHomeSearchEvent", {detail: engineName});
|
||||
document.dispatchEvent(event);
|
||||
|
||||
window.location.href = searchURL;
|
||||
const SEARCH_TOKEN = "_searchTerms_";
|
||||
let searchPostData = document.documentElement.getAttribute("searchEnginePostData");
|
||||
if (searchPostData) {
|
||||
// Check if a post form already exists. If so, remove it.
|
||||
const POST_FORM_NAME = "searchFormPost";
|
||||
let form = document.forms[POST_FORM_NAME];
|
||||
if (form) {
|
||||
form.parentNode.removeChild(form);
|
||||
}
|
||||
|
||||
// Create a new post form.
|
||||
form = document.body.appendChild(document.createElement("form"));
|
||||
form.setAttribute("name", POST_FORM_NAME);
|
||||
// Set the URL to submit the form to.
|
||||
form.setAttribute("action", searchURL.replace(SEARCH_TOKEN, searchTerms));
|
||||
form.setAttribute("method", "post");
|
||||
|
||||
// Create new <input type=hidden> elements for search param.
|
||||
searchPostData = searchPostData.split("&");
|
||||
for (let postVar of searchPostData) {
|
||||
let [name, value] = postVar.split("=");
|
||||
if (value == SEARCH_TOKEN) {
|
||||
value = searchTerms;
|
||||
}
|
||||
let input = document.createElement("input");
|
||||
input.setAttribute("type", "hidden");
|
||||
input.setAttribute("name", name);
|
||||
input.setAttribute("value", value);
|
||||
form.appendChild(input);
|
||||
}
|
||||
// Submit the form.
|
||||
form.submit();
|
||||
} else {
|
||||
searchURL = searchURL.replace(SEARCH_TOKEN, encodeURIComponent(searchTerms));
|
||||
window.location.href = searchURL;
|
||||
}
|
||||
}
|
||||
|
||||
aEvent.preventDefault();
|
||||
|
@ -1040,7 +1040,6 @@ var gBrowserInit = {
|
||||
OfflineApps.init();
|
||||
IndexedDBPromptHelper.init();
|
||||
gFormSubmitObserver.init();
|
||||
SocialUI.init();
|
||||
AddonManager.addAddonListener(AddonsMgrListener);
|
||||
WebrtcIndicator.init();
|
||||
|
||||
@ -1101,12 +1100,7 @@ var gBrowserInit = {
|
||||
|
||||
// initialize the session-restore service (in case it's not already running)
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
ss.init(window);
|
||||
|
||||
// Enable the Restore Last Session command if needed
|
||||
if (ss.canRestoreLastSession &&
|
||||
!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||
goSetCommandEnabled("Browser:RestoreLastSession", true);
|
||||
let ssPromise = ss.init(window);
|
||||
|
||||
PlacesToolbarHelper.init();
|
||||
|
||||
@ -1169,7 +1163,6 @@ var gBrowserInit = {
|
||||
#endif
|
||||
|
||||
gBrowserThumbnails.init();
|
||||
TabView.init();
|
||||
|
||||
setUrlAndSearchBarWidthForConditionalForwardButton();
|
||||
window.addEventListener("resize", function resizeHandler(event) {
|
||||
@ -1284,8 +1277,19 @@ var gBrowserInit = {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ssPromise.then(() =>{
|
||||
// Enable the Restore Last Session command if needed
|
||||
if (ss.canRestoreLastSession &&
|
||||
!PrivateBrowsingUtils.isWindowPrivate(window))
|
||||
goSetCommandEnabled("Browser:RestoreLastSession", true);
|
||||
|
||||
TabView.init();
|
||||
SocialUI.init();
|
||||
|
||||
setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0);
|
||||
});
|
||||
|
||||
Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
|
||||
setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0);
|
||||
TelemetryTimestamps.add("delayedStartupFinished");
|
||||
},
|
||||
|
||||
@ -2310,6 +2314,9 @@ function BrowserOnAboutPageLoad(doc) {
|
||||
let updateSearchEngine = function() {
|
||||
let engine = AboutHomeUtils.defaultSearchEngine;
|
||||
docElt.setAttribute("searchEngineName", engine.name);
|
||||
docElt.setAttribute("searchEnginePostData", engine.postDataString || "");
|
||||
// Again, keep the searchEngineURL as the last attribute, because the
|
||||
// mutation observer in aboutHome.js is counting on that.
|
||||
docElt.setAttribute("searchEngineURL", engine.searchURL);
|
||||
};
|
||||
updateSearchEngine();
|
||||
|
@ -242,10 +242,12 @@ let gTests = [
|
||||
promiseBrowserAttributes(gBrowser.selectedTab).then(function() {
|
||||
// Test if the update propagated
|
||||
checkSearchUI(unusedEngines[0]);
|
||||
searchbar.currentEngine = currEngine;
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
// The following cleanup function will set currentEngine back to the previous engine
|
||||
// The following cleanup function will set currentEngine back to the previous
|
||||
// engine if we fail to do so above.
|
||||
registerCleanupFunction(function() {
|
||||
searchbar.currentEngine = currEngine;
|
||||
});
|
||||
@ -254,6 +256,58 @@ let gTests = [
|
||||
searchbar.select();
|
||||
return deferred.promise;
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
desc: "Check POST search engine support",
|
||||
setup: function() {},
|
||||
run: function()
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
let currEngine = Services.search.defaultEngine;
|
||||
let searchObserver = function search_observer(aSubject, aTopic, aData) {
|
||||
let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
|
||||
info("Observer: " + aData + " for " + engine.name);
|
||||
|
||||
if (aData != "engine-added")
|
||||
return;
|
||||
|
||||
if (engine.name != "POST Search")
|
||||
return;
|
||||
|
||||
Services.search.defaultEngine = engine;
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.search.removeEngine(engine);
|
||||
Services.search.defaultEngine = currEngine;
|
||||
});
|
||||
|
||||
|
||||
// Ready to execute the tests!
|
||||
let needle = "Search for something awesome.";
|
||||
let document = gBrowser.selectedTab.linkedBrowser.contentDocument;
|
||||
let searchText = document.getElementById("searchText");
|
||||
|
||||
waitForLoad(function() {
|
||||
let loadedText = gBrowser.contentDocument.body.textContent;
|
||||
ok(loadedText, "search page loaded");
|
||||
is(loadedText, "searchterms=" + escape(needle.replace(/\s/g, "+")),
|
||||
"Search text should arrive correctly");
|
||||
deferred.resolve();
|
||||
});
|
||||
|
||||
searchText.value = needle;
|
||||
searchText.focus();
|
||||
EventUtils.synthesizeKey("VK_RETURN", {});
|
||||
};
|
||||
Services.obs.addObserver(searchObserver, "browser-search-engine-modified", false);
|
||||
registerCleanupFunction(function () {
|
||||
Services.obs.removeObserver(searchObserver, "browser-search-engine-modified");
|
||||
});
|
||||
Services.search.addEngine("http://test:80/browser/browser/base/content/test/POSTSearchEngine.xml",
|
||||
Ci.nsISearchEngine.DATA_XML, null, false);
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
];
|
||||
@ -442,3 +496,15 @@ function getNumberOfSearchesByDate(aEngineName, aData, aDate) {
|
||||
|
||||
return 0; // No records found.
|
||||
}
|
||||
|
||||
function waitForLoad(cb) {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
browser.addEventListener("load", function listener() {
|
||||
if (browser.currentURI.spec == "about:blank")
|
||||
return;
|
||||
info("Page loaded: " + browser.currentURI.spec);
|
||||
browser.removeEventListener("load", listener, true);
|
||||
|
||||
cb();
|
||||
}, true);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ function resetSocial() {
|
||||
}
|
||||
|
||||
let createdWindows = [];
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
|
||||
function openWindowAndWaitForInit(callback) {
|
||||
// this notification tells us SocialUI.init() has been run...
|
||||
@ -26,8 +27,12 @@ function openWindowAndWaitForInit(callback) {
|
||||
Services.obs.addObserver(function providerSet(subject, topic, data) {
|
||||
Services.obs.removeObserver(providerSet, topic);
|
||||
info(topic + " observer was notified - continuing test");
|
||||
// executeSoon to let the browser UI observers run first
|
||||
executeSoon(function() {callback(w)});
|
||||
// We need to wait for the SessionStore as well, since
|
||||
// SocialUI.init() is also waiting on it.
|
||||
ss.init(w).then(function () {
|
||||
executeSoon(function() {callback(w);});
|
||||
});
|
||||
|
||||
}, topic, false);
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,13 @@ interface nsIDOMNode;
|
||||
* |gBrowser.tabContainer| such as e.g. |gBrowser.selectedTab|.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(0aa5492c-15ad-4376-8eac-28895796826e)]
|
||||
[scriptable, uuid(092fa0cc-e99b-11e2-a2a3-a25b4f45d8e2)]
|
||||
interface nsISessionStore : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize the service
|
||||
*/
|
||||
void init(in nsIDOMWindow aWindow);
|
||||
jsval init(in nsIDOMWindow aWindow);
|
||||
|
||||
/**
|
||||
* Is it possible to restore the previous session. Will always be false when
|
||||
|
@ -79,7 +79,7 @@ Cu.import("resource://gre/modules/TelemetryTimestamps.jsm", this);
|
||||
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm", this);
|
||||
Cu.import("resource://gre/modules/osfile.jsm", this);
|
||||
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm", this);
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", this);
|
||||
Cu.import("resource://gre/modules/Promise.jsm", this);
|
||||
Cu.import("resource://gre/modules/Task.jsm", this);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gSessionStartup",
|
||||
@ -139,7 +139,7 @@ this.SessionStore = {
|
||||
},
|
||||
|
||||
init: function ss_init(aWindow) {
|
||||
SessionStoreInternal.init(aWindow);
|
||||
return SessionStoreInternal.init(aWindow);
|
||||
},
|
||||
|
||||
getBrowserState: function ss_getBrowserState() {
|
||||
@ -579,9 +579,11 @@ let SessionStoreInternal = {
|
||||
|
||||
let self = this;
|
||||
this.initService();
|
||||
this._promiseInitialization.promise.then(
|
||||
return this._promiseInitialization.promise.then(
|
||||
function onSuccess() {
|
||||
self.onLoad(aWindow);
|
||||
if (!aWindow.closed) {
|
||||
self.onLoad(aWindow);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
@ -33,7 +33,7 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
Cu.import("resource://gre/modules/osfile/_PromiseWorker.jsm", this);
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
|
||||
"resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
|
@ -39,7 +39,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
|
||||
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "_SessionFile",
|
||||
"resource:///modules/sessionstore/_SessionFile.jsm");
|
||||
|
@ -36,7 +36,8 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||
dumpn("Initializing the SourcesView");
|
||||
|
||||
this.widget = new SideMenuWidget(document.getElementById("sources"), {
|
||||
showCheckboxes: true
|
||||
showCheckboxes: true,
|
||||
showArrows: true
|
||||
});
|
||||
this.emptyText = L10N.getStr("noSourcesText");
|
||||
this.unavailableText = L10N.getStr("noMatchingSourcesText");
|
||||
|
@ -23,7 +23,7 @@ function Sidebar(el) {
|
||||
EventEmitter.decorate(this);
|
||||
|
||||
this.document = el.ownerDocument;
|
||||
this.widget = new SideMenuWidget(el);
|
||||
this.widget = new SideMenuWidget(el, { showArrows: true });
|
||||
this.widget.notice = L10N.getStr("profiler.sidebarNotice");
|
||||
|
||||
this.widget.addEventListener("select", (ev) => {
|
||||
@ -117,4 +117,4 @@ Sidebar.prototype = Heritage.extend(WidgetMethods, {
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Sidebar;
|
||||
module.exports = Sidebar;
|
||||
|
@ -25,13 +25,11 @@ this.AboutHomeUtils = {
|
||||
get defaultSearchEngine() {
|
||||
let defaultEngine = Services.search.defaultEngine;
|
||||
let submission = defaultEngine.getSubmission("_searchTerms_", null, "homepage");
|
||||
if (submission.postData) {
|
||||
throw new Error("Home page does not support POST search engines.");
|
||||
}
|
||||
|
||||
return Object.freeze({
|
||||
name: defaultEngine.name,
|
||||
searchURL: submission.uri.spec
|
||||
searchURL: submission.uri.spec,
|
||||
postDataString: submission.postDataString
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -60,15 +60,15 @@ SpecialPowers.pushPrefEnv(
|
||||
{'set':[["security.csp.speccompliant", true]]},
|
||||
function () {
|
||||
document.getElementById('testframe1').src = 'file_CSP_bug888172.sjs?csp=' +
|
||||
escape("Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval'");
|
||||
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'");
|
||||
document.getElementById('testframe1').addEventListener('load', checkDefaultSrcOnly, false);
|
||||
|
||||
document.getElementById('testframe2').src = 'file_CSP_bug888172.sjs?csp=' +
|
||||
escape("Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src 'self'");
|
||||
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'; script-src 'self'");
|
||||
document.getElementById('testframe2').addEventListener('load', checkDefaultSrcWithScriptSrc, false);
|
||||
|
||||
document.getElementById('testframe3').src = 'file_CSP_bug888172.sjs?csp=' +
|
||||
escape("Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self'");
|
||||
escape("default-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self'");
|
||||
document.getElementById('testframe3').addEventListener('load', checkDefaultSrcWithStyleSrc, false);
|
||||
}
|
||||
);
|
||||
|
@ -7,7 +7,7 @@
|
||||
interface nsIURI;
|
||||
interface nsIInputStream;
|
||||
|
||||
[scriptable, uuid(58e4f602-a7c8-4cd1-9dca-716705e826ef)]
|
||||
[scriptable, uuid(82ec6ee8-68b5-49ef-87b7-0d5240f8a183)]
|
||||
interface nsISearchSubmission : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -16,6 +16,12 @@ interface nsISearchSubmission : nsISupports
|
||||
*/
|
||||
readonly attribute nsIInputStream postData;
|
||||
|
||||
/**
|
||||
* The POST data associated with a search submission as an
|
||||
* application/x-www-form-urlencoded string. May be null.
|
||||
*/
|
||||
readonly attribute AString postDataString;
|
||||
|
||||
/**
|
||||
* The URI to submit a search to.
|
||||
*/
|
||||
|
@ -931,6 +931,7 @@ EngineURL.prototype = {
|
||||
}
|
||||
|
||||
var postData = null;
|
||||
let postDataString = null;
|
||||
if (this.method == "GET") {
|
||||
// GET method requests have no post data, and append the encoded
|
||||
// query string to the url...
|
||||
@ -938,8 +939,8 @@ EngineURL.prototype = {
|
||||
url += "?";
|
||||
url += dataString;
|
||||
} else if (this.method == "POST") {
|
||||
// POST method requests must wrap the encoded text in a MIME
|
||||
// stream and supply that as POSTDATA.
|
||||
// For POST requests, specify the data as a MIME stream as well as a string.
|
||||
postDataString = dataString;
|
||||
var stringStream = Cc["@mozilla.org/io/string-input-stream;1"].
|
||||
createInstance(Ci.nsIStringInputStream);
|
||||
stringStream.data = dataString;
|
||||
@ -951,7 +952,7 @@ EngineURL.prototype = {
|
||||
postData.setData(stringStream);
|
||||
}
|
||||
|
||||
return new Submission(makeURI(url), postData);
|
||||
return new Submission(makeURI(url), postData, postDataString);
|
||||
},
|
||||
|
||||
_hasRelation: function SRC_EURL__hasRelation(aRel)
|
||||
@ -2543,7 +2544,7 @@ Engine.prototype = {
|
||||
|
||||
if (!aData) {
|
||||
// Return a dummy submission object with our searchForm attribute
|
||||
return new Submission(makeURI(this.searchForm), null);
|
||||
return new Submission(makeURI(this.searchForm));
|
||||
}
|
||||
|
||||
LOG("getSubmission: In data: \"" + aData + "\"; Purpose: \"" + aPurpose + "\"");
|
||||
@ -2580,9 +2581,10 @@ Engine.prototype = {
|
||||
};
|
||||
|
||||
// nsISearchSubmission
|
||||
function Submission(aURI, aPostData) {
|
||||
function Submission(aURI, aPostData = null, aPostDataString = null) {
|
||||
this._uri = aURI;
|
||||
this._postData = aPostData;
|
||||
this._postDataString = aPostDataString;
|
||||
}
|
||||
Submission.prototype = {
|
||||
get uri() {
|
||||
@ -2591,6 +2593,9 @@ Submission.prototype = {
|
||||
get postData() {
|
||||
return this._postData;
|
||||
},
|
||||
get postDataString() {
|
||||
return this._postDataString;
|
||||
},
|
||||
QueryInterface: function SRCH_SUBM_QI(aIID) {
|
||||
if (aIID.equals(Ci.nsISearchSubmission) ||
|
||||
aIID.equals(Ci.nsISupports))
|
||||
|
Loading…
Reference in New Issue
Block a user