mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge f-t to m-c
This commit is contained in:
commit
54dcc06e76
@ -817,7 +817,7 @@ pref("browser.snippets.geoUrl", "https://geo.mozilla.org/country.json");
|
||||
pref("browser.snippets.statsUrl", "https://snippets-stats.mozilla.org/mobile");
|
||||
|
||||
// These prefs require a restart to take effect.
|
||||
pref("browser.snippets.enabled", false);
|
||||
pref("browser.snippets.enabled", true);
|
||||
pref("browser.snippets.syncPromo.enabled", false);
|
||||
|
||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||
|
@ -2980,26 +2980,11 @@ Tab.prototype = {
|
||||
return;
|
||||
|
||||
let url = currentURI.spec;
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
|
||||
let flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE |
|
||||
Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
|
||||
if (this.originalURI && !this.originalURI.equals(currentURI)) {
|
||||
// We were redirected; reload the original URL
|
||||
url = this.originalURI.spec;
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
|
||||
} else {
|
||||
// Many sites use mobile-specific URLs, such as:
|
||||
// http://m.yahoo.com
|
||||
// http://www.google.com/m
|
||||
// If the user clicks "Request Desktop Site" while on a mobile site, it
|
||||
// will appear to do nothing since the mobile URL is still being
|
||||
// requested. To address this, we do the following:
|
||||
// 1) Remove the path from the URL (http://www.google.com/m?q=query -> http://www.google.com)
|
||||
// 2) If a host subdomain is "m", remove it (http://en.m.wikipedia.org -> http://en.wikipedia.org)
|
||||
// This means the user is sent to site's home page, but this is better
|
||||
// than the setting having no effect at all.
|
||||
if (aDesktopMode)
|
||||
url = currentURI.prePath.replace(/([\/\.])m\./g, "$1");
|
||||
else
|
||||
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
|
||||
}
|
||||
|
||||
this.browser.docShell.loadURI(url, flags, null, null, null);
|
||||
|
@ -322,6 +322,10 @@ Snippets.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
switch(topic) {
|
||||
case "profile-after-change":
|
||||
Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
|
||||
break;
|
||||
case "browser-delayed-startup-finished":
|
||||
Services.obs.removeObserver(this, "browser-delayed-startup-finished", false);
|
||||
if (Services.prefs.getBoolPref("browser.snippets.syncPromo.enabled")) {
|
||||
loadSyncPromoBanner();
|
||||
}
|
||||
|
@ -194,7 +194,7 @@
|
||||
* tokens.
|
||||
*
|
||||
* @param Object token
|
||||
* The token we want to determine if it is an array literal.
|
||||
* The current token.
|
||||
* @param Object lastToken
|
||||
* The last token we added to the pretty printed results.
|
||||
*
|
||||
@ -217,6 +217,30 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if we have encountered a getter or setter.
|
||||
*
|
||||
* @param Object token
|
||||
* The current token. If this is a getter or setter, it would be the
|
||||
* property name.
|
||||
* @param Object lastToken
|
||||
* The last token we added to the pretty printed results. If this is a
|
||||
* getter or setter, it would be the `get` or `set` keyword
|
||||
* respectively.
|
||||
* @param Array stack
|
||||
* The stack of open parens/curlies/brackets/etc.
|
||||
*
|
||||
* @returns Boolean
|
||||
* True if this is a getter or setter.
|
||||
*/
|
||||
function isGetterOrSetter(token, lastToken, stack) {
|
||||
return stack[stack.length - 1] == "{"
|
||||
&& lastToken
|
||||
&& lastToken.type.type == "name"
|
||||
&& (lastToken.value == "get" || lastToken.value == "set")
|
||||
&& token.type.type == "name";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if we should add a newline after the given token.
|
||||
*
|
||||
@ -359,12 +383,13 @@
|
||||
var ttk = token.type.keyword;
|
||||
var ttt = token.type.type;
|
||||
var newlineAdded = addedNewline;
|
||||
var ltt = lastToken ? lastToken.type.type : null;
|
||||
|
||||
// Handle whitespace and newlines after "}" here instead of in
|
||||
// `isLineDelimiter` because it is only a line delimiter some of the
|
||||
// time. For example, we don't want to put "else if" on a new line after
|
||||
// the first if's block.
|
||||
if (lastToken && lastToken.type.type == "}") {
|
||||
if (lastToken && ltt == "}") {
|
||||
if (ttk == "while" && stack[stack.length - 1] == "do") {
|
||||
write(" ",
|
||||
lastToken.startLoc.line,
|
||||
@ -387,13 +412,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (isGetterOrSetter(token, lastToken, stack)) {
|
||||
write(" ",
|
||||
lastToken.startLoc.line,
|
||||
lastToken.startLoc.column);
|
||||
}
|
||||
|
||||
if (ttt == ":" && stack[stack.length - 1] == "?") {
|
||||
write(" ",
|
||||
lastToken.startLoc.line,
|
||||
lastToken.startLoc.column);
|
||||
}
|
||||
|
||||
if (lastToken && lastToken.type.type != "}" && ttk == "else") {
|
||||
if (lastToken && ltt != "}" && ttk == "else") {
|
||||
write(" ",
|
||||
lastToken.startLoc.line,
|
||||
lastToken.startLoc.column);
|
||||
|
@ -6,6 +6,7 @@
|
||||
var prettyFast = this.prettyFast || require("./pretty-fast");
|
||||
|
||||
var testCases = [
|
||||
|
||||
{
|
||||
name: "Simple function",
|
||||
input: "function foo() { bar(); }",
|
||||
@ -431,6 +432,19 @@ var testCases = [
|
||||
output: "new F()\n"
|
||||
},
|
||||
|
||||
{
|
||||
name: "Getter and setter literals",
|
||||
input: "var obj={get foo(){return this._foo},set foo(v){this._foo=v}}",
|
||||
output: "var obj = {\n" +
|
||||
" get foo() {\n" +
|
||||
" return this._foo\n" +
|
||||
" },\n" +
|
||||
" set foo(v) {\n" +
|
||||
" this._foo = v\n" +
|
||||
" }\n" +
|
||||
"}\n"
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
var sourceMap = this.sourceMap || require("source-map");
|
||||
@ -468,6 +482,7 @@ function run_test() {
|
||||
// Only run the tests if this is node and we are running this file
|
||||
// directly. (Firefox's test runner will import this test file, and then call
|
||||
// run_test itself.)
|
||||
if (typeof exports == "object") {
|
||||
if (typeof require == "function" && typeof module == "object"
|
||||
&& require.main === module) {
|
||||
run_test();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user