mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Merge mozilla-central to mozilla-inbound
This commit is contained in:
commit
19038498f4
181 files changed
+2650
-1506
No files matched your search
@@ -6424,11 +6424,19 @@ var gIdentityHandler = {
|
||||
},
|
||||
|
||||
get _isSecure() {
|
||||
return this._state & Ci.nsIWebProgressListener.STATE_IS_SECURE;
|
||||
// If a <browser> is included within a chrome document, then this._state
|
||||
// will refer to the security state for the <browser> and not the top level
|
||||
// document. In this case, don't upgrade the security state in the UI
|
||||
// with the secure state of the embedded <browser>.
|
||||
return !this._isURILoadedFromFile && this._state & Ci.nsIWebProgressListener.STATE_IS_SECURE;
|
||||
},
|
||||
|
||||
get _isEV() {
|
||||
return this._state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL;
|
||||
// If a <browser> is included within a chrome document, then this._state
|
||||
// will refer to the security state for the <browser> and not the top level
|
||||
// document. In this case, don't upgrade the security state in the UI
|
||||
// with the EV state of the embedded <browser>.
|
||||
return !this._isURILoadedFromFile && this._state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL;
|
||||
},
|
||||
|
||||
get _isMixedActiveContentLoaded() {
|
||||
@@ -6620,21 +6628,10 @@ var gIdentityHandler = {
|
||||
updateIdentity(state, uri) {
|
||||
let shouldHidePopup = this._uri && (this._uri.spec != uri.spec);
|
||||
this._state = state;
|
||||
this._uri = uri;
|
||||
|
||||
// Firstly, populate the state properties required to display the UI. See
|
||||
// the documentation of the individual properties for details.
|
||||
|
||||
try {
|
||||
this._uri.host;
|
||||
this._uriHasHost = true;
|
||||
} catch (ex) {
|
||||
this._uriHasHost = false;
|
||||
}
|
||||
|
||||
let whitelist = /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|sessionrestore|support|welcomeback)(?:[?#]|$)/i;
|
||||
this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.path);
|
||||
|
||||
this.setURI(uri);
|
||||
this._sslStatus = gBrowser.securityUI
|
||||
.QueryInterface(Ci.nsISSLStatusProvider)
|
||||
.SSLStatus;
|
||||
@@ -6974,9 +6971,22 @@ var gIdentityHandler = {
|
||||
this.updateSitePermissions();
|
||||
},
|
||||
|
||||
get _isURILoadedFromFile() {
|
||||
setURI(uri) {
|
||||
this._uri = uri;
|
||||
|
||||
try {
|
||||
this._uri.host;
|
||||
this._uriHasHost = true;
|
||||
} catch (ex) {
|
||||
this._uriHasHost = false;
|
||||
}
|
||||
|
||||
let whitelist = /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|sessionrestore|support|welcomeback)(?:[?#]|$)/i;
|
||||
this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.path);
|
||||
|
||||
// Create a channel for the sole purpose of getting the resolved URI
|
||||
// of the request to determine if it's loaded from the file system.
|
||||
this._isURILoadedFromFile = false;
|
||||
let chanOptions = {uri: this._uri, loadUsingSystemPrincipal: true};
|
||||
let resolvedURI;
|
||||
try {
|
||||
@@ -6986,13 +6996,11 @@ var gIdentityHandler = {
|
||||
// create a new URI using <jar-file-uri>!/<jar-entry>
|
||||
resolvedURI = NetUtil.newURI(resolvedURI.path);
|
||||
}
|
||||
// Check the URI again after resolving.
|
||||
this._isURILoadedFromFile = resolvedURI.schemeIs("file");
|
||||
} catch (ex) {
|
||||
// NetUtil's methods will throw for malformed URIs and the like
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the URI again after resolving.
|
||||
return resolvedURI.schemeIs("file");
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
+1
-7
@@ -56,8 +56,7 @@ function defineCohort() {
|
||||
|
||||
let userOptedOut = optedOut();
|
||||
let userOptedIn = optedIn();
|
||||
let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0) ||
|
||||
isThereAnActiveExperiment();
|
||||
let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0);
|
||||
let testGroup = (getUserSample() < TEST_THRESHOLD[updateChannel]);
|
||||
|
||||
if (userOptedOut) {
|
||||
@@ -114,8 +113,3 @@ function optedOut() {
|
||||
(Preferences.isSet(PREF_TOGGLE_E10S) &&
|
||||
Preferences.get(PREF_TOGGLE_E10S) == false);
|
||||
}
|
||||
|
||||
function isThereAnActiveExperiment() {
|
||||
let { Experiments } = Cu.import("resource:///modules/experiments/Experiments.jsm", {});
|
||||
return (Experiments.instance().getActiveExperimentID() !== null);
|
||||
}
|
||||
@@ -404,6 +404,7 @@
|
||||
@RESPATH@/components/addonManager.js
|
||||
@RESPATH@/components/amContentHandler.js
|
||||
@RESPATH@/components/amInstallTrigger.js
|
||||
@RESPATH@/components/amWebAPI.js
|
||||
@RESPATH@/components/amWebInstallListener.js
|
||||
@RESPATH@/components/nsBlocklistService.js
|
||||
@RESPATH@/components/nsBlocklistServiceContent.js
|
||||
|
||||
+9
-8
@@ -39,15 +39,16 @@
|
||||
"mozilla/var-only-at-top-level": 1,
|
||||
|
||||
// Rules from the React plugin
|
||||
"react/display-name": 1,
|
||||
"react/no-danger": 1,
|
||||
"react/no-did-mount-set-state": 1,
|
||||
"react/no-did-update-set-state": 1,
|
||||
"react/no-direct-mutation-state": 1,
|
||||
"react/no-unknown-property": 1,
|
||||
"react/display-name": 2,
|
||||
"react/no-danger": 2,
|
||||
"react/no-did-mount-set-state": 2,
|
||||
"react/no-did-update-set-state": 2,
|
||||
"react/no-direct-mutation-state": 2,
|
||||
"react/no-unknown-property": 2,
|
||||
"react/prefer-es6-class": [1, "never"],
|
||||
"react/prop-types": 1,
|
||||
"react/sort-comp": [1, {
|
||||
// Disabled temporarily until errors are fixed.
|
||||
"react/prop-types": 0,
|
||||
"react/sort-comp": [2, {
|
||||
order: [
|
||||
"propTypes",
|
||||
"everything-else",
|
||||
|
||||
@@ -56,21 +56,6 @@ module.exports = createClass({
|
||||
this.props.telemetry.destroy();
|
||||
},
|
||||
|
||||
render() {
|
||||
let { client } = this.props;
|
||||
let { selectedTabId } = this.state;
|
||||
let selectTab = this.selectTab;
|
||||
|
||||
let selectedTab = tabs.find(t => t.id == selectedTabId);
|
||||
|
||||
return dom.div({ className: "app" },
|
||||
TabMenu({ tabs, selectedTabId, selectTab }),
|
||||
dom.div({ className: "main-content" },
|
||||
selectedTab.component({ client })
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
onHashChange() {
|
||||
let tabId = window.location.hash.substr(1);
|
||||
|
||||
@@ -86,5 +71,20 @@ module.exports = createClass({
|
||||
|
||||
selectTab(tabId) {
|
||||
window.location.hash = "#" + tabId;
|
||||
},
|
||||
|
||||
render() {
|
||||
let { client } = this.props;
|
||||
let { selectedTabId } = this.state;
|
||||
let selectTab = this.selectTab;
|
||||
|
||||
let selectedTab = tabs.find(t => t.id == selectedTabId);
|
||||
|
||||
return dom.div({ className: "app" },
|
||||
TabMenu({ tabs, selectedTabId, selectTab }),
|
||||
dom.div({ className: "main-content" },
|
||||
selectedTab.component({ client })
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -20,6 +20,11 @@ const Strings = Services.strings.createBundle(
|
||||
module.exports = createClass({
|
||||
displayName: "AddonTarget",
|
||||
|
||||
debug() {
|
||||
let { target } = this.props;
|
||||
BrowserToolboxProcess.init({ addonID: target.addonID });
|
||||
},
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
|
||||
@@ -38,10 +43,5 @@ module.exports = createClass({
|
||||
disabled: debugDisabled,
|
||||
}, Strings.GetStringFromName("debug"))
|
||||
);
|
||||
},
|
||||
|
||||
debug() {
|
||||
let { target } = this.props;
|
||||
BrowserToolboxProcess.init({ addonID: target.addonID });
|
||||
},
|
||||
}
|
||||
});
|
||||
@@ -32,36 +32,6 @@ module.exports = createClass({
|
||||
};
|
||||
},
|
||||
|
||||
render() {
|
||||
let { debugDisabled } = this.props;
|
||||
|
||||
return dom.div({ className: "addons-top" },
|
||||
dom.div({ className: "addons-controls" },
|
||||
dom.div({ className: "addons-options" },
|
||||
dom.input({
|
||||
id: "enable-addon-debugging",
|
||||
type: "checkbox",
|
||||
checked: !debugDisabled,
|
||||
onChange: this.onEnableAddonDebuggingChange,
|
||||
}),
|
||||
dom.label({
|
||||
className: "addons-debugging-label",
|
||||
htmlFor: "enable-addon-debugging",
|
||||
title: Strings.GetStringFromName("addonDebugging.tooltip")
|
||||
}, Strings.GetStringFromName("addonDebugging.label")),
|
||||
"(",
|
||||
dom.a({ href: MORE_INFO_URL, target: "_blank" },
|
||||
Strings.GetStringFromName("addonDebugging.moreInfo")),
|
||||
")"
|
||||
),
|
||||
dom.button({
|
||||
id: "load-addon-from-file",
|
||||
onClick: this.loadAddonFromFile,
|
||||
}, Strings.GetStringFromName("loadTemporaryAddon"))
|
||||
),
|
||||
AddonsInstallError({ error: this.state.installError }));
|
||||
},
|
||||
|
||||
onEnableAddonDebuggingChange(event) {
|
||||
let enabled = event.target.checked;
|
||||
Services.prefs.setBoolPref("devtools.chrome.enabled", enabled);
|
||||
@@ -90,4 +60,34 @@ module.exports = createClass({
|
||||
this.setState({ installError: e.message });
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
let { debugDisabled } = this.props;
|
||||
|
||||
return dom.div({ className: "addons-top" },
|
||||
dom.div({ className: "addons-controls" },
|
||||
dom.div({ className: "addons-options" },
|
||||
dom.input({
|
||||
id: "enable-addon-debugging",
|
||||
type: "checkbox",
|
||||
checked: !debugDisabled,
|
||||
onChange: this.onEnableAddonDebuggingChange,
|
||||
}),
|
||||
dom.label({
|
||||
className: "addons-debugging-label",
|
||||
htmlFor: "enable-addon-debugging",
|
||||
title: Strings.GetStringFromName("addonDebugging.tooltip")
|
||||
}, Strings.GetStringFromName("addonDebugging.label")),
|
||||
"(",
|
||||
dom.a({ href: MORE_INFO_URL, target: "_blank" },
|
||||
Strings.GetStringFromName("addonDebugging.moreInfo")),
|
||||
")"
|
||||
),
|
||||
dom.button({
|
||||
id: "load-addon-from-file",
|
||||
onClick: this.loadAddonFromFile,
|
||||
}, Strings.GetStringFromName("loadTemporaryAddon"))
|
||||
),
|
||||
AddonsInstallError({ error: this.state.installError }));
|
||||
}
|
||||
});
|
||||
@@ -51,28 +51,6 @@ module.exports = createClass({
|
||||
this.updateDebugStatus);
|
||||
},
|
||||
|
||||
render() {
|
||||
let { client } = this.props;
|
||||
let { debugDisabled, extensions: targets } = this.state;
|
||||
let name = Strings.GetStringFromName("extensions");
|
||||
let targetClass = AddonTarget;
|
||||
|
||||
return dom.div({
|
||||
id: "tab-addons",
|
||||
className: "tab",
|
||||
role: "tabpanel",
|
||||
"aria-labelledby": "tab-addons-header-name"
|
||||
},
|
||||
TabHeader({
|
||||
id: "tab-addons-header-name",
|
||||
name: Strings.GetStringFromName("addons")
|
||||
}),
|
||||
AddonsControls({ debugDisabled }),
|
||||
dom.div({ id: "addons" },
|
||||
TargetList({ name, targets, client, debugDisabled, targetClass })
|
||||
));
|
||||
},
|
||||
|
||||
updateDebugStatus() {
|
||||
let debugDisabled =
|
||||
!Services.prefs.getBoolPref(CHROME_ENABLED_PREF) ||
|
||||
@@ -122,4 +100,26 @@ module.exports = createClass({
|
||||
onDisabled() {
|
||||
this.updateAddonsList();
|
||||
},
|
||||
|
||||
render() {
|
||||
let { client } = this.props;
|
||||
let { debugDisabled, extensions: targets } = this.state;
|
||||
let name = Strings.GetStringFromName("extensions");
|
||||
let targetClass = AddonTarget;
|
||||
|
||||
return dom.div({
|
||||
id: "tab-addons",
|
||||
className: "tab",
|
||||
role: "tabpanel",
|
||||
"aria-labelledby": "tab-addons-header-name"
|
||||
},
|
||||
TabHeader({
|
||||
id: "tab-addons-header-name",
|
||||
name: Strings.GetStringFromName("addons")
|
||||
}),
|
||||
AddonsControls({ debugDisabled }),
|
||||
dom.div({ id: "addons" },
|
||||
TargetList({ name, targets, client, debugDisabled, targetClass })
|
||||
));
|
||||
}
|
||||
});
|
||||
@@ -17,49 +17,6 @@ const Strings = Services.strings.createBundle(
|
||||
module.exports = createClass({
|
||||
displayName: "ServiceWorkerTarget",
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
let isRunning = this.isRunning();
|
||||
|
||||
return dom.div({ className: "target-container" },
|
||||
dom.img({
|
||||
className: "target-icon",
|
||||
role: "presentation",
|
||||
src: target.icon
|
||||
}),
|
||||
dom.div({ className: "target" },
|
||||
dom.div({ className: "target-name" }, target.name),
|
||||
dom.ul({ className: "target-details" },
|
||||
dom.li({ className: "target-detail" },
|
||||
dom.strong(null, Strings.GetStringFromName("scope")),
|
||||
dom.span({ className: "service-worker-scope" }, target.scope),
|
||||
dom.a({
|
||||
onClick: this.unregister,
|
||||
className: "unregister-link"
|
||||
}, Strings.GetStringFromName("unregister"))
|
||||
)
|
||||
)
|
||||
),
|
||||
(isRunning ?
|
||||
[
|
||||
dom.button({
|
||||
className: "push-button",
|
||||
onClick: this.push
|
||||
}, Strings.GetStringFromName("push")),
|
||||
dom.button({
|
||||
className: "debug-button",
|
||||
onClick: this.debug,
|
||||
disabled: debugDisabled
|
||||
}, Strings.GetStringFromName("debug"))
|
||||
] :
|
||||
dom.button({
|
||||
className: "start-button",
|
||||
onClick: this.start
|
||||
}, Strings.GetStringFromName("start"))
|
||||
)
|
||||
);
|
||||
},
|
||||
|
||||
debug() {
|
||||
if (!this.isRunning()) {
|
||||
// If the worker is not running, we can't debug it.
|
||||
@@ -108,4 +65,47 @@ module.exports = createClass({
|
||||
// We know the target is running if it has a worker actor.
|
||||
return !!this.props.target.workerActor;
|
||||
},
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
let isRunning = this.isRunning();
|
||||
|
||||
return dom.div({ className: "target-container" },
|
||||
dom.img({
|
||||
className: "target-icon",
|
||||
role: "presentation",
|
||||
src: target.icon
|
||||
}),
|
||||
dom.div({ className: "target" },
|
||||
dom.div({ className: "target-name" }, target.name),
|
||||
dom.ul({ className: "target-details" },
|
||||
dom.li({ className: "target-detail" },
|
||||
dom.strong(null, Strings.GetStringFromName("scope")),
|
||||
dom.span({ className: "service-worker-scope" }, target.scope),
|
||||
dom.a({
|
||||
onClick: this.unregister,
|
||||
className: "unregister-link"
|
||||
}, Strings.GetStringFromName("unregister"))
|
||||
)
|
||||
)
|
||||
),
|
||||
(isRunning ?
|
||||
[
|
||||
dom.button({
|
||||
className: "push-button",
|
||||
onClick: this.push
|
||||
}, Strings.GetStringFromName("push")),
|
||||
dom.button({
|
||||
className: "debug-button",
|
||||
onClick: this.debug,
|
||||
disabled: debugDisabled
|
||||
}, Strings.GetStringFromName("debug"))
|
||||
] :
|
||||
dom.button({
|
||||
className: "start-button",
|
||||
onClick: this.start
|
||||
}, Strings.GetStringFromName("start"))
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -10,6 +10,10 @@ const { createClass, DOM: dom } =
|
||||
module.exports = createClass({
|
||||
displayName: "TabMenuEntry",
|
||||
|
||||
onClick() {
|
||||
this.props.selectTab(this.props.tabId);
|
||||
},
|
||||
|
||||
render() {
|
||||
let { icon, name, selected } = this.props;
|
||||
|
||||
@@ -23,9 +27,5 @@ module.exports = createClass({
|
||||
role: "tab" },
|
||||
dom.img({ className: "category-icon", src: icon, role: "presentation" }),
|
||||
dom.div({ className: "category-name" }, name));
|
||||
},
|
||||
|
||||
onClick() {
|
||||
this.props.selectTab(this.props.tabId);
|
||||
}
|
||||
});
|
||||
@@ -17,6 +17,11 @@ const Strings = Services.strings.createBundle(
|
||||
module.exports = createClass({
|
||||
displayName: "WorkerTarget",
|
||||
|
||||
debug() {
|
||||
let { client, target } = this.props;
|
||||
debugWorker(client, target.workerActor);
|
||||
},
|
||||
|
||||
render() {
|
||||
let { target, debugDisabled } = this.props;
|
||||
|
||||
@@ -35,10 +40,5 @@ module.exports = createClass({
|
||||
disabled: debugDisabled
|
||||
}, Strings.GetStringFromName("debug"))
|
||||
);
|
||||
},
|
||||
|
||||
debug() {
|
||||
let { client, target } = this.props;
|
||||
debugWorker(client, target.workerActor);
|
||||
}
|
||||
});
|
||||
@@ -48,45 +48,6 @@ module.exports = createClass({
|
||||
client.removeListener("workerListChanged", this.update);
|
||||
},
|
||||
|
||||
render() {
|
||||
let { client } = this.props;
|
||||
let { workers } = this.state;
|
||||
|
||||
return dom.div({
|
||||
id: "tab-workers",
|
||||
className: "tab",
|
||||
role: "tabpanel",
|
||||
"aria-labelledby": "tab-workers-header-name"
|
||||
},
|
||||
TabHeader({
|
||||
id: "tab-workers-header-name",
|
||||
name: Strings.GetStringFromName("workers")
|
||||
}),
|
||||
dom.div({ id: "workers", className: "inverted-icons" },
|
||||
TargetList({
|
||||
client,
|
||||
id: "service-workers",
|
||||
name: Strings.GetStringFromName("serviceWorkers"),
|
||||
targetClass: ServiceWorkerTarget,
|
||||
targets: workers.service
|
||||
}),
|
||||
TargetList({
|
||||
client,
|
||||
id: "shared-workers",
|
||||
name: Strings.GetStringFromName("sharedWorkers"),
|
||||
targetClass: WorkerTarget,
|
||||
targets: workers.shared
|
||||
}),
|
||||
TargetList({
|
||||
client,
|
||||
id: "other-workers",
|
||||
name: Strings.GetStringFromName("otherWorkers"),
|
||||
targetClass: WorkerTarget,
|
||||
targets: workers.other
|
||||
})
|
||||
));
|
||||
},
|
||||
|
||||
update() {
|
||||
let workers = this.getInitialState().workers;
|
||||
|
||||
@@ -136,5 +97,44 @@ module.exports = createClass({
|
||||
|
||||
this.setState({ workers });
|
||||
});
|
||||
},
|
||||
|
||||
render() {
|
||||
let { client } = this.props;
|
||||
let { workers } = this.state;
|
||||
|
||||
return dom.div({
|
||||
id: "tab-workers",
|
||||
className: "tab",
|
||||
role: "tabpanel",
|
||||
"aria-labelledby": "tab-workers-header-name"
|
||||
},
|
||||
TabHeader({
|
||||
id: "tab-workers-header-name",
|
||||
name: Strings.GetStringFromName("workers")
|
||||
}),
|
||||
dom.div({ id: "workers", className: "inverted-icons" },
|
||||
TargetList({
|
||||
client,
|
||||
id: "service-workers",
|
||||
name: Strings.GetStringFromName("serviceWorkers"),
|
||||
targetClass: ServiceWorkerTarget,
|
||||
targets: workers.service
|
||||
}),
|
||||
TargetList({
|
||||
client,
|
||||
id: "shared-workers",
|
||||
name: Strings.GetStringFromName("sharedWorkers"),
|
||||
targetClass: WorkerTarget,
|
||||
targets: workers.shared
|
||||
}),
|
||||
TargetList({
|
||||
client,
|
||||
id: "other-workers",
|
||||
name: Strings.GetStringFromName("otherWorkers"),
|
||||
targetClass: WorkerTarget,
|
||||
targets: workers.other
|
||||
})
|
||||
));
|
||||
}
|
||||
});
|
||||
@@ -107,6 +107,11 @@ timerStarted=%S: timer started
|
||||
# is the number of milliseconds.
|
||||
timeEnd=%1$S: %2$Sms
|
||||
|
||||
# LOCALIZATION NOTE (consoleCleared): this string is displayed when receiving a
|
||||
# call to console.clear() to let the user know the previous messages of the
|
||||
# console have been removed programmatically.
|
||||
consoleCleared=Console was cleared.
|
||||
|
||||
# LOCALIZATION NOTE (noCounterLabel): this string is used to display
|
||||
# count-messages with no label provided.
|
||||
noCounterLabel=<no label>
|
||||
|
||||
@@ -21,9 +21,6 @@ const Viewports = createFactory(require("./components/viewports"));
|
||||
const GlobalToolbar = createFactory(require("./components/global-toolbar"));
|
||||
|
||||
let App = createClass({
|
||||
|
||||
displayName: "App",
|
||||
|
||||
propTypes: {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
location: Types.location.isRequired,
|
||||
@@ -31,6 +28,8 @@ let App = createClass({
|
||||
screenshot: PropTypes.shape(Types.screenshot).isRequired,
|
||||
},
|
||||
|
||||
displayName: "App",
|
||||
|
||||
onBrowserMounted() {
|
||||
window.postMessage({ type: "browser-mounted" }, "*");
|
||||
},
|
||||
|
||||
@@ -16,11 +16,6 @@ const Types = require("../types");
|
||||
const { waitForMessage } = require("../utils/e10s");
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "Browser",
|
||||
|
||||
mixins: [ addons.PureRenderMixin ],
|
||||
|
||||
/**
|
||||
* This component is not allowed to depend directly on frequently changing
|
||||
* data (width, height) due to the use of `dangerouslySetInnerHTML` below.
|
||||
@@ -33,6 +28,10 @@ module.exports = createClass({
|
||||
onContentResize: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "Browser",
|
||||
|
||||
mixins: [ addons.PureRenderMixin ],
|
||||
|
||||
/**
|
||||
* Once the browser element has mounted, load the frame script and enable
|
||||
* various features, like floating scrollbars.
|
||||
|
||||
@@ -11,9 +11,6 @@ const { DOM: dom, createClass, PropTypes, addons } =
|
||||
const Types = require("../types");
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "DeviceSelector",
|
||||
|
||||
propTypes: {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
selectedDevice: PropTypes.string.isRequired,
|
||||
@@ -21,6 +18,8 @@ module.exports = createClass({
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "DeviceSelector",
|
||||
|
||||
mixins: [ addons.PureRenderMixin ],
|
||||
|
||||
onSelectChange({ target }) {
|
||||
|
||||
@@ -10,15 +10,14 @@ const { DOM: dom, createClass, PropTypes, addons } =
|
||||
const Types = require("../types");
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "GlobalToolbar",
|
||||
|
||||
propTypes: {
|
||||
onExit: PropTypes.func.isRequired,
|
||||
onScreenshot: PropTypes.func.isRequired,
|
||||
screenshot: PropTypes.shape(Types.screenshot).isRequired,
|
||||
},
|
||||
|
||||
displayName: "GlobalToolbar",
|
||||
|
||||
mixins: [ addons.PureRenderMixin ],
|
||||
|
||||
render() {
|
||||
|
||||
@@ -18,9 +18,6 @@ const VIEWPORT_MIN_WIDTH = Constants.MIN_VIEWPORT_DIMENSION;
|
||||
const VIEWPORT_MIN_HEIGHT = Constants.MIN_VIEWPORT_DIMENSION;
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "ResizableViewport",
|
||||
|
||||
propTypes: {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
location: Types.location.isRequired,
|
||||
@@ -33,6 +30,8 @@ module.exports = createClass({
|
||||
onRotateViewport: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "ResizableViewport",
|
||||
|
||||
getInitialState() {
|
||||
return {
|
||||
isResizing: false,
|
||||
|
||||
@@ -11,15 +11,14 @@ const Constants = require("../constants");
|
||||
const Types = require("../types");
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "ViewportDimension",
|
||||
|
||||
propTypes: {
|
||||
viewport: PropTypes.shape(Types.viewport).isRequired,
|
||||
onChangeViewportDevice: PropTypes.func.isRequired,
|
||||
onResizeViewport: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "ViewportDimension",
|
||||
|
||||
getInitialState() {
|
||||
let { width, height } = this.props.viewport;
|
||||
|
||||
|
||||
@@ -11,11 +11,6 @@ const Types = require("../types");
|
||||
const DeviceSelector = createFactory(require("./device-selector"));
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "ViewportToolbar",
|
||||
|
||||
mixins: [ addons.PureRenderMixin ],
|
||||
|
||||
propTypes: {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
selectedDevice: PropTypes.string.isRequired,
|
||||
@@ -24,6 +19,10 @@ module.exports = createClass({
|
||||
onRotateViewport: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "ViewportToolbar",
|
||||
|
||||
mixins: [ addons.PureRenderMixin ],
|
||||
|
||||
render() {
|
||||
let {
|
||||
devices,
|
||||
|
||||
@@ -12,9 +12,6 @@ const ResizableViewport = createFactory(require("./resizable-viewport"));
|
||||
const ViewportDimension = createFactory(require("./viewport-dimension"));
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "Viewport",
|
||||
|
||||
propTypes: {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
location: Types.location.isRequired,
|
||||
@@ -27,6 +24,8 @@ module.exports = createClass({
|
||||
onRotateViewport: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "Viewport",
|
||||
|
||||
onChangeViewportDevice(device) {
|
||||
let {
|
||||
viewport,
|
||||
|
||||
@@ -11,9 +11,6 @@ const Types = require("../types");
|
||||
const Viewport = createFactory(require("./viewport"));
|
||||
|
||||
module.exports = createClass({
|
||||
|
||||
displayName: "Viewports",
|
||||
|
||||
propTypes: {
|
||||
devices: PropTypes.shape(Types.devices).isRequired,
|
||||
location: Types.location.isRequired,
|
||||
@@ -26,6 +23,8 @@ module.exports = createClass({
|
||||
onRotateViewport: PropTypes.func.isRequired,
|
||||
},
|
||||
|
||||
displayName: "Viewports",
|
||||
|
||||
render() {
|
||||
let {
|
||||
devices,
|
||||
|
||||
@@ -93,6 +93,7 @@ const CONSOLE_API_LEVELS_TO_SEVERITIES = {
|
||||
warn: "warning",
|
||||
info: "info",
|
||||
log: "log",
|
||||
clear: "log",
|
||||
trace: "log",
|
||||
table: "log",
|
||||
debug: "log",
|
||||
|
||||
@@ -69,6 +69,7 @@ support-files =
|
||||
test-closure-optimized-out.html
|
||||
test-closures.html
|
||||
test-console-assert.html
|
||||
test-console-clear.html
|
||||
test-console-count.html
|
||||
test-console-count-external-file.js
|
||||
test-console-extras.html
|
||||
@@ -157,6 +158,7 @@ skip-if = (e10s && (os == 'win' || os == 'mac')) # Bug 1243976
|
||||
[browser_cached_messages.js]
|
||||
[browser_console.js]
|
||||
[browser_console_addonsdk_loader_exception.js]
|
||||
[browser_console_clear_method.js]
|
||||
[browser_console_clear_on_reload.js]
|
||||
[browser_console_click_focus.js]
|
||||
[browser_console_consolejsm_output.js]
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Check that calls to console.clear from a script delete the messages
|
||||
// previously logged.
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
|
||||
"test/test-console-clear.html";
|
||||
|
||||
yield loadTab(TEST_URI);
|
||||
let hud = yield openConsole();
|
||||
ok(hud, "Web Console opened");
|
||||
|
||||
info("Check the console.clear() done on page load has been processed.");
|
||||
yield waitForLog("Console was cleared", hud);
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log1"), "log1 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log2"), "log2 not displayed");
|
||||
|
||||
info("Logging two messages log3, log4");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.wrappedJSObject.console.log("log3");
|
||||
content.wrappedJSObject.console.log("log4");
|
||||
});
|
||||
|
||||
yield waitForLog("log3", hud);
|
||||
yield waitForLog("log4", hud);
|
||||
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is still displayed");
|
||||
ok(hud.outputNode.textContent.includes("log3"), "log3 is displayed");
|
||||
ok(hud.outputNode.textContent.includes("log4"), "log4 is displayed");
|
||||
|
||||
info("Open the variables view sidebar for 'objFromPage'");
|
||||
yield openSidebar("objFromPage", { a: 1 }, hud);
|
||||
let sidebarClosed = hud.jsterm.once("sidebar-closed");
|
||||
|
||||
info("Call console.clear from the page");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.wrappedJSObject.console.clear();
|
||||
});
|
||||
|
||||
// Cannot wait for "Console was cleared" here because such a message is
|
||||
// already present and would yield immediately.
|
||||
info("Wait for variables view sidebar to be closed after console.clear()");
|
||||
yield sidebarClosed;
|
||||
|
||||
ok(!hud.outputNode.textContent.includes("log3"), "log3 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log4"), "log4 not displayed");
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is still displayed");
|
||||
is(hud.outputNode.textContent.split("Console was cleared").length, 2,
|
||||
"console.clear() message is only displayed once");
|
||||
|
||||
info("Logging one messages log5");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, {}, function* () {
|
||||
content.wrappedJSObject.console.log("log5");
|
||||
});
|
||||
yield waitForLog("log5", hud);
|
||||
|
||||
info("Close and reopen the webconsole.");
|
||||
yield closeConsole(gBrowser.selectedTab);
|
||||
hud = yield openConsole();
|
||||
yield waitForLog("Console was cleared", hud);
|
||||
|
||||
ok(hud.outputNode.textContent.includes("Console was cleared"),
|
||||
"console.clear() message is still displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log1"), "log1 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log2"), "log1 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log3"), "log3 not displayed");
|
||||
ok(!hud.outputNode.textContent.includes("log4"), "log4 not displayed");
|
||||
ok(hud.outputNode.textContent.includes("log5"), "log5 still displayed");
|
||||
});
|
||||
|
||||
/**
|
||||
* Wait for a single message to be logged in the provided webconsole instance
|
||||
* with the category CATEGORY_WEBDEV and the SEVERITY_LOG severity.
|
||||
*
|
||||
* @param {String} message
|
||||
* The expected messaged.
|
||||
* @param {WebConsole} webconsole
|
||||
* WebConsole instance in which the message should be logged.
|
||||
*/
|
||||
function* waitForLog(message, webconsole, options) {
|
||||
yield waitForMessages({
|
||||
webconsole: webconsole,
|
||||
messages: [{
|
||||
text: message,
|
||||
category: CATEGORY_WEBDEV,
|
||||
severity: SEVERITY_LOG,
|
||||
}],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the variables view sidebar for the object with the provided name objName
|
||||
* and wait for the expected object is displayed in the variables view.
|
||||
*
|
||||
* @param {String} objName
|
||||
* The name of the object to open in the sidebar.
|
||||
* @param {Object} expectedObj
|
||||
* The properties that should be displayed in the variables view.
|
||||
* @param {WebConsole} webconsole
|
||||
* WebConsole instance in which the message should be logged.
|
||||
*
|
||||
*/
|
||||
function* openSidebar(objName, expectedObj, webconsole) {
|
||||
let msg = yield webconsole.jsterm.execute(objName);
|
||||
ok(msg, "output message found");
|
||||
|
||||
let anchor = msg.querySelector("a");
|
||||
let body = msg.querySelector(".message-body");
|
||||
ok(anchor, "object anchor");
|
||||
ok(body, "message body");
|
||||
|
||||
yield EventUtils.synthesizeMouse(anchor, 2, 2, {}, webconsole.iframeWindow);
|
||||
|
||||
let vviewVar = yield webconsole.jsterm.once("variablesview-fetched");
|
||||
let vview = vviewVar._variablesView;
|
||||
ok(vview, "variables view object exists");
|
||||
|
||||
yield findVariableViewProperties(vviewVar, [
|
||||
expectedObj,
|
||||
], { webconsole: webconsole });
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html dir="ltr" xml:lang="en-US" lang="en-US"><head>
|
||||
<meta charset="utf-8">
|
||||
<title>Console.clear() tests</title>
|
||||
<script type="text/javascript">
|
||||
console.log("log1");
|
||||
console.log("log2");
|
||||
console.clear();
|
||||
|
||||
window.objFromPage = { a: 1 };
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="header">Clear Demo</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -142,6 +142,7 @@ const LEVELS = {
|
||||
warn: SEVERITY_WARNING,
|
||||
info: SEVERITY_INFO,
|
||||
log: SEVERITY_LOG,
|
||||
clear: SEVERITY_LOG,
|
||||
trace: SEVERITY_LOG,
|
||||
table: SEVERITY_LOG,
|
||||
debug: SEVERITY_LOG,
|
||||
@@ -1285,6 +1286,11 @@ WebConsoleFrame.prototype = {
|
||||
node = msg.init(this.output).render().element;
|
||||
break;
|
||||
}
|
||||
case "clear": {
|
||||
body = l10n.getStr("consoleCleared");
|
||||
clipboardText = body;
|
||||
break;
|
||||
}
|
||||
case "dir": {
|
||||
body = { arguments: args };
|
||||
let clipboardArray = [];
|
||||
@@ -2203,6 +2209,14 @@ WebConsoleFrame.prototype = {
|
||||
|
||||
let isRepeated = this._filterRepeatedMessage(node);
|
||||
|
||||
// If a clear message is processed while the webconsole is opened, the UI
|
||||
// should be cleared.
|
||||
if (message && message.level == "clear") {
|
||||
// Do not clear the consoleStorage here as it has been cleared already
|
||||
// by the clear method, only clear the UI.
|
||||
this.jsterm.clearOutput(false);
|
||||
}
|
||||
|
||||
let visible = !isRepeated && !isFiltered;
|
||||
if (!isRepeated) {
|
||||
this.outputNode.appendChild(node);
|
||||
|
||||
@@ -1042,6 +1042,7 @@ METHOD(Error, "error")
|
||||
METHOD(Exception, "exception")
|
||||
METHOD(Debug, "debug")
|
||||
METHOD(Table, "table")
|
||||
METHOD(Clear, "clear")
|
||||
|
||||
void
|
||||
Console::Trace(JSContext* aCx)
|
||||
@@ -1537,6 +1538,11 @@ Console::ProcessCallData(JSContext* aCx, ConsoleCallData* aData,
|
||||
innerID.AppendInt(aData->mInnerIDNumber);
|
||||
}
|
||||
|
||||
if (aData->mMethodName == MethodClear) {
|
||||
nsresult rv = mStorage->ClearEvents(innerID);
|
||||
NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
|
||||
if (NS_FAILED(mStorage->RecordEvent(innerID, outerID, eventValue))) {
|
||||
NS_WARNING("Failed to record a console event.");
|
||||
}
|
||||
|
||||
+5
-1
@@ -115,6 +115,9 @@ public:
|
||||
void
|
||||
Count(JSContext* aCx, const Sequence<JS::Value>& aData);
|
||||
|
||||
void
|
||||
Clear(JSContext* aCx, const Sequence<JS::Value>& aData);
|
||||
|
||||
void
|
||||
NoopMethod();
|
||||
|
||||
@@ -156,7 +159,8 @@ private:
|
||||
MethodTimeEnd,
|
||||
MethodTimeStamp,
|
||||
MethodAssert,
|
||||
MethodCount
|
||||
MethodCount,
|
||||
MethodClear
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
@@ -1657,7 +1657,7 @@ nsMessageManagerScriptExecutor::DidCreateGlobal()
|
||||
|
||||
// static
|
||||
void
|
||||
nsMessageManagerScriptExecutor::Shutdown()
|
||||
nsMessageManagerScriptExecutor::PurgeCache()
|
||||
{
|
||||
if (sCachedScripts) {
|
||||
NS_ASSERTION(sCachedScripts != nullptr, "Need cached scripts");
|
||||
@@ -1665,6 +1665,15 @@ nsMessageManagerScriptExecutor::Shutdown()
|
||||
delete iter.Data();
|
||||
iter.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsMessageManagerScriptExecutor::Shutdown()
|
||||
{
|
||||
if (sCachedScripts) {
|
||||
PurgeCache();
|
||||
|
||||
delete sCachedScripts;
|
||||
sCachedScripts = nullptr;
|
||||
|
||||
@@ -377,6 +377,7 @@ struct nsMessageManagerScriptHolder
|
||||
class nsMessageManagerScriptExecutor
|
||||
{
|
||||
public:
|
||||
static void PurgeCache();
|
||||
static void Shutdown();
|
||||
already_AddRefed<nsIXPConnectJSObjectHolder> GetGlobal()
|
||||
{
|
||||
@@ -417,15 +418,21 @@ class nsScriptCacheCleaner final : public nsIObserver
|
||||
nsScriptCacheCleaner()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
|
||||
if (obsSvc)
|
||||
if (obsSvc) {
|
||||
obsSvc->AddObserver(this, "message-manager-flush-caches", false);
|
||||
obsSvc->AddObserver(this, "xpcom-shutdown", false);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const char16_t *aData) override
|
||||
{
|
||||
nsMessageManagerScriptExecutor::Shutdown();
|
||||
if (strcmp("message-manager-flush-caches", aTopic) == 0) {
|
||||
nsMessageManagerScriptExecutor::PurgeCache();
|
||||
} else if (strcmp("xpcom-shutdown", aTopic) == 0) {
|
||||
nsMessageManagerScriptExecutor::Shutdown();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -649,6 +649,7 @@ skip-if = toolkit == 'android' #bug 687032
|
||||
[test_bug650776.html]
|
||||
[test_bug650784.html]
|
||||
[test_bug656283.html]
|
||||
[test_bug659625.html]
|
||||
[test_bug664916.html]
|
||||
[test_bug666604.html]
|
||||
skip-if = buildapp == 'b2g' # b2g(dom.disable_open_during_load not implemented in b2g) b2g-debug(dom.disable_open_during_load not implemented in b2g) b2g-desktop(dom.disable_open_during_load not implemented in b2g)
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=659625
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 659625</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=659625">Mozilla Bug 659625</a>
|
||||
<script type="application/javascript">
|
||||
const { Cc, Ci } = SpecialPowers;
|
||||
let consoleStorage = Cc["@mozilla.org/consoleAPI-storage;1"];
|
||||
let storage = consoleStorage.getService(Ci.nsIConsoleAPIStorage);
|
||||
|
||||
let clearAndCheckStorage = () => {
|
||||
console.clear();
|
||||
ok(storage.getEvents().length === 1,
|
||||
"Only one event remains in consoleAPIStorage");
|
||||
ok(storage.getEvents()[0].level === "clear",
|
||||
"Remaining event has level 'clear'");
|
||||
}
|
||||
|
||||
storage.clearEvents();
|
||||
ok(storage.getEvents().length === 0,
|
||||
"Console is empty when test is starting");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.log("log");
|
||||
console.debug("debug");
|
||||
console.warn("warn");
|
||||
console.error("error");
|
||||
console.exception("exception");
|
||||
ok(storage.getEvents().length === 6,
|
||||
"5 new console events have been registered for logging variants");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.trace();
|
||||
ok(storage.getEvents().length === 2,
|
||||
"1 new console event registered for trace");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.dir({});
|
||||
ok(storage.getEvents().length === 2,
|
||||
"1 new console event registered for dir");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.count("count-label");
|
||||
console.count("count-label");
|
||||
ok(storage.getEvents().length === 3,
|
||||
"2 new console events registered for 2 count calls");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.group("group-label")
|
||||
console.log("group-log");
|
||||
ok(storage.getEvents().length === 3,
|
||||
"2 new console events registered for group + log");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.groupCollapsed("group-collapsed")
|
||||
console.log("group-collapsed-log");
|
||||
ok(storage.getEvents().length === 3,
|
||||
"2 new console events registered for groupCollapsed + log");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.group("closed-group-label")
|
||||
console.log("group-log");
|
||||
console.groupEnd()
|
||||
ok(storage.getEvents().length === 4,
|
||||
"3 new console events registered for group/groupEnd");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.time("time-label");
|
||||
console.timeEnd();
|
||||
ok(storage.getEvents().length === 3,
|
||||
"2 new console events registered for time/timeEnd");
|
||||
clearAndCheckStorage();
|
||||
|
||||
console.timeStamp("timestamp-label");
|
||||
ok(storage.getEvents().length === 2,
|
||||
"1 new console event registered for timeStamp");
|
||||
clearAndCheckStorage();
|
||||
|
||||
// Check that console.clear() clears previous clear messages
|
||||
clearAndCheckStorage();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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/.
|
||||
*/
|
||||
|
||||
/* We need a JSImplementation but cannot get one without a contract ID. Since
|
||||
This object is only ever created from JS we don't need a real contract ID. */
|
||||
[ChromeOnly, JSImplementation="dummy"]
|
||||
interface Addon {
|
||||
// The add-on's ID.
|
||||
readonly attribute DOMString id;
|
||||
// The add-on's version.
|
||||
readonly attribute DOMString version;
|
||||
// The add-on's type (extension, theme, etc.).
|
||||
readonly attribute DOMString type;
|
||||
// The add-on's name in the current locale.
|
||||
readonly attribute DOMString name;
|
||||
// The add-on's description in the current locale.
|
||||
readonly attribute DOMString description;
|
||||
// If the user has enabled this add-on, note that it still may not be running
|
||||
// depending on whether enabling requires a restart or if the add-on is
|
||||
// incompatible in some way.
|
||||
readonly attribute boolean isEnabled;
|
||||
// If the add-on is currently active in the browser.
|
||||
readonly attribute boolean isActive;
|
||||
};
|
||||
|
||||
[HeaderFile="mozilla/AddonManagerWebAPI.h",
|
||||
Func="mozilla::AddonManagerWebAPI::IsAPIEnabled",
|
||||
NavigatorProperty="mozAddonManager",
|
||||
JSImplementation="@mozilla.org/addon-web-api/manager;1"]
|
||||
interface AddonManager {
|
||||
/**
|
||||
* Gets information about an add-on
|
||||
*
|
||||
* @param id
|
||||
* The ID of the add-on to test for.
|
||||
* @return A promise. It will resolve to an Addon if the add-on is installed.
|
||||
*/
|
||||
Promise<Addon> getAddonByID(DOMString id);
|
||||
};
|
||||
@@ -23,6 +23,7 @@ interface Console {
|
||||
void time(optional any time);
|
||||
void timeEnd(optional any time);
|
||||
void timeStamp(optional any data);
|
||||
void clear(any... data);
|
||||
|
||||
void profile(any... data);
|
||||
void profileEnd(any... data);
|
||||
@@ -32,8 +33,6 @@ interface Console {
|
||||
|
||||
// No-op methods for compatibility with other browsers.
|
||||
[BinaryName="noopMethod"]
|
||||
void clear();
|
||||
[BinaryName="noopMethod"]
|
||||
void markTimeline();
|
||||
[BinaryName="noopMethod"]
|
||||
void timeline();
|
||||
|
||||
@@ -20,6 +20,7 @@ PREPROCESSED_WEBIDL_FILES = [
|
||||
WEBIDL_FILES = [
|
||||
'AbstractWorker.webidl',
|
||||
'ActivityRequestHandler.webidl',
|
||||
'AddonManager.webidl',
|
||||
'AnalyserNode.webidl',
|
||||
'Animatable.webidl',
|
||||
'Animation.webidl',
|
||||
|
||||
@@ -53,6 +53,11 @@
|
||||
<!-- TODO: (bug 1263059) Remove specific tokens to enable CAST check. -->
|
||||
<property name="tokens" value="COMMA, SEMI"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
@@ -319,7 +319,7 @@ public final class ANRReporter extends BroadcastReceiver
|
||||
"\"OS\":" + JSONObject.quote(SysInfo.getName()) + "," +
|
||||
"\"version\":\"" + String.valueOf(SysInfo.getVersion()) + "\"," +
|
||||
"\"appID\":" + JSONObject.quote(AppConstants.MOZ_APP_ID) + "," +
|
||||
"\"appVersion\":" + JSONObject.quote(AppConstants.MOZ_APP_VERSION)+ "," +
|
||||
"\"appVersion\":" + JSONObject.quote(AppConstants.MOZ_APP_VERSION) + "," +
|
||||
"\"appName\":" + JSONObject.quote(AppConstants.MOZ_APP_BASENAME) + "," +
|
||||
"\"appBuildID\":" + JSONObject.quote(AppConstants.MOZ_APP_BUILDID) + "," +
|
||||
"\"appUpdateChannel\":" + JSONObject.quote(AppConstants.MOZ_UPDATE_CHANNEL) + "," +
|
||||
|
||||
@@ -152,7 +152,7 @@ class ActionBarTextSelection extends Layer implements TextSelection, GeckoEventL
|
||||
if (event.equals("TextSelection:ShowHandles")) {
|
||||
selectionID = message.getString("selectionID");
|
||||
final JSONArray handles = message.getJSONArray("handles");
|
||||
for (int i=0; i < handles.length(); i++) {
|
||||
for (int i = 0; i < handles.length(); i++) {
|
||||
String handle = handles.getString(i);
|
||||
getHandle(handle).setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class ActionBarTextSelection extends Layer implements TextSelection, GeckoEventL
|
||||
|
||||
} else if (event.equals("TextSelection:PositionHandles")) {
|
||||
final JSONArray positions = message.getJSONArray("positions");
|
||||
for (int i=0; i < positions.length(); i++) {
|
||||
for (int i = 0; i < positions.length(); i++) {
|
||||
JSONObject position = positions.getJSONObject(i);
|
||||
final int left = position.getInt("left");
|
||||
final int top = position.getInt("top");
|
||||
@@ -346,7 +346,7 @@ class ActionBarTextSelection extends Layer implements TextSelection, GeckoEventL
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Log.i(LOGTAG, "Exception building menu", ex);
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ class ActionBarTextSelection extends Layer implements TextSelection, GeckoEventL
|
||||
final JSONObject obj = mItems.getJSONObject(item.getItemId());
|
||||
GeckoAppShell.notifyObservers("TextSelection:Action", obj.optString("id"));
|
||||
return true;
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Log.i(LOGTAG, "Exception calling action", ex);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -121,7 +121,7 @@ class ActionModeCompat implements GeckoPopupMenu.OnMenuItemClickListener,
|
||||
int yOffset = location[1] + view.getHeight() / 2;
|
||||
|
||||
Toast toast = Toast.makeText(view.getContext(), item.getTitle(), Toast.LENGTH_SHORT);
|
||||
toast.setGravity(Gravity.TOP|Gravity.LEFT, xOffset, yOffset);
|
||||
toast.setGravity(Gravity.TOP | Gravity.LEFT, xOffset, yOffset);
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class AlarmReceiver extends BroadcastReceiver {
|
||||
};
|
||||
Timer timer = new Timer();
|
||||
// 5 seconds ought to be enough for anybody
|
||||
timer.schedule(releaseLockTask, 5*1000);
|
||||
timer.schedule(releaseLockTask, 5 * 1000);
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
|
||||
@@ -301,7 +301,7 @@ public class AndroidGamepadManager {
|
||||
if (deviceIds == null) {
|
||||
return;
|
||||
}
|
||||
for (int i=0; i < deviceIds.length; i++) {
|
||||
for (int i = 0; i < deviceIds.length; i++) {
|
||||
InputDevice device = InputDevice.getDevice(deviceIds[i]);
|
||||
if (device == null) {
|
||||
continue;
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.mozilla.gecko.db.BrowserContract;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.SuggestedSites;
|
||||
import org.mozilla.gecko.distribution.Distribution;
|
||||
import org.mozilla.gecko.distribution.Distribution.DistributionDescriptor;
|
||||
import org.mozilla.gecko.distribution.DistributionStoreCallback;
|
||||
import org.mozilla.gecko.dlc.DownloadContentService;
|
||||
import org.mozilla.gecko.dlc.catalog.DownloadContent;
|
||||
import org.mozilla.gecko.favicons.Favicons;
|
||||
@@ -324,7 +326,7 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
Log.d(LOGTAG, "BrowserApp.onTabChanged: " + tab.getId() + ": " + msg);
|
||||
switch(msg) {
|
||||
switch (msg) {
|
||||
case SELECTED:
|
||||
if (Tabs.getInstance().isSelectedTab(tab) && mDynamicToolbar.isEnabled()) {
|
||||
mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
|
||||
@@ -688,7 +690,9 @@ public class BrowserApp extends GeckoApp
|
||||
|
||||
// We want to upload the telemetry core ping as soon after startup as possible. It relies on the
|
||||
// Distribution being initialized. If you move this initialization, ensure it plays well with telemetry.
|
||||
Distribution distribution = Distribution.init(this);
|
||||
final Distribution distribution = Distribution.init(this);
|
||||
distribution.addOnDistributionReadyCallback(new DistributionStoreCallback(this, getProfile().getName()));
|
||||
|
||||
searchEngineManager = new SearchEngineManager(this, distribution);
|
||||
|
||||
// Init suggested sites engine in BrowserDB.
|
||||
@@ -915,7 +919,7 @@ public class BrowserApp extends GeckoApp
|
||||
if (AppConstants.MOZ_MEDIA_PLAYER) {
|
||||
try {
|
||||
return Class.forName("org.mozilla.gecko.MediaPlayerManager");
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
// Ignore failures
|
||||
Log.e(LOGTAG, "No native casting support", ex);
|
||||
}
|
||||
@@ -1182,7 +1186,7 @@ public class BrowserApp extends GeckoApp
|
||||
int itemId = -1;
|
||||
try {
|
||||
itemId = new JSONObject(result).getInt("button");
|
||||
} catch(JSONException ex) {
|
||||
} catch (JSONException ex) {
|
||||
Log.e(LOGTAG, "Exception reading bookmark prompt result", ex);
|
||||
}
|
||||
|
||||
@@ -3622,7 +3626,7 @@ public class BrowserApp extends GeckoApp
|
||||
|
||||
doRestart(args);
|
||||
}
|
||||
} catch(JSONException ex) {
|
||||
} catch (JSONException ex) {
|
||||
Log.e(LOGTAG, "Exception reading guest mode prompt result", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ class ChromeCast implements GeckoMediaPlayer {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch(IllegalStateException ex) {
|
||||
} catch (IllegalStateException ex) {
|
||||
// The media player may throw if the session has been killed. For now, we're just catching this here.
|
||||
sendError(callback, "Error playing");
|
||||
}
|
||||
@@ -329,7 +329,7 @@ class ChromeCast implements GeckoMediaPlayer {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch(IllegalStateException ex) {
|
||||
} catch (IllegalStateException ex) {
|
||||
// The media player may throw if the session has been killed. For now, we're just catching this here.
|
||||
sendError(callback, "Error pausing");
|
||||
}
|
||||
@@ -358,7 +358,7 @@ class ChromeCast implements GeckoMediaPlayer {
|
||||
}
|
||||
|
||||
return;
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
debug("Error ending", ex);
|
||||
}
|
||||
}
|
||||
@@ -368,7 +368,7 @@ class ChromeCast implements GeckoMediaPlayer {
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch(IllegalStateException ex) {
|
||||
} catch (IllegalStateException ex) {
|
||||
// The media player may throw if the session has been killed. For now, we're just catching this here.
|
||||
sendError(callback, "Error stopping");
|
||||
}
|
||||
|
||||
@@ -657,7 +657,7 @@ public class ContactService implements GeckoEventListener {
|
||||
if (DEBUG) {
|
||||
try {
|
||||
Log.d(LOGTAG, "Got contact: " + contact.toString(3));
|
||||
} catch (JSONException e) {}
|
||||
} catch (JSONException e) { }
|
||||
}
|
||||
|
||||
return contact;
|
||||
@@ -946,7 +946,7 @@ public class ContactService implements GeckoEventListener {
|
||||
}
|
||||
|
||||
String returnStatus = "KO";
|
||||
if(deleteContact(rawContactId)) {
|
||||
if (deleteContact(rawContactId)) {
|
||||
returnStatus = "OK";
|
||||
}
|
||||
|
||||
@@ -1730,7 +1730,7 @@ public class ContactService implements GeckoEventListener {
|
||||
long[] ids = new long[cursor.getCount()];
|
||||
int index = 0;
|
||||
cursor.moveToPosition(-1);
|
||||
while(cursor.moveToNext()) {
|
||||
while (cursor.moveToNext()) {
|
||||
ids[index] = cursor.getLong(cursor.getColumnIndex(RawContacts._ID));
|
||||
index++;
|
||||
}
|
||||
@@ -1821,7 +1821,7 @@ public class ContactService implements GeckoEventListener {
|
||||
return max;
|
||||
}
|
||||
|
||||
private static void putPossibleNullValueInJSONObject(final String key, final Object value, JSONObject jsonObject) throws JSONException{
|
||||
private static void putPossibleNullValueInJSONObject(final String key, final Object value, JSONObject jsonObject) throws JSONException {
|
||||
if (value != null) {
|
||||
jsonObject.put(key, value);
|
||||
} else {
|
||||
|
||||
@@ -148,7 +148,7 @@ public class DoorHangerPopup extends AnchoredPopup
|
||||
// This callback is automatically executed on the UI thread.
|
||||
@Override
|
||||
public void onTabChanged(final Tab tab, final Tabs.TabEvents msg, final Object data) {
|
||||
switch(msg) {
|
||||
switch (msg) {
|
||||
case CLOSED:
|
||||
// Remove any doorhangers for a tab when it's closed (make
|
||||
// a temporary set to avoid a ConcurrentModificationException)
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.mozilla.gecko.util.EventCallback;
|
||||
import java.io.File;
|
||||
import java.lang.IllegalArgumentException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
@@ -32,12 +33,14 @@ public class DownloadsIntegration implements NativeEventListener
|
||||
{
|
||||
private static final String LOGTAG = "GeckoDownloadsIntegration";
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final List<String> UNKNOWN_MIME_TYPES = new ArrayList<String>(3) {{
|
||||
add("unknown/unknown"); // This will be used as a default mime type for unknown files
|
||||
add("application/unknown");
|
||||
add("application/octet-stream"); // Github uses this for APK files
|
||||
}};
|
||||
private static final List<String> UNKNOWN_MIME_TYPES;
|
||||
static {
|
||||
final ArrayList<String> tempTypes = new ArrayList<>(3);
|
||||
tempTypes.add("unknown/unknown"); // This will be used as a default mime type for unknown files
|
||||
tempTypes.add("application/unknown");
|
||||
tempTypes.add("application/octet-stream"); // Github uses this for APK files
|
||||
UNKNOWN_MIME_TYPES = Collections.unmodifiableList(tempTypes);
|
||||
}
|
||||
|
||||
private static final String DOWNLOAD_REMOVE = "Download:Remove";
|
||||
|
||||
@@ -142,7 +145,7 @@ public class DownloadsIntegration implements NativeEventListener
|
||||
if (TextUtils.isEmpty(mimeType)) {
|
||||
final int extPosition = aFile.lastIndexOf(".");
|
||||
if (extPosition > 0 && extPosition < aFile.length() - 1) {
|
||||
mimeType = GeckoAppShell.getMimeTypeFromExtension(aFile.substring(extPosition+1));
|
||||
mimeType = GeckoAppShell.getMimeTypeFromExtension(aFile.substring(extPosition + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +196,7 @@ public class DownloadsIntegration implements NativeEventListener
|
||||
if (download.equals(d)) {
|
||||
dm.remove(d.id);
|
||||
}
|
||||
} while(c.moveToNext());
|
||||
} while (c.moveToNext());
|
||||
} finally {
|
||||
if (c != null) {
|
||||
c.close();
|
||||
@@ -223,7 +226,7 @@ public class DownloadsIntegration implements NativeEventListener
|
||||
|
||||
@Override
|
||||
public void onScanCompleted(String path, Uri uri) {
|
||||
if(path.equals(mFile)) {
|
||||
if (path.equals(mFile)) {
|
||||
mScanner.disconnect();
|
||||
mScanner = null;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ class FilePickerResultHandler implements ActivityResultHandler {
|
||||
if (tabId > -1 && !TextUtils.isEmpty(tempFile)) {
|
||||
Tabs.registerOnTabsChangedListener(this);
|
||||
}
|
||||
} catch(IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
Log.i(LOGTAG, "Error writing file", ex);
|
||||
} finally {
|
||||
if (fos != null) {
|
||||
|
||||
@@ -141,7 +141,7 @@ public abstract class GeckoApp
|
||||
ViewTreeObserver.OnGlobalLayoutListener {
|
||||
|
||||
private static final String LOGTAG = "GeckoApp";
|
||||
private static final int ONE_DAY_MS = 1000*60*60*24;
|
||||
private static final int ONE_DAY_MS = 1000 * 60 * 60 * 24;
|
||||
|
||||
public static final String ACTION_ALERT_CALLBACK = "org.mozilla.gecko.ACTION_ALERT_CALLBACK";
|
||||
public static final String ACTION_HOMESCREEN_SHORTCUT = "org.mozilla.gecko.BOOKMARK";
|
||||
@@ -278,7 +278,7 @@ public abstract class GeckoApp
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
// When a tab is closed, it is always unselected first.
|
||||
// When a tab is unselected, another tab is always selected first.
|
||||
switch(msg) {
|
||||
switch (msg) {
|
||||
case UNSELECTED:
|
||||
hidePlugins(tab);
|
||||
break;
|
||||
@@ -466,7 +466,7 @@ public abstract class GeckoApp
|
||||
for (String clear : clearSet) {
|
||||
try {
|
||||
clearObj.put(clear, true);
|
||||
} catch(JSONException ex) {
|
||||
} catch (JSONException ex) {
|
||||
Log.e(LOGTAG, "Error adding clear object " + clear, ex);
|
||||
}
|
||||
}
|
||||
@@ -474,7 +474,7 @@ public abstract class GeckoApp
|
||||
final JSONObject res = new JSONObject();
|
||||
try {
|
||||
res.put("sanitize", clearObj);
|
||||
} catch(JSONException ex) {
|
||||
} catch (JSONException ex) {
|
||||
Log.e(LOGTAG, "Error adding sanitize object", ex);
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ public abstract class GeckoApp
|
||||
final String sessionRestore = getSessionRestorePreference();
|
||||
try {
|
||||
res.put("dontSaveSession", "quit".equals(sessionRestore));
|
||||
} catch(JSONException ex) {
|
||||
} catch (JSONException ex) {
|
||||
Log.e(LOGTAG, "Error adding session restore data", ex);
|
||||
}
|
||||
}
|
||||
@@ -771,7 +771,7 @@ public abstract class GeckoApp
|
||||
}
|
||||
});
|
||||
|
||||
builder.setNegativeButton(R.string.site_settings_cancel, new DialogInterface.OnClickListener(){
|
||||
builder.setNegativeButton(R.string.site_settings_cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
@@ -936,7 +936,7 @@ public abstract class GeckoApp
|
||||
try {
|
||||
if (isDataURI) {
|
||||
int dataStart = aSrc.indexOf(",");
|
||||
byte[] buf = Base64.decode(aSrc.substring(dataStart+1), Base64.DEFAULT);
|
||||
byte[] buf = Base64.decode(aSrc.substring(dataStart + 1), Base64.DEFAULT);
|
||||
image = BitmapUtils.decodeByteArray(buf);
|
||||
} else {
|
||||
int byteRead;
|
||||
@@ -948,7 +948,7 @@ public abstract class GeckoApp
|
||||
// Cannot read from same stream twice. Also, InputStream from
|
||||
// URL does not support reset. So converting to byte array.
|
||||
|
||||
while((byteRead = is.read(buf)) != -1) {
|
||||
while ((byteRead = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, byteRead);
|
||||
}
|
||||
byte[] imgBuffer = os.toByteArray();
|
||||
@@ -983,22 +983,22 @@ public abstract class GeckoApp
|
||||
} else {
|
||||
SnackbarHelper.showSnackbar(this, getString(R.string.set_image_fail), Snackbar.LENGTH_LONG);
|
||||
}
|
||||
} catch(OutOfMemoryError ome) {
|
||||
} catch (OutOfMemoryError ome) {
|
||||
Log.e(LOGTAG, "Out of Memory when converting to byte array", ome);
|
||||
} catch(IOException ioe) {
|
||||
} catch (IOException ioe) {
|
||||
Log.e(LOGTAG, "I/O Exception while setting wallpaper", ioe);
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch(IOException ioe) {
|
||||
} catch (IOException ioe) {
|
||||
Log.w(LOGTAG, "I/O Exception while closing stream", ioe);
|
||||
}
|
||||
}
|
||||
if (os != null) {
|
||||
try {
|
||||
os.close();
|
||||
} catch(IOException ioe) {
|
||||
} catch (IOException ioe) {
|
||||
Log.w(LOGTAG, "I/O Exception while closing stream", ioe);
|
||||
}
|
||||
}
|
||||
@@ -1132,7 +1132,7 @@ public abstract class GeckoApp
|
||||
// Workaround for <http://code.google.com/p/android/issues/detail?id=20915>.
|
||||
try {
|
||||
Class.forName("android.os.AsyncTask");
|
||||
} catch (ClassNotFoundException e) {}
|
||||
} catch (ClassNotFoundException e) { }
|
||||
|
||||
MemoryMonitor.getInstance().init(getApplicationContext());
|
||||
|
||||
|
||||
@@ -514,7 +514,7 @@ public class GeckoAppShell
|
||||
getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
// AlarmManager only supports millisecond precision
|
||||
long time = ((long)aSeconds * 1000) + ((long)aNanoSeconds/1_000_000L);
|
||||
long time = ((long) aSeconds * 1000) + ((long) aNanoSeconds / 1_000_000L);
|
||||
am.setExact(AlarmManager.RTC_WAKEUP, time, pi);
|
||||
|
||||
return true;
|
||||
@@ -541,7 +541,7 @@ public class GeckoAppShell
|
||||
SensorManager sm = (SensorManager)
|
||||
getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
|
||||
|
||||
switch(aSensortype) {
|
||||
switch (aSensortype) {
|
||||
case GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR:
|
||||
if (gGameRotationVectorSensor == null) {
|
||||
gGameRotationVectorSensor = sm.getDefaultSensor(15);
|
||||
@@ -1231,7 +1231,7 @@ public class GeckoAppShell
|
||||
EnumerateGeckoProcesses(visitor);
|
||||
}
|
||||
|
||||
interface GeckoProcessesVisitor{
|
||||
interface GeckoProcessesVisitor {
|
||||
boolean callback(int pid);
|
||||
}
|
||||
|
||||
@@ -1297,7 +1297,7 @@ public class GeckoAppShell
|
||||
if (null != cmdlineReader) {
|
||||
try {
|
||||
cmdlineReader.close();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1492,7 +1492,7 @@ public class GeckoAppShell
|
||||
List<ResolveInfo> plugins = pm.queryIntentServices(new Intent(PLUGIN_ACTION),
|
||||
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
|
||||
|
||||
synchronized(mPackageInfoCache) {
|
||||
synchronized (mPackageInfoCache) {
|
||||
|
||||
// clear the list of existing packageInfo objects
|
||||
mPackageInfoCache.clear();
|
||||
@@ -1619,7 +1619,7 @@ public class GeckoAppShell
|
||||
return null;
|
||||
}
|
||||
|
||||
synchronized(mPackageInfoCache) {
|
||||
synchronized (mPackageInfoCache) {
|
||||
for (PackageInfo pkgInfo : mPackageInfoCache) {
|
||||
if (pluginLib.contains(pkgInfo.packageName)) {
|
||||
return pkgInfo.packageName;
|
||||
@@ -1792,7 +1792,7 @@ public class GeckoAppShell
|
||||
try {
|
||||
if (getGeckoInterface() != null)
|
||||
getGeckoInterface().enableCameraView();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1824,7 +1824,7 @@ public class GeckoAppShell
|
||||
params.setPreviewFrameRate(nFps);
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
params.setPreviewFrameRate(kPreferredFPS);
|
||||
}
|
||||
|
||||
@@ -1871,7 +1871,7 @@ public class GeckoAppShell
|
||||
result[1] = params.getPreviewSize().width;
|
||||
result[2] = params.getPreviewSize().height;
|
||||
result[3] = params.getPreviewFrameRate();
|
||||
} catch(RuntimeException e) {
|
||||
} catch (RuntimeException e) {
|
||||
Log.w(LOGTAG, "initCamera RuntimeException.", e);
|
||||
result[0] = result[1] = result[2] = result[3] = 0;
|
||||
}
|
||||
@@ -1886,7 +1886,7 @@ public class GeckoAppShell
|
||||
try {
|
||||
if (getGeckoInterface() != null)
|
||||
getGeckoInterface().disableCameraView();
|
||||
} catch (Exception e) {}
|
||||
} catch (Exception e) { }
|
||||
}
|
||||
});
|
||||
if (sCamera != null) {
|
||||
@@ -2210,7 +2210,7 @@ public class GeckoAppShell
|
||||
try {
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, output);
|
||||
output.close();
|
||||
} catch (IOException ioe) {}
|
||||
} catch (IOException ioe) { }
|
||||
}
|
||||
});
|
||||
mHaveConnected = true;
|
||||
@@ -2242,7 +2242,7 @@ public class GeckoAppShell
|
||||
final Bitmap bitmap = BitmapUtils.getBitmapFromDrawable(d);
|
||||
return new BitmapConnection(bitmap);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Log.e(LOGTAG, "error", ex);
|
||||
}
|
||||
|
||||
@@ -2251,7 +2251,7 @@ public class GeckoAppShell
|
||||
if (colon == -1 || colon > spec.indexOf('/')) {
|
||||
spec = spec.replaceFirst("/", ":/");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -253,7 +253,7 @@ final class GeckoEditable extends JNIObject
|
||||
if (mActions.isEmpty()) {
|
||||
mActionsActive.acquireUninterruptibly();
|
||||
mActions.offer(action);
|
||||
} else synchronized(this) {
|
||||
} else synchronized (this) {
|
||||
// tryAcquire here in case Gecko thread has just released it
|
||||
mActionsActive.tryAcquire();
|
||||
mActions.offer(action);
|
||||
@@ -350,7 +350,7 @@ final class GeckoEditable extends JNIObject
|
||||
throw new IllegalStateException("empty actions queue");
|
||||
}
|
||||
|
||||
synchronized(this) {
|
||||
synchronized (this) {
|
||||
if (mActions.isEmpty()) {
|
||||
mActionsActive.release();
|
||||
}
|
||||
|
||||
@@ -322,11 +322,11 @@ public class GeckoEvent {
|
||||
// reverse which radius is major and minor
|
||||
if (mOrientations[index] < 0) {
|
||||
mOrientations[index] += 90;
|
||||
mPointRadii[index] = new Point((int)event.getToolMajor(eventIndex)/2,
|
||||
(int)event.getToolMinor(eventIndex)/2);
|
||||
mPointRadii[index] = new Point((int) event.getToolMajor(eventIndex) / 2,
|
||||
(int) event.getToolMinor(eventIndex) / 2);
|
||||
} else {
|
||||
mPointRadii[index] = new Point((int)event.getToolMinor(eventIndex)/2,
|
||||
(int)event.getToolMajor(eventIndex)/2);
|
||||
mPointRadii[index] = new Point((int) event.getToolMinor(eventIndex) / 2,
|
||||
(int) event.getToolMajor(eventIndex) / 2);
|
||||
}
|
||||
|
||||
if (!keepInViewCoordinates) {
|
||||
@@ -365,7 +365,7 @@ public class GeckoEvent {
|
||||
int sensor_type = s.sensor.getType();
|
||||
GeckoEvent event = null;
|
||||
|
||||
switch(sensor_type) {
|
||||
switch (sensor_type) {
|
||||
|
||||
case Sensor.TYPE_ACCELEROMETER:
|
||||
event = GeckoEvent.get(NativeGeckoEvent.SENSOR_EVENT);
|
||||
@@ -435,7 +435,7 @@ public class GeckoEvent {
|
||||
// s.values[3] was optional in API <= 18, so we need to compute it
|
||||
// The values form a unit quaternion, so we can compute the angle of
|
||||
// rotation purely based on the given 3 values.
|
||||
event.mW = 1 - s.values[0]*s.values[0] - s.values[1]*s.values[1] - s.values[2]*s.values[2];
|
||||
event.mW = 1 - s.values[0] * s.values[0] - s.values[1] * s.values[1] - s.values[2] * s.values[2];
|
||||
event.mW = (event.mW > 0.0) ? Math.sqrt(event.mW) : 0.0;
|
||||
}
|
||||
break;
|
||||
@@ -601,7 +601,7 @@ public class GeckoEvent {
|
||||
int bits = 0;
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
if (array[i]) {
|
||||
bits |= 1<<i;
|
||||
bits |= 1 << i;
|
||||
}
|
||||
}
|
||||
return bits;
|
||||
|
||||
@@ -290,7 +290,7 @@ class GeckoInputConnection
|
||||
}
|
||||
try {
|
||||
imm.restartInput(v);
|
||||
} catch(RuntimeException e) {
|
||||
} catch (RuntimeException e) {
|
||||
Log.e(LOGTAG, "Error restarting input", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GeckoJavaSampler {
|
||||
if (!mPauseSampler) {
|
||||
StackTraceElement[] bt = sMainThread.getStackTrace();
|
||||
mSamples.get(0)[mSamplePos] = new Sample(bt);
|
||||
mSamplePos = (mSamplePos+1) % mSamples.get(0).length;
|
||||
mSamplePos = (mSamplePos + 1) % mSamples.get(0).length;
|
||||
}
|
||||
if (mStopSampler) {
|
||||
break;
|
||||
|
||||
@@ -301,8 +301,7 @@ public class GeckoNetworkManager extends BroadcastReceiver implements NativeEven
|
||||
NetworkInfo ni = null;
|
||||
try {
|
||||
ni = cm.getActiveNetworkInfo();
|
||||
} catch (SecurityException se) {} // if we don't have the permission, fall through to null check
|
||||
|
||||
} catch (SecurityException se) { /* if we don't have the permission, fall through to null check */ }
|
||||
if (ni == null) {
|
||||
return ConnectionType.NONE;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ public final class GeckoProfile {
|
||||
mLocked = LockState.UNLOCKED;
|
||||
}
|
||||
return result;
|
||||
} catch(IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
Log.e(LOGTAG, "Error locking profile", ex);
|
||||
}
|
||||
mLocked = LockState.UNLOCKED;
|
||||
@@ -527,7 +527,7 @@ public final class GeckoProfile {
|
||||
mLocked = LockState.LOCKED;
|
||||
}
|
||||
return result;
|
||||
} catch(IOException ex) {
|
||||
} catch (IOException ex) {
|
||||
Log.e(LOGTAG, "Error unlocking profile", ex);
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ public final class GeckoProfile {
|
||||
} catch (final IOException e) {
|
||||
// Avoid log spam: don't log the full Exception w/ the stack trace.
|
||||
Log.d(LOGTAG, "Could not migrate client ID from FHR – creating a new one: " + e.getLocalizedMessage());
|
||||
clientIdToWrite = UUID.randomUUID().toString();
|
||||
clientIdToWrite = generateNewClientId();
|
||||
}
|
||||
|
||||
// There is a possibility Gecko is running and the Gecko telemetry implementation decided it's time to generate
|
||||
@@ -641,6 +641,10 @@ public final class GeckoProfile {
|
||||
return getValidClientIdFromDisk(CLIENT_ID_FILE_PATH);
|
||||
}
|
||||
|
||||
protected static String generateNewClientId() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a valid client ID
|
||||
* @throws IOException if a valid client ID could not be retrieved
|
||||
@@ -655,6 +659,9 @@ public final class GeckoProfile {
|
||||
throw new IOException("Received client ID is invalid: " + clientId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists the given client ID to disk. This will overwrite any existing files.
|
||||
*/
|
||||
@WorkerThread
|
||||
private void persistClientId(final String clientId) throws IOException {
|
||||
if (!ensureParentDirs(CLIENT_ID_FILE_PATH)) {
|
||||
@@ -917,7 +924,7 @@ public final class GeckoProfile {
|
||||
try {
|
||||
int sectionNumber = Integer.parseInt(section.getName().substring("Profile".length()));
|
||||
String curSection = "Profile" + sectionNumber;
|
||||
String nextSection = "Profile" + (sectionNumber+1);
|
||||
String nextSection = "Profile" + (sectionNumber + 1);
|
||||
|
||||
sections.remove(curSection);
|
||||
|
||||
@@ -926,7 +933,7 @@ public final class GeckoProfile {
|
||||
sectionNumber++;
|
||||
|
||||
curSection = nextSection;
|
||||
nextSection = "Profile" + (sectionNumber+1);
|
||||
nextSection = "Profile" + (sectionNumber + 1);
|
||||
}
|
||||
} catch (NumberFormatException nex) {
|
||||
// uhm, malformed Profile thing; we can't do much.
|
||||
@@ -983,6 +990,7 @@ public final class GeckoProfile {
|
||||
return GeckoProfileDirectories.findProfileDir(mMozillaDir, mName);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private File createProfileDir() throws IOException {
|
||||
if (isCustomProfile()) {
|
||||
// Custom profiles must already exist.
|
||||
@@ -1058,6 +1066,11 @@ public final class GeckoProfile {
|
||||
Log.w(LOGTAG, "Couldn't write " + TIMES_PATH, e);
|
||||
}
|
||||
|
||||
// Create the client ID file before Gecko starts (we assume this method
|
||||
// is called before Gecko starts). If we let Gecko start, the JS telemetry
|
||||
// code may try to write to the file at the same time Java does.
|
||||
persistClientId(generateNewClientId());
|
||||
|
||||
// Initialize pref flag for displaying the start pane for a new profile.
|
||||
final SharedPreferences prefs = GeckoSharedPrefs.forProfile(mApplicationContext);
|
||||
prefs.edit().putBoolean(FirstrunAnimationContainer.PREF_FIRSTRUN_ENABLED, true).apply();
|
||||
|
||||
@@ -79,7 +79,7 @@ class Envelope
|
||||
mRemainingParts = new int[size];
|
||||
mFailing = new boolean[size];
|
||||
|
||||
for (int i=0; i<size; ++i) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
mRemainingParts[i] = aParts;
|
||||
mFailing[i] = false;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class Postman
|
||||
*/
|
||||
int size = mEnvelopes.size();
|
||||
|
||||
for (int i=0; i<size; ++i) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
if (mEnvelopes.get(i) == null) {
|
||||
mEnvelopes.set(i, new Envelope(i, aParts));
|
||||
return i;
|
||||
@@ -598,7 +598,7 @@ public class GeckoSmsManager
|
||||
ArrayList<PendingIntent> deliveredPendingIntents =
|
||||
new ArrayList<PendingIntent>(parts.size());
|
||||
|
||||
for (int i=0; i<parts.size(); ++i) {
|
||||
for (int i = 0; i < parts.size(); ++i) {
|
||||
sentPendingIntents.add(
|
||||
PendingIntent.getBroadcast(GeckoAppShell.getContext(),
|
||||
pendingIntentGuid.incrementAndGet(), sentIntent,
|
||||
|
||||
@@ -543,7 +543,7 @@ public class GeckoView extends LayerView
|
||||
JSONObject result = new JSONObject();
|
||||
try {
|
||||
result.put("button", resultCode);
|
||||
} catch(JSONException ex) { }
|
||||
} catch (JSONException ex) { }
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ public class GeckoView extends LayerView
|
||||
JSONObject result = makeResult(RESULT_OK);
|
||||
try {
|
||||
result.put("textbox0", value);
|
||||
} catch(JSONException ex) { }
|
||||
} catch (JSONException ex) { }
|
||||
EventDispatcher.sendResponse(mMessage, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ public class MediaPlayerManager extends Fragment implements NativeEventListener
|
||||
if (route.supportsControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) {
|
||||
return new ChromeCast(getActivity(), route);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
debug("Error handling presentation", ex);
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ public final class NotificationHelper implements GeckoEventListener {
|
||||
try {
|
||||
// Action name must be in query uri, otherwise buttons pending intents
|
||||
// would be collapsed.
|
||||
if(action.has(ACTION_ID_ATTR)) {
|
||||
if (action.has(ACTION_ID_ATTR)) {
|
||||
builder.appendQueryParameter(ACTION_ID_ATTR, action.getString(ACTION_ID_ATTR));
|
||||
} else {
|
||||
Log.i(LOGTAG, "button event with no name");
|
||||
@@ -361,7 +361,7 @@ public final class NotificationHelper implements GeckoEventListener {
|
||||
JSONObject obj;
|
||||
try {
|
||||
obj = new JSONObject(json);
|
||||
} catch(JSONException ex) {
|
||||
} catch (JSONException ex) {
|
||||
obj = new JSONObject();
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ public class RemoteTabsExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
if (isExpanded && !client.tabs.isEmpty()) {
|
||||
deviceTypeResId = "desktop".equals(client.deviceType) ? R.drawable.sync_desktop : R.drawable.sync_mobile;
|
||||
textColorResId = R.color.placeholder_active_grey;
|
||||
deviceExpandedResId = showGroupIndicator ? R.drawable.arrow_down: R.drawable.home_group_collapsed;
|
||||
deviceExpandedResId = showGroupIndicator ? R.drawable.arrow_down : R.drawable.home_group_collapsed;
|
||||
} else {
|
||||
deviceTypeResId = "desktop".equals(client.deviceType) ? R.drawable.sync_desktop_inactive : R.drawable.sync_mobile_inactive;
|
||||
textColorResId = R.color.tabs_tray_icon_grey;
|
||||
|
||||
@@ -58,7 +58,7 @@ public abstract class SessionParser {
|
||||
* @param closedTabs, JSONArray of recently closed tab entries.
|
||||
* @throws JSONException
|
||||
*/
|
||||
public void onClosedTabsRead(final JSONArray closedTabs) throws JSONException{
|
||||
public void onClosedTabsRead(final JSONArray closedTabs) throws JSONException {
|
||||
}
|
||||
|
||||
public void parse(String... sessionStrings) {
|
||||
@@ -100,7 +100,7 @@ public abstract class SessionParser {
|
||||
|
||||
totalCount++;
|
||||
boolean selected = false;
|
||||
if (optSelected == i+1) {
|
||||
if (optSelected == i + 1) {
|
||||
selected = true;
|
||||
selectedIndex = totalCount;
|
||||
}
|
||||
|
||||
@@ -763,25 +763,25 @@ public class Tab {
|
||||
}
|
||||
|
||||
public void addPluginLayer(Object surfaceOrView, Layer layer) {
|
||||
synchronized(mPluginLayers) {
|
||||
synchronized (mPluginLayers) {
|
||||
mPluginLayers.put(surfaceOrView, layer);
|
||||
}
|
||||
}
|
||||
|
||||
public Layer getPluginLayer(Object surfaceOrView) {
|
||||
synchronized(mPluginLayers) {
|
||||
synchronized (mPluginLayers) {
|
||||
return mPluginLayers.get(surfaceOrView);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<Layer> getPluginLayers() {
|
||||
synchronized(mPluginLayers) {
|
||||
synchronized (mPluginLayers) {
|
||||
return new ArrayList<Layer>(mPluginLayers.values());
|
||||
}
|
||||
}
|
||||
|
||||
public Layer removePluginLayer(Object surfaceOrView) {
|
||||
synchronized(mPluginLayers) {
|
||||
synchronized (mPluginLayers) {
|
||||
return mPluginLayers.remove(surfaceOrView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class Tabs implements GeckoEventListener {
|
||||
public void run() {
|
||||
try {
|
||||
db.getTabsAccessor().persistLocalTabs(context.getContentResolver(), tabs);
|
||||
} catch(SQLiteException e) {
|
||||
} catch (SQLiteException e) {
|
||||
Log.w(LOGTAG, "Error persisting local tabs", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -606,7 +606,7 @@ public class ZoomedView extends FrameLayout implements LayerView.DynamicToolbarL
|
||||
}
|
||||
|
||||
private void setTextInZoomFactorButton(float zoom) {
|
||||
final String percentageValue = Integer.toString((int) (100*zoom));
|
||||
final String percentageValue = Integer.toString((int) (100 * zoom));
|
||||
changeZoomFactorButton.setText("- " + getResources().getString(R.string.percent, percentageValue) + " +");
|
||||
}
|
||||
|
||||
|
||||
@@ -1369,7 +1369,7 @@ public final class BrowserDatabaseHelper extends SQLiteOpenHelper {
|
||||
// We have to do incremental upgrades until we reach the current
|
||||
// database schema version.
|
||||
for (int v = oldVersion + 1; v <= newVersion; v++) {
|
||||
switch(v) {
|
||||
switch (v) {
|
||||
case 4:
|
||||
upgradeDatabaseFrom3to4(db);
|
||||
break;
|
||||
|
||||
@@ -310,7 +310,7 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
|
||||
final String sql;
|
||||
if (keepAfter > 0) {
|
||||
sql = "DELETE FROM " + TABLE_HISTORY + " " +
|
||||
"WHERE MAX(" + History.DATE_LAST_VISITED + ", " + History.DATE_MODIFIED +") < " + keepAfter + " " +
|
||||
"WHERE MAX(" + History.DATE_LAST_VISITED + ", " + History.DATE_MODIFIED + ") < " + keepAfter + " " +
|
||||
" AND " + History._ID + " IN ( SELECT " +
|
||||
History._ID + " FROM " + TABLE_HISTORY + " " +
|
||||
"ORDER BY " + sortOrder + " LIMIT " + toRemove +
|
||||
|
||||
@@ -151,7 +151,7 @@ public class FormHistoryProvider extends SQLiteBridgeContentProvider {
|
||||
public void onPostQuery(Cursor cursor, Uri uri, SQLiteBridge db) { }
|
||||
|
||||
@Override
|
||||
protected String getDBName(){
|
||||
protected String getDBName() {
|
||||
return DB_FILENAME;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class FormHistoryProvider extends SQLiteBridgeContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDBVersion(){
|
||||
protected int getDBVersion() {
|
||||
return DB_VERSION;
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class HomeProvider extends SQLiteBridgeContentProvider {
|
||||
*/
|
||||
|
||||
@Override
|
||||
protected String getDBName(){
|
||||
protected String getDBName() {
|
||||
return DB_FILENAME;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class HomeProvider extends SQLiteBridgeContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDBVersion(){
|
||||
protected int getDBVersion() {
|
||||
return DB_VERSION;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.Set;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.favicons.Favicons;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
@@ -37,15 +36,15 @@ public class LocalURLMetadata implements URLMetadata {
|
||||
uriWithProfile = DBUtils.appendProfileWithDefault(mProfile, URLMetadataTable.CONTENT_URI);
|
||||
}
|
||||
|
||||
// This returns a list of columns in the table. It's used to simplify some loops for reading/writing data.
|
||||
@SuppressWarnings("serial")
|
||||
private final Set<String> getModel() {
|
||||
return new HashSet<String>() {{
|
||||
add(URLMetadataTable.URL_COLUMN);
|
||||
add(URLMetadataTable.TILE_IMAGE_URL_COLUMN);
|
||||
add(URLMetadataTable.TILE_COLOR_COLUMN);
|
||||
add(URLMetadataTable.TOUCH_ICON_COLUMN);
|
||||
}};
|
||||
// A list of columns in the table. It's used to simplify some loops for reading/writing data.
|
||||
private static final Set<String> COLUMNS;
|
||||
static {
|
||||
final HashSet<String> tempModel = new HashSet<>(4);
|
||||
tempModel.add(URLMetadataTable.URL_COLUMN);
|
||||
tempModel.add(URLMetadataTable.TILE_IMAGE_URL_COLUMN);
|
||||
tempModel.add(URLMetadataTable.TILE_COLOR_COLUMN);
|
||||
tempModel.add(URLMetadataTable.TOUCH_ICON_COLUMN);
|
||||
COLUMNS = Collections.unmodifiableSet(tempModel);
|
||||
}
|
||||
|
||||
// Store a cache of recent results. This number is chosen to match the max number of tiles on about:home
|
||||
@@ -60,15 +59,12 @@ public class LocalURLMetadata implements URLMetadata {
|
||||
* Incoming data can include a list like: {touchIconList:{56:"http://x.com/56.png", 76:"http://x.com/76.png"}}.
|
||||
* This will then be filtered to find the most appropriate touchIcon, i.e. the closest icon size that is larger
|
||||
* than (or equal to) the preferred homescreen launcher icon size, which is then stored in the "touchIcon" property.
|
||||
*
|
||||
* @see #getModel() Returns the list of properties that will be stored in the database.
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> fromJSON(JSONObject obj) {
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
|
||||
Set<String> model = getModel();
|
||||
for (String key : model) {
|
||||
for (String key : COLUMNS) {
|
||||
if (obj.has(key)) {
|
||||
data.put(key, obj.optString(key));
|
||||
}
|
||||
@@ -108,10 +104,9 @@ public class LocalURLMetadata implements URLMetadata {
|
||||
private Map<String, Object> fromCursor(Cursor c) {
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
|
||||
Set<String> model = getModel();
|
||||
String[] columns = c.getColumnNames();
|
||||
for (String column : columns) {
|
||||
if (model.contains(column)) {
|
||||
if (COLUMNS.contains(column)) {
|
||||
try {
|
||||
data.put(column, c.getString(c.getColumnIndexOrThrow(column)));
|
||||
} catch (Exception ex) {
|
||||
@@ -199,7 +194,7 @@ public class LocalURLMetadata implements URLMetadata {
|
||||
|
||||
data.put(url, metadata);
|
||||
cache.put(url, metadata);
|
||||
} while(cursor.moveToNext());
|
||||
} while (cursor.moveToNext());
|
||||
|
||||
} finally {
|
||||
cursor.close();
|
||||
@@ -221,8 +216,7 @@ public class LocalURLMetadata implements URLMetadata {
|
||||
try {
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
Set<String> model = getModel();
|
||||
for (String key : model) {
|
||||
for (String key : COLUMNS) {
|
||||
if (data.containsKey(key)) {
|
||||
values.put(key, (String) data.get(key));
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PasswordsProvider extends SQLiteBridgeContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDBName(){
|
||||
protected String getDBName() {
|
||||
return DB_FILENAME;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class PasswordsProvider extends SQLiteBridgeContentProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDBVersion(){
|
||||
protected int getDBVersion() {
|
||||
return DB_VERSION;
|
||||
}
|
||||
|
||||
@@ -324,10 +324,10 @@ public class PasswordsProvider extends SQLiteBridgeContentProvider {
|
||||
|
||||
try {
|
||||
passwordIndex = cursor.getColumnIndexOrThrow(Passwords.ENCRYPTED_PASSWORD);
|
||||
} catch(Exception ex) { }
|
||||
} catch (Exception ex) { }
|
||||
try {
|
||||
usernameIndex = cursor.getColumnIndexOrThrow(Passwords.ENCRYPTED_USERNAME);
|
||||
} catch(Exception ex) { }
|
||||
} catch (Exception ex) { }
|
||||
|
||||
if (passwordIndex > -1 || usernameIndex > -1) {
|
||||
MatrixBlobCursor m = (MatrixBlobCursor)cursor;
|
||||
@@ -342,7 +342,7 @@ public class PasswordsProvider extends SQLiteBridgeContentProvider {
|
||||
String decrypted = doCrypto(cursor.getString(usernameIndex), uri, false);
|
||||
m.set(usernameIndex, decrypted);
|
||||
}
|
||||
} while(cursor.moveToNext());
|
||||
} while (cursor.moveToNext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,6 +352,34 @@ public class Distribution {
|
||||
return descFile;
|
||||
}
|
||||
|
||||
public DistributionDescriptor getDescriptor() {
|
||||
File descFile = getDistributionFile("preferences.json");
|
||||
if (descFile == null) {
|
||||
// Logging and existence checks are handled in getDistributionFile.
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
JSONObject all = new JSONObject(FileUtils.getFileContents(descFile));
|
||||
|
||||
if (!all.has("Global")) {
|
||||
Log.e(LOGTAG, "Distribution preferences.json has no Global entry!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DistributionDescriptor(all.getJSONObject("Global"));
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.e(LOGTAG, "Error getting distribution descriptor file.", e);
|
||||
Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, CODE_CATEGORY_MALFORMED_DISTRIBUTION);
|
||||
return null;
|
||||
} catch (JSONException e) {
|
||||
Log.e(LOGTAG, "Error parsing preferences.json", e);
|
||||
Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, CODE_CATEGORY_MALFORMED_DISTRIBUTION);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Android preferences from the preferences.json file, if any exist.
|
||||
* @return The preferences in a JSONObject, or an empty JSONObject if no preferences are defined.
|
||||
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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/.
|
||||
*/
|
||||
|
||||
package org.mozilla.gecko.distribution;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* A distribution ready callback that will store the distribution ID to profile-specific shared preferences.
|
||||
*/
|
||||
public class DistributionStoreCallback implements Distribution.ReadyCallback {
|
||||
private static final String LOGTAG = "Gecko" + DistributionStoreCallback.class.getSimpleName();
|
||||
|
||||
public static final String PREF_DISTRIBUTION_ID = "distribution.id";
|
||||
|
||||
private final WeakReference<Context> contextReference;
|
||||
private final String profileName;
|
||||
|
||||
public DistributionStoreCallback(final Context context, final String profileName) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.profileName = profileName;
|
||||
}
|
||||
|
||||
public void distributionNotFound() { /* nothing to do here */ }
|
||||
|
||||
@Override
|
||||
public void distributionFound(final Distribution distribution) {
|
||||
storeDistribution(distribution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distributionArrivedLate(final Distribution distribution) {
|
||||
storeDistribution(distribution);
|
||||
}
|
||||
|
||||
private void storeDistribution(final Distribution distribution) {
|
||||
final Context context = contextReference.get();
|
||||
if (context == null) {
|
||||
Log.w(LOGTAG, "Context is no longer alive, could retrieve shared prefs to store distribution");
|
||||
return;
|
||||
}
|
||||
|
||||
// While the distribution preferences are per install and not per profile, it's okay to use the
|
||||
// profile-specific prefs because:
|
||||
// 1) We don't really support mulitple profiles for end-users
|
||||
// 2) The TelemetryUploadService already accesses profile-specific shared prefs so this keeps things simple.
|
||||
final SharedPreferences sharedPrefs = GeckoSharedPrefs.forProfileName(context, profileName);
|
||||
final Distribution.DistributionDescriptor desc = distribution.getDescriptor();
|
||||
if (desc != null) {
|
||||
sharedPrefs.edit().putString(PREF_DISTRIBUTION_ID, desc.id).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public class Favicons {
|
||||
final LoadFaviconTask task =
|
||||
new LoadFaviconTask(context, pageURL, targetURL, 0, callback, targetSize, true);
|
||||
final int taskId = task.getId();
|
||||
synchronized(loadTasks) {
|
||||
synchronized (loadTasks) {
|
||||
loadTasks.put(taskId, task);
|
||||
}
|
||||
task.execute();
|
||||
@@ -369,7 +369,7 @@ public class Favicons {
|
||||
final LoadFaviconTask task =
|
||||
new LoadFaviconTask(context, pageURL, faviconURL, flags, listener, targetSize, false);
|
||||
final int taskId = task.getId();
|
||||
synchronized(loadTasks) {
|
||||
synchronized (loadTasks) {
|
||||
loadTasks.put(taskId, task);
|
||||
}
|
||||
task.execute();
|
||||
@@ -567,7 +567,7 @@ public class Favicons {
|
||||
}
|
||||
|
||||
public static void removeLoadTask(int taskId) {
|
||||
synchronized(loadTasks) {
|
||||
synchronized (loadTasks) {
|
||||
loadTasks.delete(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ public class LoadFaviconTask {
|
||||
Bitmap image;
|
||||
// Determine if there is already an ongoing task to fetch the Favicon we desire.
|
||||
// If there is, just join the queue and wait for it to finish. If not, we carry on.
|
||||
synchronized(loadsInFlight) {
|
||||
synchronized (loadsInFlight) {
|
||||
// Another load of the current Favicon is already underway
|
||||
LoadFaviconTask existingTask = loadsInFlight.get(faviconURL);
|
||||
if (existingTask != null && !existingTask.isCancelled()) {
|
||||
@@ -565,7 +565,7 @@ public class LoadFaviconTask {
|
||||
void onCancelled() {
|
||||
Favicons.removeLoadTask(id);
|
||||
|
||||
synchronized(loadsInFlight) {
|
||||
synchronized (loadsInFlight) {
|
||||
// Only remove from the hashmap if the task there is the one that's being canceled.
|
||||
// Cancellation of a task that would have chained is not interesting to the hashmap.
|
||||
final LoadFaviconTask primary = loadsInFlight.get(faviconURL);
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ public class FaviconCache {
|
||||
* @return true if this element already existed in the list, false otherwise. (Useful for preventing multiple-insertion.)
|
||||
*/
|
||||
private boolean setMostRecentlyUsedWithinRead(FaviconCacheElement element) {
|
||||
synchronized(reorderingLock) {
|
||||
synchronized (reorderingLock) {
|
||||
boolean contained = ordering.remove(element);
|
||||
ordering.offer(element);
|
||||
return contained;
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class IconDirectoryEntry implements Comparable<IconDirectoryEntry> {
|
||||
|
||||
// Extract the image dimensions.
|
||||
int imageWidth = buffer[entryOffset] & 0xFF;
|
||||
int imageHeight = buffer[entryOffset+1] & 0xFF;
|
||||
int imageHeight = buffer[entryOffset + 1] & 0xFF;
|
||||
|
||||
// Because Microsoft, a size value of zero represents an image size of 256.
|
||||
if (imageWidth == 0) {
|
||||
|
||||
@@ -135,7 +135,7 @@ abstract class Axis {
|
||||
|
||||
static final float MS_PER_FRAME = 1000.0f / 60.0f;
|
||||
static final long NS_PER_FRAME = Math.round(1000000000f / 60f);
|
||||
private static final float FRAMERATE_MULTIPLIER = (1000f/60f) / MS_PER_FRAME;
|
||||
private static final float FRAMERATE_MULTIPLIER = (1000f / 60f) / MS_PER_FRAME;
|
||||
private static final int FLING_VELOCITY_POINTS = 8;
|
||||
|
||||
// The values we use for friction are based on a 16.6ms frame, adjust them to currentNsPerFrame:
|
||||
@@ -265,8 +265,8 @@ abstract class Axis {
|
||||
|
||||
// Calculates and returns the value of the bezier curve with the given parameter t and control points p1 and p2
|
||||
float cubicBezier(float p1, float p2, float t) {
|
||||
return (3 * t * (1-t) * (1-t) * p1)
|
||||
+ (3 * t * t * (1-t) * p2)
|
||||
return (3 * t * (1 - t) * (1 - t) * p1)
|
||||
+ (3 * t * t * (1 - t) * p2)
|
||||
+ (t * t * t);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ abstract class Axis {
|
||||
guess[0] = By;
|
||||
|
||||
for (int i = 1; i < ni; i++) {
|
||||
guess[i] = guess[i-1] - (cubicBezier(y1, y2, guess[i-1]) - By) / getSlope(guess[i-1]);
|
||||
guess[i] = guess[i - 1] - (cubicBezier(y1, y2, guess[i - 1]) - By) / getSlope(guess[i - 1]);
|
||||
}
|
||||
// guess[4] is the final approximate root the cubic equation.
|
||||
float t = guess[4];
|
||||
@@ -409,7 +409,7 @@ abstract class Axis {
|
||||
return average / usablePoints;
|
||||
}
|
||||
|
||||
float accelerate(float velocity, float lastFlingVelocity){
|
||||
float accelerate(float velocity, float lastFlingVelocity) {
|
||||
return (FLING_ACCEL_BASE_MULTIPLIER * velocity + FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER * lastFlingVelocity);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ public final class BitmapUtils {
|
||||
|
||||
try {
|
||||
url = new URL(urlString);
|
||||
} catch(MalformedURLException e) {
|
||||
} catch (MalformedURLException e) {
|
||||
Log.w(LOGTAG, "decodeUrl: malformed URL " + urlString);
|
||||
return null;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ public final class BitmapUtils {
|
||||
|
||||
try {
|
||||
stream = url.openStream();
|
||||
} catch(IOException e) {
|
||||
} catch (IOException e) {
|
||||
Log.w(LOGTAG, "decodeUrl: IOException downloading " + url);
|
||||
return null;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public final class BitmapUtils {
|
||||
|
||||
try {
|
||||
stream.close();
|
||||
} catch(IOException e) {
|
||||
} catch (IOException e) {
|
||||
Log.w(LOGTAG, "decodeUrl: IOException closing stream " + url, e);
|
||||
}
|
||||
|
||||
@@ -334,9 +334,9 @@ public final class BitmapUtils {
|
||||
return Color.argb(255, 255, 255, 255);
|
||||
|
||||
// Return a color with the average hue/saturation/value of the bin with the most colors.
|
||||
hsv[0] = sumHue[maxBin]/colorBins[maxBin];
|
||||
hsv[1] = sumSat[maxBin]/colorBins[maxBin];
|
||||
hsv[2] = sumVal[maxBin]/colorBins[maxBin];
|
||||
hsv[0] = sumHue[maxBin] / colorBins[maxBin];
|
||||
hsv[1] = sumSat[maxBin] / colorBins[maxBin];
|
||||
hsv[2] = sumVal[maxBin] / colorBins[maxBin];
|
||||
return Color.HSVToColor(hsv);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ public final class BitmapUtils {
|
||||
|
||||
try {
|
||||
return Integer.parseInt(resource);
|
||||
} catch(NumberFormatException ex) {
|
||||
} catch (NumberFormatException ex) {
|
||||
// This isn't a resource id, try looking for a string
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ public final class BitmapUtils {
|
||||
icon = f.getInt(null);
|
||||
} catch (final NoSuchFieldException e2) {
|
||||
// This drawable doesn't seem to exist...
|
||||
} catch(Exception e3) {
|
||||
} catch (Exception e3) {
|
||||
Log.i(LOGTAG, "Exception getting drawable", e3);
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
!FloatUtils.fuzzyEquals(x + width, mProgressiveUpdateDisplayPort.getRight()) ||
|
||||
!FloatUtils.fuzzyEquals(y + height, mProgressiveUpdateDisplayPort.getBottom())) {
|
||||
mProgressiveUpdateDisplayPort =
|
||||
new DisplayPortMetrics(x, y, x+width, y+height, resolution);
|
||||
new DisplayPortMetrics(x, y, x + width, y + height, resolution);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public class ImmutableViewportMetrics {
|
||||
}
|
||||
|
||||
public RectF getCssViewport() {
|
||||
return RectUtils.scale(getViewport(), 1/zoomFactor);
|
||||
return RectUtils.scale(getViewport(), 1 / zoomFactor);
|
||||
}
|
||||
|
||||
public RectF getPageRect() {
|
||||
|
||||
@@ -57,7 +57,7 @@ class JavaPanZoomController
|
||||
private static final double AXIS_BREAKOUT_ANGLE = Math.PI / 8.0;
|
||||
|
||||
// The distance the user has to pan before we consider breaking out of a locked axis
|
||||
public static final float AXIS_BREAKOUT_THRESHOLD = 1/32f * GeckoAppShell.getDpi();
|
||||
public static final float AXIS_BREAKOUT_THRESHOLD = 1 / 32f * GeckoAppShell.getDpi();
|
||||
|
||||
// The maximum amount we allow you to zoom into a page
|
||||
private static final float MAX_ZOOM = 4.0f;
|
||||
@@ -210,8 +210,8 @@ class JavaPanZoomController
|
||||
private final static float easeOut(float t) {
|
||||
// ease-out approx.
|
||||
// -(t-1)^2+1
|
||||
t = t-1;
|
||||
return -t*t+1;
|
||||
t = t - 1;
|
||||
return -t * t + 1;
|
||||
}
|
||||
|
||||
private void setState(PanZoomState state) {
|
||||
@@ -266,9 +266,9 @@ class JavaPanZoomController
|
||||
float newHeight = viewableRect.height() * cssPageRect.width() / viewableRect.width();
|
||||
float dh = viewableRect.height() - newHeight; // increase in the height
|
||||
final RectF r = new RectF(0.0f,
|
||||
y + dh/2,
|
||||
y + dh / 2,
|
||||
cssPageRect.width(),
|
||||
y + dh/2 + newHeight);
|
||||
y + dh / 2 + newHeight);
|
||||
if (message.optBoolean("animate", true)) {
|
||||
mTarget.post(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -16,10 +16,10 @@ import android.view.View;
|
||||
public interface PanZoomController {
|
||||
// The distance the user has to pan before we recognize it as such (e.g. to avoid 1-pixel pans
|
||||
// between the touch-down and touch-up of a click). In units of density-independent pixels.
|
||||
public static final float PAN_THRESHOLD = 1/16f * GeckoAppShell.getDpi();
|
||||
public static final float PAN_THRESHOLD = 1 / 16f * GeckoAppShell.getDpi();
|
||||
|
||||
// Threshold for sending touch move events to content
|
||||
public static final float CLICK_THRESHOLD = 1/50f * GeckoAppShell.getDpi();
|
||||
public static final float CLICK_THRESHOLD = 1 / 50f * GeckoAppShell.getDpi();
|
||||
|
||||
static class Factory {
|
||||
static PanZoomController create(PanZoomTarget target, View view, EventDispatcher dispatcher) {
|
||||
|
||||
@@ -135,10 +135,10 @@ public class PluginLayer extends Layer {
|
||||
private void clampToMaxSize() {
|
||||
if (width > mMaxDimension || height > mMaxDimension) {
|
||||
if (width > height) {
|
||||
height = Math.round(((float)height/ width) * mMaxDimension);
|
||||
height = Math.round(((float) height / width) * mMaxDimension);
|
||||
width = mMaxDimension;
|
||||
} else {
|
||||
width = Math.round(((float)width/ height) * mMaxDimension);
|
||||
width = Math.round(((float) width / height) * mMaxDimension);
|
||||
height = mMaxDimension;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ class BookmarksListAdapter extends MultiTypeCursorAdapter {
|
||||
|
||||
public void swapCursor(Cursor c, FolderInfo folderInfo, RefreshType refreshType) {
|
||||
updateOpenFolderType(folderInfo);
|
||||
switch(refreshType) {
|
||||
switch (refreshType) {
|
||||
case PARENT:
|
||||
if (!isCurrentFolder(folderInfo)) {
|
||||
mParentStack.removeFirst();
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.mozilla.gecko.util.NetworkUtils;
|
||||
* A ListView of bookmarks.
|
||||
*/
|
||||
public class BookmarksListView extends HomeListView
|
||||
implements AdapterView.OnItemClickListener{
|
||||
implements AdapterView.OnItemClickListener {
|
||||
public static final String LOGTAG = "GeckoBookmarksListView";
|
||||
|
||||
public BookmarksListView(Context context) {
|
||||
|
||||
@@ -990,7 +990,7 @@ public class BrowserSearch extends HomeFragment
|
||||
// search term can occur if the user has previously searched for the same thing.
|
||||
final int maxSavedSuggestions = NETWORK_SUGGESTION_MAX + 1 + getContext().getResources().getInteger(R.integer.max_saved_suggestions);
|
||||
|
||||
final String sortOrderAndLimit = BrowserContract.SearchHistory.DATE +" DESC LIMIT " + maxSavedSuggestions;
|
||||
final String sortOrderAndLimit = BrowserContract.SearchHistory.DATE + " DESC LIMIT " + maxSavedSuggestions;
|
||||
final Cursor result = cr.query(BrowserContract.SearchHistory.CONTENT_URI, columns, actualQuery, queryArgs, sortOrderAndLimit);
|
||||
|
||||
if (result == null) {
|
||||
|
||||
@@ -218,7 +218,7 @@ public class CombinedHistoryAdapter extends RecyclerView.Adapter<CombinedHistory
|
||||
return position;
|
||||
} else if (type == ItemType.SECTION_HEADER) {
|
||||
return position - remoteClients.size();
|
||||
} else if (type == ItemType.HISTORY){
|
||||
} else if (type == ItemType.HISTORY) {
|
||||
return position - remoteClients.size() - getHeadersBefore(position);
|
||||
} else {
|
||||
return position;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class CombinedHistoryRecyclerView extends RecyclerView
|
||||
final int viewType = getAdapter().getItemViewType(position);
|
||||
final CombinedHistoryAdapter.ItemType itemType = CombinedHistoryAdapter.ItemType.viewTypeToItemType(viewType);
|
||||
|
||||
switch(itemType) {
|
||||
switch (itemType) {
|
||||
case CLIENT:
|
||||
mOnPanelLevelChangeListener.onPanelLevelChange(PanelLevel.CHILD);
|
||||
((CombinedHistoryAdapter) getAdapter()).showChildView(position);
|
||||
|
||||
@@ -191,7 +191,7 @@ public class DynamicPanel extends HomeFragment {
|
||||
}
|
||||
};
|
||||
|
||||
switch(mPanelConfig.getLayoutType()) {
|
||||
switch (mPanelConfig.getLayoutType()) {
|
||||
case FRAME:
|
||||
final PanelDatasetHandler datasetHandler = new PanelDatasetHandler();
|
||||
mPanelLayout = new FramePanelLayout(getActivity(), mPanelConfig, datasetHandler,
|
||||
@@ -215,7 +215,7 @@ public class DynamicPanel extends HomeFragment {
|
||||
}
|
||||
|
||||
private void setUIMode(UIMode mode) {
|
||||
switch(mode) {
|
||||
switch (mode) {
|
||||
case PANEL:
|
||||
if (mPanelAuthLayout != null) {
|
||||
mPanelAuthLayout.setVisibility(View.GONE);
|
||||
|
||||
@@ -1633,7 +1633,7 @@ public final class HomeConfig {
|
||||
}
|
||||
|
||||
public static int getTitleResourceIdForBuiltinPanelType(PanelType panelType) {
|
||||
switch(panelType) {
|
||||
switch (panelType) {
|
||||
case TOP_SITES:
|
||||
return R.string.home_top_sites_title;
|
||||
|
||||
@@ -1659,7 +1659,7 @@ public final class HomeConfig {
|
||||
}
|
||||
|
||||
public static String getIdForBuiltinPanelType(PanelType panelType) {
|
||||
switch(panelType) {
|
||||
switch (panelType) {
|
||||
case TOP_SITES:
|
||||
return TOP_SITES_PANEL_ID;
|
||||
|
||||
|
||||
@@ -172,11 +172,15 @@ public class HomeConfigPrefsBackend implements HomeConfigBackend {
|
||||
} else if (type == PanelType.REMOTE_TABS) {
|
||||
syncIndex = i;
|
||||
syncFlags = panelConfig.getFlags();
|
||||
} else if (type == PanelType.COMBINED_HISTORY) {
|
||||
// Partial landing of bug 1220928 combined the History and Sync panels of users who didn't
|
||||
// have home panel customizations (including new users), thus they don't this migration.
|
||||
return jsonPanels;
|
||||
}
|
||||
}
|
||||
|
||||
if (historyIndex == -1 || syncIndex == -1) {
|
||||
throw new IllegalArgumentException("Missing default panels");
|
||||
throw new IllegalArgumentException("Expected both History and Sync panels to be present prior to Combined History.");
|
||||
}
|
||||
|
||||
PanelConfig newPanel;
|
||||
|
||||
@@ -55,7 +55,7 @@ import android.view.View;
|
||||
*/
|
||||
public abstract class HomeFragment extends Fragment {
|
||||
// Log Tag.
|
||||
private static final String LOGTAG="GeckoHomeFragment";
|
||||
private static final String LOGTAG = "GeckoHomeFragment";
|
||||
|
||||
// Share MIME type.
|
||||
protected static final String SHARE_MIME_TYPE = "text/plain";
|
||||
@@ -378,7 +378,7 @@ public abstract class HomeFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
|
||||
switch(mType) {
|
||||
switch (mType) {
|
||||
case BOOKMARKS:
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.CONTEXT_MENU, "bookmark");
|
||||
mDB.removeBookmarksWithURL(cr, mUrl);
|
||||
|
||||
@@ -326,7 +326,7 @@ public class HomePanelsManager implements GeckoEventListener {
|
||||
pm.requestPanelsById(ids, new RequestCallback() {
|
||||
@Override
|
||||
public void onComplete(List<PanelInfo> panelInfos) {
|
||||
synchronized(panelRequestLock) {
|
||||
synchronized (panelRequestLock) {
|
||||
latestPanelInfos.addAll(panelInfos);
|
||||
Log.d(LOGTAG, "executeRefresh: fetched panel infos: " + panelInfos.size());
|
||||
|
||||
@@ -336,7 +336,7 @@ public class HomePanelsManager implements GeckoEventListener {
|
||||
});
|
||||
|
||||
try {
|
||||
synchronized(panelRequestLock) {
|
||||
synchronized (panelRequestLock) {
|
||||
panelRequestLock.wait(PANEL_INFO_TIMEOUT_MSEC);
|
||||
|
||||
Log.d(LOGTAG, "executeRefresh: done fetching panel infos");
|
||||
|
||||
@@ -75,7 +75,7 @@ public class PanelInfoManager implements GeckoEventListener {
|
||||
public void requestPanelsById(Set<String> ids, RequestCallback callback) {
|
||||
final int requestId = sRequestId.getAndIncrement();
|
||||
|
||||
synchronized(sCallbacks) {
|
||||
synchronized (sCallbacks) {
|
||||
// If there are no pending callbacks, register the event listener.
|
||||
if (sCallbacks.size() == 0) {
|
||||
EventDispatcher.getInstance().registerGeckoThreadListener(this,
|
||||
@@ -131,7 +131,7 @@ public class PanelInfoManager implements GeckoEventListener {
|
||||
final RequestCallback callback;
|
||||
final int requestId = message.getInt("requestId");
|
||||
|
||||
synchronized(sCallbacks) {
|
||||
synchronized (sCallbacks) {
|
||||
callback = sCallbacks.get(requestId);
|
||||
sCallbacks.delete(requestId);
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class PanelItemView extends LinearLayout {
|
||||
}
|
||||
|
||||
public static PanelItemView create(Context context, ItemType itemType) {
|
||||
switch(itemType) {
|
||||
switch (itemType) {
|
||||
case ARTICLE:
|
||||
return new ArticleItemView(context);
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ abstract class PanelLayout extends FrameLayout {
|
||||
|
||||
View view = viewState.getView();
|
||||
if (view == null) {
|
||||
switch(viewConfig.getType()) {
|
||||
switch (viewConfig.getType()) {
|
||||
case LIST:
|
||||
view = new PanelListView(getContext(), viewConfig);
|
||||
break;
|
||||
|
||||
@@ -182,10 +182,10 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
|
||||
int indexOfMatch = 0;
|
||||
int lastIndexOfMatch = 0;
|
||||
while(indexOfMatch != -1) {
|
||||
while (indexOfMatch != -1) {
|
||||
indexOfMatch = string.indexOf(pattern, lastIndexOfMatch);
|
||||
lastIndexOfMatch = indexOfMatch + patternLength;
|
||||
if(indexOfMatch != -1) {
|
||||
if (indexOfMatch != -1) {
|
||||
mOccurrences.add(indexOfMatch);
|
||||
}
|
||||
}
|
||||
@@ -267,7 +267,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
mEditSuggestionListener = listener;
|
||||
}
|
||||
|
||||
private void bindSuggestionView(String suggestion, boolean animate, int recycledSuggestionCount, Integer previousSuggestionChildIndex, boolean isUserSavedSearch, String telemetryTag){
|
||||
private void bindSuggestionView(String suggestion, boolean animate, int recycledSuggestionCount, Integer previousSuggestionChildIndex, boolean isUserSavedSearch, String telemetryTag) {
|
||||
final View suggestionItem;
|
||||
|
||||
// Reuse suggestion views from recycled view, if possible.
|
||||
|
||||
@@ -9,6 +9,7 @@ import static org.mozilla.gecko.db.URLMetadataTable.TILE_COLOR_COLUMN;
|
||||
import static org.mozilla.gecko.db.URLMetadataTable.TILE_IMAGE_URL_COLUMN;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -782,16 +783,18 @@ public class TopSitesPanel extends HomeFragment {
|
||||
/**
|
||||
* An AsyncTaskLoader to load the thumbnails from a cursor.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
static class ThumbnailsLoader extends AsyncTaskLoader<Map<String, ThumbnailInfo>> {
|
||||
private final BrowserDB mDB;
|
||||
private Map<String, ThumbnailInfo> mThumbnailInfos;
|
||||
private final ArrayList<String> mUrls;
|
||||
|
||||
private static final ArrayList<String> COLUMNS = new ArrayList<String>() {{
|
||||
add(TILE_IMAGE_URL_COLUMN);
|
||||
add(TILE_COLOR_COLUMN);
|
||||
}};
|
||||
private static final List<String> COLUMNS;
|
||||
static {
|
||||
final ArrayList<String> tempColumns = new ArrayList<>(2);
|
||||
tempColumns.add(TILE_IMAGE_URL_COLUMN);
|
||||
tempColumns.add(TILE_COLOR_COLUMN);
|
||||
COLUMNS = Collections.unmodifiableList(tempColumns);
|
||||
}
|
||||
|
||||
public ThumbnailsLoader(Context context, ArrayList<String> urls) {
|
||||
super(context);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class JavaAddonManagerV1 implements NativeEventListener {
|
||||
|
||||
private final org.mozilla.gecko.EventDispatcher mDispatcher;
|
||||
|
||||
// Protected by synchronized(this).
|
||||
// Protected by synchronized (this).
|
||||
private final Map<String, EventDispatcherImpl> mGUIDToDispatcherMap = new HashMap<>();
|
||||
|
||||
public static synchronized JavaAddonManagerV1 getInstance() {
|
||||
@@ -153,7 +153,7 @@ public class JavaAddonManagerV1 implements NativeEventListener {
|
||||
private final String guid;
|
||||
private final String dexFileName;
|
||||
|
||||
// Protected by synchronized(this).
|
||||
// Protected by synchronized (this).
|
||||
private final Map<JavaAddonInterfaceV1.EventListener, Pair<NativeEventListener, String[]>> mListenerToWrapperMap = new IdentityHashMap<>();
|
||||
|
||||
public EventDispatcherImpl(String guid, String dexFileName) {
|
||||
|
||||
Loaded 100 of 181 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user