зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-inboud to mozilla-central. a=merge
This commit is contained in:
Коммит
6ad641c5c4
|
@ -133,6 +133,33 @@ FindNamedObject(const ComparatorFnT& aComparator)
|
|||
return false;
|
||||
}
|
||||
|
||||
static const char* gBlockedUiaClients[] = {
|
||||
"osk.exe"
|
||||
};
|
||||
|
||||
static bool
|
||||
ShouldBlockUIAClient(nsIFile* aClientExe)
|
||||
{
|
||||
if (PR_GetEnv("MOZ_DISABLE_ACCESSIBLE_BLOCKLIST")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString leafName;
|
||||
nsresult rv = aClientExe->GetLeafName(leafName);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t index = 0, len = ArrayLength(gBlockedUiaClients); index < len;
|
||||
++index) {
|
||||
if (leafName.EqualsIgnoreCase(gBlockedUiaClients[index])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
|
@ -307,13 +334,12 @@ Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam)
|
|||
|
||||
a11y::SetInstantiator(remotePid.value());
|
||||
|
||||
/* This is where we could block UIA stuff
|
||||
// Block if necessary
|
||||
nsCOMPtr<nsIFile> instantiator;
|
||||
if (a11y::GetInstantiator(getter_AddRefs(instantiator)) &&
|
||||
ShouldBlockUIAClient(instantiator)) {
|
||||
return Some(false);
|
||||
}
|
||||
*/
|
||||
|
||||
return Some(true);
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
|
|||
if (!a11y::GetInstantiator(getter_AddRefs(clientExe))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
nsresult rv;
|
||||
if (!PR_GetEnv("MOZ_DISABLE_ACCESSIBLE_BLOCKLIST")) {
|
||||
// Debugging option is not present, so check blocklist.
|
||||
|
|
|
@ -61,49 +61,7 @@ this.Policies = {
|
|||
}
|
||||
},
|
||||
|
||||
"DisableAppUpdate": {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (param) {
|
||||
manager.disallowFeature("appUpdate");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"display_menu_bar": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param) {
|
||||
// This policy is meant to change the default behavior, not to force it.
|
||||
// If this policy was alreay applied and the user chose to re-hide the
|
||||
// menu bar, do not show it again.
|
||||
if (!Services.prefs.getBoolPref(PREF_MENU_ALREADY_DISPLAYED, false)) {
|
||||
log.debug("Showing the menu bar");
|
||||
gXulStore.setValue(BROWSER_DOCUMENT_URL, "toolbar-menubar", "autohide", "false");
|
||||
Services.prefs.setBoolPref(PREF_MENU_ALREADY_DISPLAYED, true);
|
||||
} else {
|
||||
log.debug("Not showing the menu bar because it has already been shown.");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"display_bookmarks_toolbar": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param) {
|
||||
// This policy is meant to change the default behavior, not to force it.
|
||||
// If this policy was alreay applied and the user chose to re-hide the
|
||||
// bookmarks toolbar, do not show it again.
|
||||
if (!Services.prefs.getBoolPref(PREF_BOOKMARKS_ALREADY_DISPLAYED, false)) {
|
||||
log.debug("Showing the bookmarks toolbar");
|
||||
gXulStore.setValue(BROWSER_DOCUMENT_URL, "PersonalToolbar", "collapsed", "false");
|
||||
Services.prefs.setBoolPref(PREF_BOOKMARKS_ALREADY_DISPLAYED, true);
|
||||
} else {
|
||||
log.debug("Not showing the bookmarks toolbar because it has already been shown.");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"block_set_desktop_background": {
|
||||
"BlockSetDesktopBackground": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param) {
|
||||
manager.disallowFeature("setDesktopBackground", true);
|
||||
|
@ -111,6 +69,12 @@ this.Policies = {
|
|||
}
|
||||
},
|
||||
|
||||
"Cookies": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("cookie", param.Allow, param.Block);
|
||||
}
|
||||
},
|
||||
|
||||
"CreateMasterPassword": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (!param) {
|
||||
|
@ -119,6 +83,14 @@ this.Policies = {
|
|||
}
|
||||
},
|
||||
|
||||
"DisableAppUpdate": {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (param) {
|
||||
manager.disallowFeature("appUpdate");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DisableFirefoxScreenshots": {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (param) {
|
||||
|
@ -143,21 +115,69 @@ this.Policies = {
|
|||
}
|
||||
},
|
||||
|
||||
"dont_check_default_browser": {
|
||||
"DisablePocket": {
|
||||
onBeforeAddons(manager, param) {
|
||||
if (param) {
|
||||
setAndLockPref("extensions.pocket.enabled", false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DisplayBookmarksToolbar": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param) {
|
||||
// This policy is meant to change the default behavior, not to force it.
|
||||
// If this policy was alreay applied and the user chose to re-hide the
|
||||
// bookmarks toolbar, do not show it again.
|
||||
if (!Services.prefs.getBoolPref(PREF_BOOKMARKS_ALREADY_DISPLAYED, false)) {
|
||||
log.debug("Showing the bookmarks toolbar");
|
||||
gXulStore.setValue(BROWSER_DOCUMENT_URL, "PersonalToolbar", "collapsed", "false");
|
||||
Services.prefs.setBoolPref(PREF_BOOKMARKS_ALREADY_DISPLAYED, true);
|
||||
} else {
|
||||
log.debug("Not showing the bookmarks toolbar because it has already been shown.");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DisplayMenuBar": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
if (param) {
|
||||
// This policy is meant to change the default behavior, not to force it.
|
||||
// If this policy was alreay applied and the user chose to re-hide the
|
||||
// menu bar, do not show it again.
|
||||
if (!Services.prefs.getBoolPref(PREF_MENU_ALREADY_DISPLAYED, false)) {
|
||||
log.debug("Showing the menu bar");
|
||||
gXulStore.setValue(BROWSER_DOCUMENT_URL, "toolbar-menubar", "autohide", "false");
|
||||
Services.prefs.setBoolPref(PREF_MENU_ALREADY_DISPLAYED, true);
|
||||
} else {
|
||||
log.debug("Not showing the menu bar because it has already been shown.");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DontCheckDefaultBrowser": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
setAndLockPref("browser.shell.checkDefaultBrowser", false);
|
||||
}
|
||||
},
|
||||
|
||||
"flash_plugin": {
|
||||
"FlashPlugin": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("plugin:flash", param.allow, param.block);
|
||||
addAllowDenyPermissions("plugin:flash", param.Allow, param.Block);
|
||||
}
|
||||
},
|
||||
|
||||
"popups": {
|
||||
"InstallAddons": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("popup", param.allow, param.block);
|
||||
addAllowDenyPermissions("install", param.Allow, param.Block);
|
||||
}
|
||||
},
|
||||
|
||||
"Popups": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("popup", param.Allow, param.Block);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -166,18 +186,6 @@ this.Policies = {
|
|||
setAndLockPref("signon.rememberSignons", param);
|
||||
}
|
||||
},
|
||||
|
||||
"install_addons": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("install", param.allow, param.block);
|
||||
}
|
||||
},
|
||||
|
||||
"cookies": {
|
||||
onBeforeUIStartup(manager, param) {
|
||||
addAllowDenyPermissions("cookie", param.allow, param.block);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
{
|
||||
"policies": {
|
||||
"block_about_config": true,
|
||||
"dont_check_default_browser": true,
|
||||
"BlockAboutProfiles": true,
|
||||
"DontCheckDefaultBrowser": true,
|
||||
|
||||
"flash_plugin": {
|
||||
"allow": [
|
||||
"FlashPlugin": {
|
||||
"Allow": [
|
||||
"https://www.example.com"
|
||||
],
|
||||
|
||||
"block": [
|
||||
"Block": [
|
||||
"https://www.example.org"
|
||||
]
|
||||
},
|
||||
|
||||
"block_about_profiles": true,
|
||||
"CreateMasterPassword": false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,32 +34,7 @@
|
|||
"enum": [true]
|
||||
},
|
||||
|
||||
"DisableAppUpdate": {
|
||||
"description": "Prevent the browser from updating.",
|
||||
"first_available": "60.0",
|
||||
"enterprise_only": true,
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"display_menu_bar": {
|
||||
"description": "Causes the menu bar to be displayed by default.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"display_bookmarks_toolbar": {
|
||||
"description": "Causes the bookmarks toolbar to be displayed by default.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"block_set_desktop_background": {
|
||||
"BlockSetDesktopBackground": {
|
||||
"description": "Prevents usage of the \"Set Image as Desktop Background\" feature.",
|
||||
"first_available": "60.0",
|
||||
|
||||
|
@ -67,6 +42,28 @@
|
|||
"enum": [true]
|
||||
},
|
||||
|
||||
"Cookies": {
|
||||
"description": "Allow or deny websites to set cookies.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
},
|
||||
|
||||
"Block": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CreateMasterPassword": {
|
||||
"description": "If false, removes access to create a master password.",
|
||||
"first_available": "60.0",
|
||||
|
@ -75,6 +72,15 @@
|
|||
"enum": [false]
|
||||
},
|
||||
|
||||
"DisableAppUpdate": {
|
||||
"description": "Prevent the browser from updating.",
|
||||
"first_available": "60.0",
|
||||
"enterprise_only": true,
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"DisableFirefoxScreenshots": {
|
||||
"description": "Prevents usage of the Firefox Screenshots feature.",
|
||||
"first_available": "60.0",
|
||||
|
@ -99,7 +105,31 @@
|
|||
"enum": [true]
|
||||
},
|
||||
|
||||
"dont_check_default_browser": {
|
||||
"DisablePocket": {
|
||||
"description": "Prevents ability to save webpages to Pocket.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"DisplayBookmarksToolbar": {
|
||||
"description": "Causes the bookmarks toolbar to be displayed by default.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"DisplayMenuBar": {
|
||||
"description": "Causes the menu bar to be displayed by default.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean",
|
||||
"enum": [true]
|
||||
},
|
||||
|
||||
"DontCheckDefaultBrowser": {
|
||||
"description": "Don't check for the default browser on startup.",
|
||||
"first_available": "60.0",
|
||||
|
||||
|
@ -107,20 +137,20 @@
|
|||
"enum": [true]
|
||||
},
|
||||
|
||||
"flash_plugin": {
|
||||
"FlashPlugin": {
|
||||
"description": "Allow or deny flash plugin usage.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"Allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
},
|
||||
|
||||
"block": {
|
||||
"Block": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
|
@ -129,20 +159,42 @@
|
|||
}
|
||||
},
|
||||
|
||||
"popups": {
|
||||
"description": "Allow or deny popup usage.",
|
||||
"InstallAddons": {
|
||||
"description": "Allow or deny popup websites to install webextensions.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"Allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
},
|
||||
|
||||
"block": {
|
||||
"Block": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"Popups": {
|
||||
"description": "Allow or deny popup usage.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
},
|
||||
|
||||
"Block": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
|
@ -156,50 +208,6 @@
|
|||
"first_available": "60.0",
|
||||
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
"install_addons": {
|
||||
"description": "Allow or deny popup websites to install webextensions.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
},
|
||||
|
||||
"block": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"cookies": {
|
||||
"description": "Allow or deny websites to set cookies.",
|
||||
"first_available": "60.0",
|
||||
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"allow": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
},
|
||||
|
||||
"block": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "origin"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ support-files =
|
|||
[browser_policies_popups_cookies_addons_flash.js]
|
||||
[browser_policies_setAndLockPref_API.js]
|
||||
[browser_policies_simple_policies.js]
|
||||
[browser_policies_sorted_alphabetically.js]
|
||||
[browser_policies_validate_and_parse_API.js]
|
||||
[browser_policy_app_update.js]
|
||||
[browser_policy_block_about_addons.js]
|
||||
|
@ -18,11 +19,11 @@ support-files =
|
|||
[browser_policy_block_about_support.js]
|
||||
[browser_policy_block_set_desktop_background.js]
|
||||
[browser_policy_default_browser_check.js]
|
||||
[browser_policy_disable_formhistory.js]
|
||||
[browser_policy_disable_fxscreenshots.js]
|
||||
[browser_policy_disable_masterpassword.js]
|
||||
[browser_policy_display_bookmarks.js]
|
||||
[browser_policy_disable_formhistory.js]
|
||||
[browser_policy_display_menu.js]
|
||||
[browser_policy_disable_pocket.js]
|
||||
[browser_policy_disable_shield.js]
|
||||
[browser_policy_display_bookmarks.js]
|
||||
[browser_policy_display_menu.js]
|
||||
[browser_policy_remember_passwords.js]
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
function checkArrayIsSorted(array, msg) {
|
||||
let sorted = true;
|
||||
let sortedArray = array.slice().sort();
|
||||
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (array[i] != sortedArray[i]) {
|
||||
sorted = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok(sorted, msg);
|
||||
}
|
||||
|
||||
add_task(async function test_policies_sorted() {
|
||||
let { schema } = ChromeUtils.import("resource:///modules/policies/schema.jsm", {});
|
||||
let { Policies } = ChromeUtils.import("resource:///modules/policies/Policies.jsm", {});
|
||||
|
||||
checkArrayIsSorted(Object.keys(schema.properties), "policies-schema.json is alphabetically sorted.");
|
||||
checkArrayIsSorted(Object.keys(Policies), "Policies.jsm is alphabetically sorted.");
|
||||
});
|
|
@ -5,7 +5,7 @@
|
|||
add_task(async function setup() {
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"block_set_desktop_background": true
|
||||
"BlockSetDesktopBackground": true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ add_task(async function test_default_browser_check() {
|
|||
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"dont_check_default_browser": true
|
||||
"DontCheckDefaultBrowser": true
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const PREF_POCKET = "extensions.pocket.enabled";
|
||||
|
||||
async function checkPocket(shouldBeEnabled) {
|
||||
return BrowserTestUtils.waitForCondition(() => {
|
||||
return !!PageActions.actionForID("pocket") == shouldBeEnabled;
|
||||
}, "Expecting Pocket to be " + shouldBeEnabled);
|
||||
}
|
||||
|
||||
add_task(async function test_disable_firefox_screenshots() {
|
||||
await BrowserTestUtils.withNewTab("data:text/html,Test", async function() {
|
||||
|
||||
// Sanity check to make sure Pocket is enabled on tests
|
||||
await checkPocket(true);
|
||||
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"DisablePocket": true
|
||||
}
|
||||
});
|
||||
|
||||
await checkPocket(false);
|
||||
|
||||
// Clear the change made by the engine to restore Pocket.
|
||||
// This is needed in case this test runs twice in a row
|
||||
// (such as in test-verify), in order for the first sanity check
|
||||
// to pass again.
|
||||
await setupPolicyEngineWithJson("");
|
||||
Services.prefs.unlockPref(PREF_POCKET);
|
||||
Services.prefs.getDefaultBranch("").setBoolPref(PREF_POCKET, true);
|
||||
});
|
||||
});
|
|
@ -6,7 +6,7 @@
|
|||
add_task(async function setup() {
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"display_bookmarks_toolbar": true
|
||||
"DisplayBookmarksToolbar": true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
add_task(async function setup() {
|
||||
await setupPolicyEngineWithJson({
|
||||
"policies": {
|
||||
"display_menu_bar": true
|
||||
"DisplayMenuBar": true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
{
|
||||
"policies": {
|
||||
"popups": {
|
||||
"allow": [
|
||||
"Popups": {
|
||||
"Allow": [
|
||||
"https://www.allow.com",
|
||||
"https://www.pre-existing-deny.com"
|
||||
],
|
||||
|
||||
"block": [
|
||||
"Block": [
|
||||
"https://www.deny.com",
|
||||
"https://www.pre-existing-allow.com"
|
||||
]
|
||||
},
|
||||
|
||||
"cookies": {
|
||||
"allow": [
|
||||
"Cookies": {
|
||||
"Allow": [
|
||||
"https://www.allow.com",
|
||||
"https://www.pre-existing-deny.com"
|
||||
],
|
||||
|
||||
"block": [
|
||||
"Block": [
|
||||
"https://www.deny.com",
|
||||
"https://www.pre-existing-allow.com"
|
||||
]
|
||||
},
|
||||
|
||||
"install_addons": {
|
||||
"allow": [
|
||||
"InstallAddons": {
|
||||
"Allow": [
|
||||
"https://www.allow.com",
|
||||
"https://www.pre-existing-deny.com"
|
||||
],
|
||||
|
||||
"block": [
|
||||
"Block": [
|
||||
"https://www.deny.com",
|
||||
"https://www.pre-existing-allow.com"
|
||||
]
|
||||
},
|
||||
|
||||
"flash_plugin": {
|
||||
"allow": [
|
||||
"FlashPlugin": {
|
||||
"Allow": [
|
||||
"https://www.allow.com",
|
||||
"https://www.pre-existing-deny.com"
|
||||
],
|
||||
|
||||
"block": [
|
||||
"Block": [
|
||||
"https://www.deny.com",
|
||||
"https://www.pre-existing-allow.com"
|
||||
]
|
||||
|
|
|
@ -64,6 +64,10 @@ skip-if = e10s
|
|||
[browser_permissions_urlFieldHidden.js]
|
||||
[browser_proxy_backup.js]
|
||||
[browser_privacypane.js]
|
||||
run-if = nightly_build
|
||||
# browser_privacypane.js only has Browser Error collection tests currently,
|
||||
# which is disabled outside Nightly. Remove this once non-Nightly tests are
|
||||
# added.
|
||||
[browser_privacypane_1.js]
|
||||
[browser_privacypane_3.js]
|
||||
[browser_privacypane_4.js]
|
||||
|
|
|
@ -46,6 +46,13 @@ function logMessage(message) {
|
|||
});
|
||||
}
|
||||
|
||||
// Clears the console of any previous messages. Should be called at the end of
|
||||
// each test that logs to the console.
|
||||
function resetConsole() {
|
||||
Services.console.logStringMessage("");
|
||||
Services.console.reset();
|
||||
}
|
||||
|
||||
// Wrapper similar to logMessage, but for logStringMessage.
|
||||
function logStringMessage(message) {
|
||||
return new Promise(resolve => {
|
||||
|
@ -94,6 +101,7 @@ add_task(async function testInitPrefDisabled() {
|
|||
"Reporter does not listen for errors if the enabled pref is false.",
|
||||
);
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testInitUninitPrefEnabled() {
|
||||
|
@ -119,6 +127,8 @@ add_task(async function testInitUninitPrefEnabled() {
|
|||
!fetchPassedError(fetch, "Logged after uninit"),
|
||||
"Reporter does not listen for errors after uninit.",
|
||||
);
|
||||
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testInitPastMessages() {
|
||||
|
@ -136,6 +146,7 @@ add_task(async function testInitPastMessages() {
|
|||
"Reporter collects errors logged before initialization.",
|
||||
);
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testEnabledPrefWatcher() {
|
||||
|
@ -167,6 +178,7 @@ add_task(async function testEnabledPrefWatcher() {
|
|||
);
|
||||
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testNonErrorLogs() {
|
||||
|
@ -210,6 +222,7 @@ add_task(async function testNonErrorLogs() {
|
|||
);
|
||||
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testSampling() {
|
||||
|
@ -244,6 +257,9 @@ add_task(async function testSampling() {
|
|||
!fetchPassedError(fetch, "Also shouldn't log"),
|
||||
"An invalid sample rate will cause the reporter to never collect errors.",
|
||||
);
|
||||
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testNameMessage() {
|
||||
|
@ -297,6 +313,7 @@ add_task(async function testNameMessage() {
|
|||
"Reporter uses error message as the value parameter.",
|
||||
);
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
||||
add_task(async function testFetchArguments() {
|
||||
|
@ -384,4 +401,7 @@ add_task(async function testFetchArguments() {
|
|||
"Reporter builds stack trace from scriptError correctly.",
|
||||
);
|
||||
});
|
||||
|
||||
reporter.uninit();
|
||||
resetConsole();
|
||||
});
|
||||
|
|
|
@ -169,6 +169,7 @@ skip-if = os == "win"
|
|||
[browser_dbg-search-project.js]
|
||||
[browser_dbg-sourcemaps.js]
|
||||
[browser_dbg-sourcemaps-reload.js]
|
||||
skip-if = os == "win" # Bug 1434792
|
||||
[browser_dbg-sourcemaps-reloading.js]
|
||||
[browser_dbg-sourcemaps2.js]
|
||||
[browser_dbg-sourcemaps3.js]
|
||||
|
|
|
@ -1102,29 +1102,6 @@ nsGlobalWindowInner::~nsGlobalWindowInner()
|
|||
nsLayoutStatics::Release();
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::AddEventTargetObject(DOMEventTargetHelper* aObject)
|
||||
{
|
||||
mEventTargetObjects.PutEntry(aObject);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::RemoveEventTargetObject(DOMEventTargetHelper* aObject)
|
||||
{
|
||||
mEventTargetObjects.RemoveEntry(aObject);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::DisconnectEventTargetObjects()
|
||||
{
|
||||
for (auto iter = mEventTargetObjects.ConstIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
RefPtr<DOMEventTargetHelper> target = iter.Get()->GetKey();
|
||||
target->DisconnectFromOwner();
|
||||
}
|
||||
mEventTargetObjects.Clear();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsGlobalWindowInner::ShutDown()
|
||||
|
@ -6375,34 +6352,23 @@ nsGlobalWindowInner::GetOrCreateServiceWorker(const ServiceWorkerDescriptor& aDe
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<ServiceWorker> ref;
|
||||
for (auto sw : mServiceWorkerList) {
|
||||
if (sw->Descriptor().Matches(aDescriptor)) {
|
||||
ref = sw;
|
||||
return ref.forget();
|
||||
ForEachEventTargetObject([&] (DOMEventTargetHelper* aTarget, bool* aDoneOut) {
|
||||
RefPtr<ServiceWorker> sw = do_QueryObject(aTarget);
|
||||
if (!sw || !sw->Descriptor().Matches(aDescriptor)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ref = sw.forget();
|
||||
*aDoneOut = true;
|
||||
});
|
||||
|
||||
if (!ref) {
|
||||
ref = ServiceWorker::Create(this, aDescriptor);
|
||||
}
|
||||
ref = ServiceWorker::Create(this, aDescriptor);
|
||||
|
||||
return ref.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::AddServiceWorker(ServiceWorker* aServiceWorker)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aServiceWorker);
|
||||
MOZ_ASSERT(!mServiceWorkerList.Contains(aServiceWorker));
|
||||
mServiceWorkerList.AppendElement(aServiceWorker);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::RemoveServiceWorker(ServiceWorker* aServiceWorker)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(aServiceWorker);
|
||||
MOZ_ASSERT(mServiceWorkerList.Contains(aServiceWorker));
|
||||
mServiceWorkerList.RemoveElement(aServiceWorker);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindowInner::FireDelayedDOMEvents()
|
||||
{
|
||||
|
@ -6907,6 +6873,8 @@ void
|
|||
nsGlobalWindowInner::AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
|
||||
{
|
||||
aWindowSizes.mDOMOtherSize += aWindowSizes.mState.mMallocSizeOf(this);
|
||||
aWindowSizes.mDOMOtherSize +=
|
||||
nsIGlobalObject::ShallowSizeOfExcludingThis(aWindowSizes.mState.mMallocSizeOf);
|
||||
|
||||
EventListenerManager* elm = GetExistingListenerManager();
|
||||
if (elm) {
|
||||
|
@ -6929,12 +6897,7 @@ nsGlobalWindowInner::AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
|
|||
mNavigator->SizeOfIncludingThis(aWindowSizes.mState.mMallocSizeOf);
|
||||
}
|
||||
|
||||
aWindowSizes.mDOMEventTargetsSize +=
|
||||
mEventTargetObjects.ShallowSizeOfExcludingThis(
|
||||
aWindowSizes.mState.mMallocSizeOf);
|
||||
|
||||
for (auto iter = mEventTargetObjects.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
DOMEventTargetHelper* et = iter.Get()->GetKey();
|
||||
ForEachEventTargetObject([&] (DOMEventTargetHelper* et, bool* aDoneOut) {
|
||||
if (nsCOMPtr<nsISizeOfEventTarget> iSizeOf = do_QueryObject(et)) {
|
||||
aWindowSizes.mDOMEventTargetsSize +=
|
||||
iSizeOf->SizeOfEventTargetIncludingThis(
|
||||
|
@ -6944,7 +6907,7 @@ nsGlobalWindowInner::AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
|
|||
aWindowSizes.mDOMEventListenersCount += elm->ListenerCount();
|
||||
}
|
||||
++aWindowSizes.mDOMEventTargetsCount;
|
||||
}
|
||||
});
|
||||
|
||||
if (mPerformance) {
|
||||
aWindowSizes.mDOMPerformanceUserEntries =
|
||||
|
@ -7511,10 +7474,10 @@ nsGlobalWindowInner::Orientation(CallerType aCallerType) const
|
|||
#endif
|
||||
|
||||
already_AddRefed<Console>
|
||||
nsGlobalWindowInner::GetConsole(ErrorResult& aRv)
|
||||
nsGlobalWindowInner::GetConsole(JSContext* aCx, ErrorResult& aRv)
|
||||
{
|
||||
if (!mConsole) {
|
||||
mConsole = Console::Create(this, aRv);
|
||||
mConsole = Console::Create(aCx, this, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
|
@ -92,7 +91,6 @@ class DialogValueHolder;
|
|||
|
||||
namespace mozilla {
|
||||
class AbstractThread;
|
||||
class DOMEventTargetHelper;
|
||||
class ThrottledEventQueue;
|
||||
namespace dom {
|
||||
class BarProp;
|
||||
|
@ -353,12 +351,6 @@ public:
|
|||
virtual RefPtr<mozilla::dom::ServiceWorker>
|
||||
GetOrCreateServiceWorker(const mozilla::dom::ServiceWorkerDescriptor& aDescriptor) override;
|
||||
|
||||
virtual void
|
||||
AddServiceWorker(mozilla::dom::ServiceWorker* aServiceWorker) override;
|
||||
|
||||
virtual void
|
||||
RemoveServiceWorker(mozilla::dom::ServiceWorker* aServiceWorker) override;
|
||||
|
||||
void NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope);
|
||||
|
||||
virtual nsresult FireDelayedDOMEvents() override;
|
||||
|
@ -517,10 +509,6 @@ public:
|
|||
|
||||
void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const;
|
||||
|
||||
// Inner windows only.
|
||||
void AddEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
||||
void RemoveEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
||||
|
||||
void NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder,
|
||||
bool aCallOnidle);
|
||||
nsresult HandleIdleActiveEvent();
|
||||
|
@ -691,7 +679,8 @@ public:
|
|||
int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
|
||||
#endif
|
||||
|
||||
already_AddRefed<mozilla::dom::Console> GetConsole(mozilla::ErrorResult& aRv);
|
||||
already_AddRefed<mozilla::dom::Console>
|
||||
GetConsole(JSContext* aCx, mozilla::ErrorResult& aRv);
|
||||
|
||||
// https://w3c.github.io/webappsec-secure-contexts/#dom-window-issecurecontext
|
||||
bool IsSecureContext() const;
|
||||
|
@ -1259,8 +1248,6 @@ private:
|
|||
// Fire the JS engine's onNewGlobalObject hook. Only used on inner windows.
|
||||
void FireOnNewGlobalObject();
|
||||
|
||||
void DisconnectEventTargetObjects();
|
||||
|
||||
// nsPIDOMWindow{Inner,Outer} should be able to see these helper methods.
|
||||
friend class nsPIDOMWindowInner;
|
||||
friend class nsPIDOMWindowOuter;
|
||||
|
@ -1428,8 +1415,6 @@ protected:
|
|||
// currently enabled on this window.
|
||||
bool mAreDialogsEnabled;
|
||||
|
||||
nsTHashtable<nsPtrHashKey<mozilla::DOMEventTargetHelper> > mEventTargetObjects;
|
||||
|
||||
nsTArray<uint32_t> mEnabledSensors;
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
@ -1454,10 +1439,6 @@ protected:
|
|||
|
||||
mozilla::UniquePtr<mozilla::dom::ClientSource> mClientSource;
|
||||
|
||||
// Weak references added by AddServiceWorker() and cleared by
|
||||
// RemoveServiceWorker() when the ServiceWorker is destroyed.
|
||||
nsTArray<mozilla::dom::ServiceWorker*> mServiceWorkerList;
|
||||
|
||||
nsTArray<RefPtr<mozilla::dom::Promise>> mPendingPromises;
|
||||
|
||||
static InnerWindowByIdTable* sInnerWindowsById;
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
|
||||
using mozilla::MallocSizeOf;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::DOMEventTargetHelper;
|
||||
using mozilla::dom::ClientInfo;
|
||||
using mozilla::dom::ServiceWorker;
|
||||
using mozilla::dom::ServiceWorkerDescriptor;
|
||||
|
@ -19,6 +21,8 @@ using mozilla::dom::ServiceWorkerDescriptor;
|
|||
nsIGlobalObject::~nsIGlobalObject()
|
||||
{
|
||||
UnlinkHostObjectURIs();
|
||||
DisconnectEventTargetObjects();
|
||||
MOZ_DIAGNOSTIC_ASSERT(mEventTargetObjects.IsEmpty());
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
|
@ -120,6 +124,55 @@ nsIGlobalObject::TraverseHostObjectURIs(nsCycleCollectionTraversalCallback &aCb)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsIGlobalObject::AddEventTargetObject(DOMEventTargetHelper* aObject)
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(aObject);
|
||||
MOZ_ASSERT(!mEventTargetObjects.Contains(aObject));
|
||||
mEventTargetObjects.PutEntry(aObject);
|
||||
}
|
||||
|
||||
void
|
||||
nsIGlobalObject::RemoveEventTargetObject(DOMEventTargetHelper* aObject)
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(aObject);
|
||||
MOZ_ASSERT(mEventTargetObjects.Contains(aObject));
|
||||
mEventTargetObjects.RemoveEntry(aObject);
|
||||
}
|
||||
|
||||
void
|
||||
nsIGlobalObject::ForEachEventTargetObject(const std::function<void(DOMEventTargetHelper*, bool* aDoneOut)>& aFunc) const
|
||||
{
|
||||
// Protect against the function call triggering a mutation of the hash table
|
||||
// while we are iterating by copying the DETH references to a temporary
|
||||
// list.
|
||||
AutoTArray<DOMEventTargetHelper*, 64> targetList;
|
||||
for (auto iter = mEventTargetObjects.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
targetList.AppendElement(iter.Get()->GetKey());
|
||||
}
|
||||
|
||||
// Iterate the target list and call the function on each one.
|
||||
bool done = false;
|
||||
for (auto target : targetList) {
|
||||
aFunc(target, &done);
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsIGlobalObject::DisconnectEventTargetObjects()
|
||||
{
|
||||
ForEachEventTargetObject([&] (DOMEventTargetHelper* aTarget, bool* aDoneOut) {
|
||||
aTarget->DisconnectFromOwner();
|
||||
|
||||
// Calling DisconnectFromOwner() should result in
|
||||
// RemoveEventTargetObject() being called.
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mEventTargetObjects.Contains(aTarget));
|
||||
});
|
||||
}
|
||||
|
||||
Maybe<ClientInfo>
|
||||
nsIGlobalObject::GetClientInfo() const
|
||||
{
|
||||
|
@ -143,14 +196,10 @@ nsIGlobalObject::GetOrCreateServiceWorker(const ServiceWorkerDescriptor& aDescri
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsIGlobalObject::AddServiceWorker(ServiceWorker* aServiceWorker)
|
||||
size_t
|
||||
nsIGlobalObject::ShallowSizeOfExcludingThis(MallocSizeOf aSizeOf) const
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "this global should not have any service workers");
|
||||
}
|
||||
|
||||
void
|
||||
nsIGlobalObject::RemoveServiceWorker(ServiceWorker* aServiceWorker)
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "this global should not have any service workers");
|
||||
size_t rtn = mHostObjectURIs.ShallowSizeOfExcludingThis(aSizeOf);
|
||||
rtn += mEventTargetObjects.ShallowSizeOfExcludingThis(aSizeOf);
|
||||
return rtn;
|
||||
}
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
#include "mozilla/dom/ClientInfo.h"
|
||||
#include "mozilla/dom/DispatcherTrait.h"
|
||||
#include "mozilla/dom/ServiceWorkerDescriptor.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
// Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
|
||||
|
@ -25,6 +27,7 @@ class nsCycleCollectionTraversalCallback;
|
|||
class nsIPrincipal;
|
||||
|
||||
namespace mozilla {
|
||||
class DOMEventTargetHelper;
|
||||
namespace dom {
|
||||
class ServiceWorker;
|
||||
} // namespace dom
|
||||
|
@ -34,6 +37,13 @@ class nsIGlobalObject : public nsISupports,
|
|||
public mozilla::dom::DispatcherTrait
|
||||
{
|
||||
nsTArray<nsCString> mHostObjectURIs;
|
||||
|
||||
// Raw pointers to bound DETH objects. These are added by
|
||||
// AddEventTargetObject(). The DETH object must call
|
||||
// RemoveEventTargetObject() before its destroyed to clear
|
||||
// its raw pointer here.
|
||||
nsTHashtable<nsPtrHashKey<mozilla::DOMEventTargetHelper>> mEventTargetObjects;
|
||||
|
||||
bool mIsDying;
|
||||
|
||||
protected:
|
||||
|
@ -84,6 +94,18 @@ public:
|
|||
void UnlinkHostObjectURIs();
|
||||
void TraverseHostObjectURIs(nsCycleCollectionTraversalCallback &aCb);
|
||||
|
||||
// DETH objects must register themselves on the global when they
|
||||
// bind to it in order to get the DisconnectFromOwner() method
|
||||
// called correctly. RemoveEventTargetObject() must be called
|
||||
// before the DETH object is destroyed.
|
||||
void AddEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
||||
void RemoveEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
|
||||
|
||||
// Iterate the registered DETH objects and call the given function
|
||||
// for each one.
|
||||
void
|
||||
ForEachEventTargetObject(const std::function<void(mozilla::DOMEventTargetHelper*, bool* aDoneOut)>& aFunc) const;
|
||||
|
||||
virtual bool IsInSyncOperation() { return false; }
|
||||
|
||||
virtual mozilla::Maybe<mozilla::dom::ClientInfo>
|
||||
|
@ -97,16 +119,6 @@ public:
|
|||
virtual RefPtr<mozilla::dom::ServiceWorker>
|
||||
GetOrCreateServiceWorker(const mozilla::dom::ServiceWorkerDescriptor& aDescriptor);
|
||||
|
||||
// These methods allow the ServiceWorker instances to note their existence
|
||||
// so that the global can use weak references to them. The global should
|
||||
// not hold a strong reference to the ServiceWorker.
|
||||
virtual void
|
||||
AddServiceWorker(mozilla::dom::ServiceWorker* aServiceWorker);
|
||||
|
||||
// This method must be called by the ServiceWorker before it is destroyed.
|
||||
virtual void
|
||||
RemoveServiceWorker(mozilla::dom::ServiceWorker* aServiceWorker);
|
||||
|
||||
protected:
|
||||
virtual ~nsIGlobalObject();
|
||||
|
||||
|
@ -115,6 +127,12 @@ protected:
|
|||
{
|
||||
mIsDying = true;
|
||||
}
|
||||
|
||||
void
|
||||
DisconnectEventTargetObjects();
|
||||
|
||||
size_t
|
||||
ShallowSizeOfExcludingThis(mozilla::MallocSizeOf aSizeOf) const;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIGlobalObject,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "ConsoleCommon.h"
|
||||
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/DOMPrefs.h"
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
|
@ -790,11 +791,11 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Console)
|
|||
NS_INTERFACE_MAP_END
|
||||
|
||||
/* static */ already_AddRefed<Console>
|
||||
Console::Create(nsPIDOMWindowInner* aWindow, ErrorResult& aRv)
|
||||
Console::Create(JSContext* aCx, nsPIDOMWindowInner* aWindow, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT_IF(NS_IsMainThread(), aWindow);
|
||||
|
||||
RefPtr<Console> console = new Console(aWindow);
|
||||
RefPtr<Console> console = new Console(aCx, aWindow);
|
||||
console->Initialize(aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
|
@ -803,7 +804,7 @@ Console::Create(nsPIDOMWindowInner* aWindow, ErrorResult& aRv)
|
|||
return console.forget();
|
||||
}
|
||||
|
||||
Console::Console(nsPIDOMWindowInner* aWindow)
|
||||
Console::Console(JSContext* aCx, nsPIDOMWindowInner* aWindow)
|
||||
: mWindow(aWindow)
|
||||
, mOuterID(0)
|
||||
, mInnerID(0)
|
||||
|
@ -825,6 +826,11 @@ Console::Console(nsPIDOMWindowInner* aWindow)
|
|||
}
|
||||
}
|
||||
|
||||
// Let's enable the dumping to stdout by default for chrome.
|
||||
if (nsContentUtils::ThreadsafeIsSystemCaller(aCx)) {
|
||||
mDumpToStdout = DOMPrefs::DumpEnabled();
|
||||
}
|
||||
|
||||
mozilla::HoldJSObjects(this);
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1091,7 @@ Console::ProfileMethodInternal(JSContext* aCx, MethodName aMethodName,
|
|||
return;
|
||||
}
|
||||
|
||||
MaybeExecuteDumpFunction(aCx, aAction, aData);
|
||||
MaybeExecuteDumpFunction(aCx, aAction, aData, nullptr);
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
// Here we are in a worker thread.
|
||||
|
@ -1329,15 +1335,15 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
|||
|
||||
// Before processing this CallData differently, it's time to call the dump
|
||||
// function.
|
||||
if (aMethodName == MethodTrace) {
|
||||
MaybeExecuteDumpFunctionForTrace(aCx, stack);
|
||||
if (aMethodName == MethodTrace || aMethodName == MethodAssert) {
|
||||
MaybeExecuteDumpFunction(aCx, aMethodString, aData, stack);
|
||||
} else if ((aMethodName == MethodTime ||
|
||||
aMethodName == MethodTimeEnd) &&
|
||||
!aData.IsEmpty()) {
|
||||
MaybeExecuteDumpFunctionForTime(aCx, aMethodName, aMethodString,
|
||||
monotonicTimer, aData[0]);
|
||||
} else {
|
||||
MaybeExecuteDumpFunction(aCx, aMethodString, aData);
|
||||
MaybeExecuteDumpFunction(aCx, aMethodString, aData, nullptr);
|
||||
}
|
||||
|
||||
if (NS_IsMainThread()) {
|
||||
|
@ -2420,7 +2426,7 @@ Console::GetConsoleInternal(const GlobalObject& aGlobal, ErrorResult& aRv)
|
|||
nsCOMPtr<WorkletGlobalScope> workletScope =
|
||||
do_QueryInterface(aGlobal.GetAsSupports());
|
||||
if (workletScope) {
|
||||
return workletScope->GetConsole(aRv);
|
||||
return workletScope->GetConsole(aGlobal.Context(), aRv);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2431,7 +2437,7 @@ Console::GetConsoleInternal(const GlobalObject& aGlobal, ErrorResult& aRv)
|
|||
|
||||
// we are probably running a chrome script.
|
||||
if (!innerWindow) {
|
||||
RefPtr<Console> console = new Console(nullptr);
|
||||
RefPtr<Console> console = new Console(aGlobal.Context(), nullptr);
|
||||
console->Initialize(aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
|
@ -2441,7 +2447,7 @@ Console::GetConsoleInternal(const GlobalObject& aGlobal, ErrorResult& aRv)
|
|||
}
|
||||
|
||||
nsGlobalWindowInner* window = nsGlobalWindowInner::Cast(innerWindow);
|
||||
return window->GetConsole(aRv);
|
||||
return window->GetConsole(aGlobal.Context(), aRv);
|
||||
}
|
||||
|
||||
// Workers
|
||||
|
@ -2560,14 +2566,16 @@ Console::MonotonicTimer(JSContext* aCx, MethodName aMethodName,
|
|||
Console::CreateInstance(const GlobalObject& aGlobal,
|
||||
const ConsoleInstanceOptions& aOptions)
|
||||
{
|
||||
RefPtr<ConsoleInstance> console = new ConsoleInstance(aOptions);
|
||||
RefPtr<ConsoleInstance> console =
|
||||
new ConsoleInstance(aGlobal.Context(), aOptions);
|
||||
return console.forget();
|
||||
}
|
||||
|
||||
void
|
||||
Console::MaybeExecuteDumpFunction(JSContext* aCx,
|
||||
const nsAString& aMethodName,
|
||||
const Sequence<JS::Value>& aData)
|
||||
const Sequence<JS::Value>& aData,
|
||||
nsIStackFrame* aStack)
|
||||
{
|
||||
if (!mDumpFunction && !mDumpToStdout) {
|
||||
return;
|
||||
|
@ -2603,6 +2611,36 @@ Console::MaybeExecuteDumpFunction(JSContext* aCx,
|
|||
}
|
||||
|
||||
message.AppendLiteral("\n");
|
||||
|
||||
// aStack can be null.
|
||||
|
||||
nsCOMPtr<nsIStackFrame> stack(aStack);
|
||||
|
||||
while (stack) {
|
||||
nsAutoString filename;
|
||||
stack->GetFilename(aCx, filename);
|
||||
|
||||
message.Append(filename);
|
||||
message.AppendLiteral(" ");
|
||||
|
||||
message.AppendInt(stack->GetLineNumber(aCx));
|
||||
message.AppendLiteral(" ");
|
||||
|
||||
nsAutoString functionName;
|
||||
stack->GetName(aCx, functionName);
|
||||
|
||||
message.Append(functionName);
|
||||
message.AppendLiteral("\n");
|
||||
|
||||
nsCOMPtr<nsIStackFrame> caller = stack->GetCaller(aCx);
|
||||
|
||||
if (!caller) {
|
||||
caller = stack->GetAsyncCaller(aCx);
|
||||
}
|
||||
|
||||
stack.swap(caller);
|
||||
}
|
||||
|
||||
ExecuteDumpFunction(message);
|
||||
}
|
||||
|
||||
|
@ -2646,52 +2684,6 @@ Console::MaybeExecuteDumpFunctionForTime(JSContext* aCx,
|
|||
ExecuteDumpFunction(message);
|
||||
}
|
||||
|
||||
void
|
||||
Console::MaybeExecuteDumpFunctionForTrace(JSContext* aCx, nsIStackFrame* aStack)
|
||||
{
|
||||
if (!aStack || (!mDumpFunction && !mDumpToStdout)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString message;
|
||||
message.AssignLiteral("console.trace:\n");
|
||||
|
||||
if (!mPrefix.IsEmpty()) {
|
||||
message.Append(mPrefix);
|
||||
message.AppendLiteral(": ");
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIStackFrame> stack(aStack);
|
||||
|
||||
while (stack) {
|
||||
nsAutoString filename;
|
||||
stack->GetFilename(aCx, filename);
|
||||
|
||||
message.Append(filename);
|
||||
message.AppendLiteral(" ");
|
||||
|
||||
message.AppendInt(stack->GetLineNumber(aCx));
|
||||
message.AppendLiteral(" ");
|
||||
|
||||
nsAutoString functionName;
|
||||
stack->GetName(aCx, functionName);
|
||||
|
||||
message.Append(filename);
|
||||
message.AppendLiteral("\n");
|
||||
|
||||
nsCOMPtr<nsIStackFrame> caller = stack->GetCaller(aCx);
|
||||
|
||||
if (!caller) {
|
||||
caller = stack->GetAsyncCaller(aCx);
|
||||
}
|
||||
|
||||
stack.swap(caller);
|
||||
}
|
||||
|
||||
message.AppendLiteral("\n");
|
||||
ExecuteDumpFunction(message);
|
||||
}
|
||||
|
||||
void
|
||||
Console::ExecuteDumpFunction(const nsAString& aMessage)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static already_AddRefed<Console>
|
||||
Create(nsPIDOMWindowInner* aWindow, ErrorResult& aRv);
|
||||
Create(JSContext* aCx, nsPIDOMWindowInner* aWindow, ErrorResult& aRv);
|
||||
|
||||
// WebIDL methods
|
||||
nsPIDOMWindowInner* GetParentObject() const
|
||||
|
@ -129,7 +129,7 @@ public:
|
|||
SetConsoleEventHandler(AnyCallback* aHandler);
|
||||
|
||||
private:
|
||||
explicit Console(nsPIDOMWindowInner* aWindow);
|
||||
Console(JSContext* aCx, nsPIDOMWindowInner* aWindow);
|
||||
~Console();
|
||||
|
||||
void
|
||||
|
@ -389,7 +389,8 @@ private:
|
|||
|
||||
void
|
||||
MaybeExecuteDumpFunction(JSContext* aCx, const nsAString& aMethodName,
|
||||
const Sequence<JS::Value>& aData);
|
||||
const Sequence<JS::Value>& aData,
|
||||
nsIStackFrame* aStack);
|
||||
|
||||
void
|
||||
MaybeExecuteDumpFunctionForTime(JSContext* aCx, MethodName aMethodName,
|
||||
|
@ -397,9 +398,6 @@ private:
|
|||
uint64_t aMonotonicTimer,
|
||||
const JS::Value& aData);
|
||||
|
||||
void
|
||||
MaybeExecuteDumpFunctionForTrace(JSContext* aCx, nsIStackFrame* aStack);
|
||||
|
||||
void
|
||||
ExecuteDumpFunction(const nsAString& aMessage);
|
||||
|
||||
|
|
|
@ -67,17 +67,15 @@ WebIDLevelToConsoleUtilsLevel(ConsoleLevel aLevel)
|
|||
|
||||
} // anonymous
|
||||
|
||||
ConsoleInstance::ConsoleInstance(const ConsoleInstanceOptions& aOptions)
|
||||
: mConsole(new Console(nullptr))
|
||||
ConsoleInstance::ConsoleInstance(JSContext* aCx,
|
||||
const ConsoleInstanceOptions& aOptions)
|
||||
: mConsole(new Console(aCx, nullptr))
|
||||
{
|
||||
mConsole->mConsoleID = aOptions.mConsoleID;
|
||||
mConsole->mPassedInnerID = aOptions.mInnerID;
|
||||
|
||||
if (aOptions.mDump.WasPassed()) {
|
||||
mConsole->mDumpFunction = &aOptions.mDump.Value();
|
||||
} else {
|
||||
// For historical reasons, ConsoleInstance prints messages on stdout.
|
||||
mConsole->mDumpToStdout = true;
|
||||
}
|
||||
|
||||
mConsole->mPrefix = aOptions.mPrefix;
|
||||
|
|
|
@ -20,7 +20,8 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ConsoleInstance)
|
||||
|
||||
explicit ConsoleInstance(const ConsoleInstanceOptions& aOptions);
|
||||
explicit ConsoleInstance(JSContext* aCx,
|
||||
const ConsoleInstanceOptions& aOptions);
|
||||
|
||||
// WebIDL methods
|
||||
JSObject*
|
||||
|
|
|
@ -89,8 +89,8 @@ NS_IMPL_DOMTARGET_DEFAULTS(DOMEventTargetHelper)
|
|||
|
||||
DOMEventTargetHelper::~DOMEventTargetHelper()
|
||||
{
|
||||
if (nsPIDOMWindowInner* owner = GetOwner()) {
|
||||
nsGlobalWindowInner::Cast(owner)->RemoveEventTargetObject(this);
|
||||
if (mParentObject) {
|
||||
mParentObject->RemoveEventTargetObject(this);
|
||||
}
|
||||
if (mListenerManager) {
|
||||
mListenerManager->Disconnect();
|
||||
|
@ -108,23 +108,21 @@ DOMEventTargetHelper::BindToOwner(nsPIDOMWindowInner* aOwner)
|
|||
void
|
||||
DOMEventTargetHelper::BindToOwner(nsIGlobalObject* aOwner)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);
|
||||
if (parentObject) {
|
||||
if (mParentObject) {
|
||||
mParentObject->RemoveEventTargetObject(this);
|
||||
if (mOwnerWindow) {
|
||||
nsGlobalWindowInner::Cast(mOwnerWindow)->RemoveEventTargetObject(this);
|
||||
mOwnerWindow = nullptr;
|
||||
}
|
||||
mParentObject = nullptr;
|
||||
mHasOrHasHadOwnerWindow = false;
|
||||
}
|
||||
if (aOwner) {
|
||||
mParentObject = do_GetWeakReference(aOwner);
|
||||
MOZ_ASSERT(mParentObject, "All nsIGlobalObjects must support nsISupportsWeakReference");
|
||||
mParentObject = aOwner;
|
||||
aOwner->AddEventTargetObject(this);
|
||||
// Let's cache the result of this QI for fast access and off main thread usage
|
||||
mOwnerWindow = nsCOMPtr<nsPIDOMWindowInner>(do_QueryInterface(aOwner)).get();
|
||||
if (mOwnerWindow) {
|
||||
mHasOrHasHadOwnerWindow = true;
|
||||
nsGlobalWindowInner::Cast(mOwnerWindow)->AddEventTargetObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,30 +130,20 @@ DOMEventTargetHelper::BindToOwner(nsIGlobalObject* aOwner)
|
|||
void
|
||||
DOMEventTargetHelper::BindToOwner(DOMEventTargetHelper* aOther)
|
||||
{
|
||||
if (mOwnerWindow) {
|
||||
nsGlobalWindowInner::Cast(mOwnerWindow)->RemoveEventTargetObject(this);
|
||||
mOwnerWindow = nullptr;
|
||||
mParentObject = nullptr;
|
||||
mHasOrHasHadOwnerWindow = false;
|
||||
}
|
||||
if (aOther) {
|
||||
mHasOrHasHadOwnerWindow = aOther->HasOrHasHadOwner();
|
||||
if (aOther->GetParentObject()) {
|
||||
mParentObject = do_GetWeakReference(aOther->GetParentObject());
|
||||
MOZ_ASSERT(mParentObject, "All nsIGlobalObjects must support nsISupportsWeakReference");
|
||||
// Let's cache the result of this QI for fast access and off main thread usage
|
||||
mOwnerWindow = nsCOMPtr<nsPIDOMWindowInner>(do_QueryInterface(aOther->GetParentObject())).get();
|
||||
if (mOwnerWindow) {
|
||||
mHasOrHasHadOwnerWindow = true;
|
||||
nsGlobalWindowInner::Cast(mOwnerWindow)->AddEventTargetObject(this);
|
||||
}
|
||||
}
|
||||
if (!aOther) {
|
||||
BindToOwner(static_cast<nsIGlobalObject*>(nullptr));
|
||||
return;
|
||||
}
|
||||
BindToOwner(aOther->GetParentObject());
|
||||
mHasOrHasHadOwnerWindow = aOther->HasOrHasHadOwner();
|
||||
}
|
||||
|
||||
void
|
||||
DOMEventTargetHelper::DisconnectFromOwner()
|
||||
{
|
||||
if (mParentObject) {
|
||||
mParentObject->RemoveEventTargetObject(this);
|
||||
}
|
||||
mOwnerWindow = nullptr;
|
||||
mParentObject = nullptr;
|
||||
// Event listeners can't be handled anymore, so we can release them here.
|
||||
|
|
|
@ -146,8 +146,7 @@ public:
|
|||
using EventTarget::GetParentObject;
|
||||
virtual nsIGlobalObject* GetOwnerGlobal() const override
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);
|
||||
return parentObject;
|
||||
return mParentObject;
|
||||
}
|
||||
bool HasOrHasHadOwner() { return mHasOrHasHadOwnerWindow; }
|
||||
|
||||
|
@ -195,8 +194,9 @@ protected:
|
|||
void IgnoreKeepAliveIfHasListenersFor(nsAtom* aType);
|
||||
|
||||
private:
|
||||
// Inner window or sandbox.
|
||||
nsWeakPtr mParentObject;
|
||||
// The parent global object. The global will clear this when
|
||||
// it is destroyed by calling DisconnectFromOwner().
|
||||
nsIGlobalObject* MOZ_NON_OWNING_REF mParentObject;
|
||||
// mParentObject pre QI-ed and cached (inner window)
|
||||
// (it is needed for off main thread access)
|
||||
// It is obtained in BindToOwner and reset in DisconnectFromOwner.
|
||||
|
|
|
@ -205,7 +205,7 @@ KeyboardEvent::KeyCode(CallerType aCallerType)
|
|||
}
|
||||
|
||||
uint32_t
|
||||
KeyboardEvent::Which()
|
||||
KeyboardEvent::Which(CallerType aCallerType)
|
||||
{
|
||||
// If this event is initialized with ctor, which can have independent value.
|
||||
if (mInitializedByCtor) {
|
||||
|
@ -217,7 +217,7 @@ KeyboardEvent::Which()
|
|||
case eKeyDownOnPlugin:
|
||||
case eKeyUp:
|
||||
case eKeyUpOnPlugin:
|
||||
return KeyCode();
|
||||
return KeyCode(aCallerType);
|
||||
case eKeyPress:
|
||||
//Special case for 4xp bug 62878. Try to make value of which
|
||||
//more closely mirror the values that 4.x gave for RETURN and BACKSPACE
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
void GetKey(nsAString& aKey) const;
|
||||
uint32_t CharCode();
|
||||
uint32_t KeyCode(CallerType aCallerType = CallerType::System);
|
||||
virtual uint32_t Which() override;
|
||||
virtual uint32_t Which(CallerType aCallerType = CallerType::System) override;
|
||||
uint32_t Location();
|
||||
|
||||
void GetCode(nsAString& aCode, CallerType aCallerType = CallerType::System);
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
}
|
||||
|
||||
// Web IDL binding methods
|
||||
virtual uint32_t Which() override
|
||||
virtual uint32_t Which(CallerType aCallerType) override
|
||||
{
|
||||
return Button() + 1;
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
int32_t PageX() const;
|
||||
int32_t PageY() const;
|
||||
|
||||
virtual uint32_t Which()
|
||||
virtual uint32_t Which(CallerType aCallerType = CallerType::System)
|
||||
{
|
||||
MOZ_ASSERT(mEvent->mClass != eKeyboardEventClass,
|
||||
"Key events should override Which()");
|
||||
|
|
|
@ -76,8 +76,6 @@ ServiceWorker::ServiceWorker(nsIGlobalObject* aGlobal,
|
|||
MOZ_DIAGNOSTIC_ASSERT(aGlobal);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mInner);
|
||||
|
||||
aGlobal->AddServiceWorker(this);
|
||||
|
||||
// This will update our state too.
|
||||
mInner->AddServiceWorker(this);
|
||||
}
|
||||
|
@ -86,16 +84,13 @@ ServiceWorker::~ServiceWorker()
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mInner->RemoveServiceWorker(this);
|
||||
nsIGlobalObject* global = GetParentObject();
|
||||
if (global) {
|
||||
global->RemoveServiceWorker(this);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(ServiceWorker, DOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(ServiceWorker, DOMEventTargetHelper)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorker)
|
||||
NS_INTERFACE_MAP_ENTRY(ServiceWorker)
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
||||
|
||||
JSObject*
|
||||
|
@ -151,10 +146,6 @@ ServiceWorker::Descriptor() const
|
|||
void
|
||||
ServiceWorker::DisconnectFromOwner()
|
||||
{
|
||||
nsIGlobalObject* global = GetParentObject();
|
||||
if (global) {
|
||||
global->RemoveServiceWorker(this);
|
||||
}
|
||||
DOMEventTargetHelper::DisconnectFromOwner();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ class nsIGlobalObject;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
#define NS_DOM_SERVICEWORKER_IID \
|
||||
{0xd42e0611, 0x3647, 0x4319, {0xae, 0x05, 0x19, 0x89, 0x59, 0xba, 0x99, 0x5e}}
|
||||
|
||||
bool
|
||||
ServiceWorkerVisible(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
|
@ -59,6 +62,7 @@ public:
|
|||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
};
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOM_SERVICEWORKER_IID)
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
IMPL_EVENT_HANDLER(statechange)
|
||||
|
@ -101,6 +105,8 @@ private:
|
|||
const RefPtr<Inner> mInner;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(ServiceWorker, NS_DOM_SERVICEWORKER_IID)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ partial interface UIEvent {
|
|||
readonly attribute long layerY;
|
||||
readonly attribute long pageX;
|
||||
readonly attribute long pageY;
|
||||
[NeedsCallerType]
|
||||
readonly attribute unsigned long which;
|
||||
readonly attribute Node? rangeParent;
|
||||
readonly attribute long rangeOffset;
|
||||
|
|
|
@ -144,7 +144,8 @@ WorkerGlobalScope::GetConsole(ErrorResult& aRv)
|
|||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
if (!mConsole) {
|
||||
mConsole = Console::Create(nullptr, aRv);
|
||||
mConsole = Console::Create(mWorkerPrivate->GetJSContext(),
|
||||
nullptr, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1077,7 +1078,8 @@ WorkerDebuggerGlobalScope::GetConsole(ErrorResult& aRv)
|
|||
|
||||
// Debugger console has its own console object.
|
||||
if (!mConsole) {
|
||||
mConsole = Console::Create(nullptr, aRv);
|
||||
mConsole = Console::Create(mWorkerPrivate->GetJSContext(),
|
||||
nullptr, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -55,10 +55,10 @@ WorkletGlobalScope::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto
|
|||
}
|
||||
|
||||
already_AddRefed<Console>
|
||||
WorkletGlobalScope::GetConsole(ErrorResult& aRv)
|
||||
WorkletGlobalScope::GetConsole(JSContext* aCx, ErrorResult& aRv)
|
||||
{
|
||||
if (!mConsole) {
|
||||
mConsole = Console::Create(mWindow, aRv);
|
||||
mConsole = Console::Create(aCx, mWindow, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
}
|
||||
|
||||
already_AddRefed<Console>
|
||||
GetConsole(ErrorResult& aRv);
|
||||
GetConsole(JSContext* aCx, ErrorResult& aRv);
|
||||
|
||||
void
|
||||
Dump(const Optional<nsAString>& aString) const;
|
||||
|
|
|
@ -1146,7 +1146,7 @@ nsXBLPrototypeHandler::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
|||
if (!(mType & NS_HANDLER_TYPE_XUL)) {
|
||||
n += aMallocSizeOf(handler->mHandlerText);
|
||||
}
|
||||
n += mHandler ? aMallocSizeOf(handler->mHandler) : 0;
|
||||
n += aMallocSizeOf(handler->mHandler);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EditorBase)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEditorObservers)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocStateListeners)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventListener)
|
||||
|
||||
if (tmp->mEventListener) {
|
||||
tmp->mEventListener->Disconnect();
|
||||
tmp->mEventListener = nullptr;
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPlaceholderTransaction)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSavedSel);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRangeUpdater);
|
||||
|
@ -330,9 +335,7 @@ EditorBase::PostCreate()
|
|||
// If the text control gets reframed during focus, Focus() would not be
|
||||
// called, so take a chance here to see if we need to spell check the text
|
||||
// control.
|
||||
EditorEventListener* listener =
|
||||
reinterpret_cast<EditorEventListener*>(mEventListener.get());
|
||||
listener->SpellCheckIfNeeded();
|
||||
mEventListener->SpellCheckIfNeeded();
|
||||
|
||||
IMEState newState;
|
||||
rv = GetPreferredIMEState(&newState);
|
||||
|
@ -386,9 +389,7 @@ EditorBase::InstallEventListeners()
|
|||
mEventTarget = do_QueryInterface(rootContent->GetParent());
|
||||
NS_ENSURE_TRUE(mEventTarget, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
EditorEventListener* listener =
|
||||
reinterpret_cast<EditorEventListener*>(mEventListener.get());
|
||||
nsresult rv = listener->Connect(this);
|
||||
nsresult rv = mEventListener->Connect(this);
|
||||
if (mComposition) {
|
||||
// Restart to handle composition with new editor contents.
|
||||
mComposition->StartHandlingComposition(this);
|
||||
|
@ -402,7 +403,7 @@ EditorBase::RemoveEventListeners()
|
|||
if (!IsInitialized() || !mEventListener) {
|
||||
return;
|
||||
}
|
||||
reinterpret_cast<EditorEventListener*>(mEventListener.get())->Disconnect();
|
||||
mEventListener->Disconnect();
|
||||
if (mComposition) {
|
||||
// Even if this is called, don't release mComposition because this is
|
||||
// may be reused after reframing.
|
||||
|
|
|
@ -40,7 +40,6 @@ class nsAtom;
|
|||
class nsIContent;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMEvent;
|
||||
class nsIDOMEventListener;
|
||||
class nsIDOMEventTarget;
|
||||
class nsIDOMNode;
|
||||
class nsIDocumentStateListener;
|
||||
|
@ -65,6 +64,7 @@ class CreateElementTransaction;
|
|||
class DeleteNodeTransaction;
|
||||
class DeleteTextTransaction;
|
||||
class EditAggregateTransaction;
|
||||
class EditorEventListener;
|
||||
class EditTransactionBase;
|
||||
class ErrorResult;
|
||||
class HTMLEditor;
|
||||
|
@ -1503,7 +1503,7 @@ protected:
|
|||
nsCOMPtr<Element> mRootElement;
|
||||
// The form field as an event receiver.
|
||||
nsCOMPtr<dom::EventTarget> mEventTarget;
|
||||
nsCOMPtr<nsIDOMEventListener> mEventListener;
|
||||
RefPtr<EditorEventListener> mEventListener;
|
||||
// Strong reference to placeholder for begin/end batch purposes.
|
||||
RefPtr<PlaceholderTransaction> mPlaceholderTransaction;
|
||||
// Name of placeholder transaction.
|
||||
|
|
|
@ -1385,7 +1385,7 @@ static RefPtr<Node> DepthFirstSearchPostOrderForwardRecursive(RefPtr<Node> aNode
|
|||
template <typename Node>
|
||||
static RefPtr<Node> BreadthFirstSearchForwardQueue(RefPtr<Node> aNode)
|
||||
{
|
||||
queue<RefPtr<Node>> nodes;
|
||||
std::queue<RefPtr<Node>> nodes;
|
||||
nodes.push(aNode);
|
||||
while(!nodes.empty()) {
|
||||
RefPtr<Node> node = nodes.front();
|
||||
|
@ -1464,7 +1464,7 @@ static RefPtr<Node> DepthFirstSearchPostOrderReverseRecursive(RefPtr<Node> aNode
|
|||
template <typename Node>
|
||||
static RefPtr<Node> BreadthFirstSearchReverseQueue(RefPtr<Node> aNode)
|
||||
{
|
||||
queue<RefPtr<Node>> nodes;
|
||||
std::queue<RefPtr<Node>> nodes;
|
||||
nodes.push(aNode);
|
||||
while(!nodes.empty()) {
|
||||
RefPtr<Node> node = nodes.front();
|
||||
|
|
|
@ -4,7 +4,7 @@ header = """/* This Source Code Form is subject to the terms of the Mozilla Publ
|
|||
autogen_warning = """/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
|
||||
*/"""
|
||||
include_version = true
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
|
||||
*/
|
||||
|
||||
|
@ -933,7 +933,7 @@ extern "C" {
|
|||
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
|
||||
*/
|
||||
|
||||
|
@ -1662,6 +1662,6 @@ WR_FUNC;
|
|||
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||
* To generate this file:
|
||||
* 1. Get the latest cbindgen using `cargo install --force cbindgen`
|
||||
* a. Alternatively, you can clone `https://github.com/rlhunt/cbindgen` and use a tagged release
|
||||
* a. Alternatively, you can clone `https://github.com/eqrion/cbindgen` and use a tagged release
|
||||
* 2. Run `rustup run nightly cbindgen toolkit/library/rust/ --crate webrender_bindings -o gfx/webrender_bindings/webrender_ffi_generated.h`
|
||||
*/
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <algorithm> // find_if()
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
* 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/. */
|
||||
|
||||
/*
|
||||
* This section typedefs the old 'native' types to the new <stdint.h> types.
|
||||
* These redefinitions are provided solely to allow JSAPI users to more easily
|
||||
* transition to <stdint.h> types. They are not to be used in the JSAPI, and
|
||||
* new JSAPI user code should not use them. This mapping file may eventually
|
||||
* be removed from SpiderMonkey, so don't depend on it in the long run.
|
||||
*/
|
||||
|
||||
/*
|
||||
* BEWARE: Comity with other implementers of these types is not guaranteed.
|
||||
* Indeed, if you use this header and third-party code defining these
|
||||
* types, *expect* to encounter either compile errors or link errors,
|
||||
* depending how these types are used and on the order of inclusion.
|
||||
* It is safest to use only the <stdint.h> types.
|
||||
*/
|
||||
#ifndef js_LegacyIntTypes_h
|
||||
#define js_LegacyIntTypes_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "js-config.h"
|
||||
|
||||
typedef uint8_t uint8;
|
||||
typedef uint16_t uint16;
|
||||
typedef uint32_t uint32;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
/*
|
||||
* On AIX 4.3, sys/inttypes.h (which is included by sys/types.h, a very
|
||||
* common header file) defines the types int8, int16, int32, and int64.
|
||||
* So we don't define these four types here to avoid conflicts in case
|
||||
* the code also includes sys/types.h.
|
||||
*/
|
||||
#if defined(AIX) && defined(HAVE_SYS_INTTYPES_H)
|
||||
#include <sys/inttypes.h>
|
||||
#else
|
||||
typedef int8_t int8;
|
||||
typedef int16_t int16;
|
||||
typedef int32_t int32;
|
||||
typedef int64_t int64;
|
||||
#endif /* AIX && HAVE_SYS_INTTYPES_H */
|
||||
|
||||
typedef uint8_t JSUint8;
|
||||
typedef uint16_t JSUint16;
|
||||
typedef uint32_t JSUint32;
|
||||
typedef uint64_t JSUint64;
|
||||
|
||||
typedef int8_t JSInt8;
|
||||
typedef int16_t JSInt16;
|
||||
typedef int32_t JSInt32;
|
||||
typedef int64_t JSInt64;
|
||||
|
||||
#endif /* js_LegacyIntTypes_h */
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "mozilla/Alignment.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#define gc_RelocationOverlay_h
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "jit/Lowering.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#include "jit/JitSpewer.h"
|
||||
#include "jit/LIR.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "jit/MIR.h"
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef jit_MacroAssembler_h
|
||||
#define jit_MacroAssembler_h
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "jit/mips-shared/MacroAssembler-mips-shared.h"
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#include "jit/MacroAssembler.h"
|
||||
|
||||
using namespace js;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef jit_mips32_Architecture_mips32_h
|
||||
#define jit_mips32_Architecture_mips32_h
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "jit/mips32/MacroAssembler-mips32.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
|
||||
#include "jit/Bailouts.h"
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#ifndef jit_mips32_MacroAssembler_mips32_h
|
||||
#define jit_mips32_MacroAssembler_mips32_h
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#include "jit/JitFrames.h"
|
||||
#include "jit/mips-shared/MacroAssembler-mips-shared.h"
|
||||
#include "jit/MoveResolver.h"
|
||||
|
|
|
@ -61,7 +61,6 @@ UNIFIED_SOURCES += [
|
|||
'testIntern.cpp',
|
||||
'testIntlAvailableLocales.cpp',
|
||||
'testIntString.cpp',
|
||||
'testIntTypesABI.cpp',
|
||||
'testIsInsideNursery.cpp',
|
||||
'testIteratorObject.cpp',
|
||||
'testJSEvaluateScript.cpp',
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
/* 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/. */
|
||||
|
||||
/*
|
||||
* This test exercises the full, deliberately-exposed JSAPI interface to ensure
|
||||
* that no internal integer typedefs leak out. Include every intentionally
|
||||
* public header file (and those headers included by them, for completeness),
|
||||
* even the ones tests.h itself included, to verify this.
|
||||
*/
|
||||
|
||||
#include "jscpucfg.h"
|
||||
#include "jspubtd.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
#include "js/CallArgs.h"
|
||||
#include "js/CallNonGenericMethod.h"
|
||||
#include "js/CharacterEncoding.h"
|
||||
#include "js/Class.h"
|
||||
#include "js/Date.h"
|
||||
#include "js/Debug.h"
|
||||
#include "js/HashTable.h"
|
||||
#include "js/HeapAPI.h"
|
||||
#include "js/Id.h"
|
||||
/* LegacyIntTypes.h is deliberately exempted from this requirement */
|
||||
#include "js/MemoryMetrics.h"
|
||||
#include "js/ProfilingStack.h"
|
||||
#include "js/RefCounted.h"
|
||||
#include "js/RequiredDefines.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/SliceBudget.h"
|
||||
#include "js/Stream.h"
|
||||
#include "js/StructuredClone.h"
|
||||
#include "js/TracingAPI.h"
|
||||
#include "js/TrackedOptimizationInfo.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "js/UbiNode.h"
|
||||
#include "js/Utility.h"
|
||||
#include "js/Value.h"
|
||||
#include "js/Vector.h"
|
||||
#include "js/WeakMapPtr.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
|
||||
/*
|
||||
* Verify that our public (and intended to be public, versus being that way
|
||||
* because we haven't made them private yet) headers don't define
|
||||
* {u,}int{8,16,32,64} or JS{Ui,I}nt{8,16,32,64} types. If any do, they will
|
||||
* assuredly conflict with a corresponding typedef below mapping to a *struct*.
|
||||
*
|
||||
* Note that tests.h includes a few internal headers; in order that this
|
||||
* jsapi-test be writable, those internal headers must not import the legacy
|
||||
* typedefs.
|
||||
*/
|
||||
|
||||
struct ConflictingType {
|
||||
uint64_t u64;
|
||||
};
|
||||
|
||||
typedef ConflictingType uint8;
|
||||
typedef ConflictingType uint16;
|
||||
typedef ConflictingType uint32;
|
||||
typedef ConflictingType uint64;
|
||||
|
||||
typedef ConflictingType int8;
|
||||
typedef ConflictingType int16;
|
||||
typedef ConflictingType int32;
|
||||
typedef ConflictingType int64;
|
||||
|
||||
typedef ConflictingType JSUint8;
|
||||
typedef ConflictingType JSUint16;
|
||||
typedef ConflictingType JSUint32;
|
||||
typedef ConflictingType JSUint64;
|
||||
|
||||
typedef ConflictingType JSInt8;
|
||||
typedef ConflictingType JSInt16;
|
||||
typedef ConflictingType JSInt32;
|
||||
typedef ConflictingType JSInt64;
|
||||
|
||||
typedef ConflictingType jsword;
|
||||
typedef ConflictingType jsuword;
|
||||
typedef ConflictingType JSWord;
|
||||
typedef ConflictingType JSUword;
|
||||
|
||||
BEGIN_TEST(testIntTypesABI)
|
||||
{
|
||||
/* This passes if the typedefs didn't conflict at compile time. */
|
||||
return true;
|
||||
}
|
||||
END_TEST(testIntTypesABI)
|
|
@ -1,20 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
* 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/. */
|
||||
|
||||
#ifndef jscpucfg_h
|
||||
#define jscpucfg_h
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#ifndef JS_STACK_GROWTH_DIRECTION
|
||||
# ifdef __hppa
|
||||
# define JS_STACK_GROWTH_DIRECTION (1)
|
||||
# else
|
||||
# define JS_STACK_GROWTH_DIRECTION (-1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* jscpucfg_h */
|
|
@ -23,6 +23,14 @@
|
|||
#include "js/HeapAPI.h"
|
||||
#include "js/Utility.h"
|
||||
|
||||
#ifndef JS_STACK_GROWTH_DIRECTION
|
||||
# ifdef __hppa
|
||||
# define JS_STACK_GROWTH_DIRECTION (1)
|
||||
# else
|
||||
# define JS_STACK_GROWTH_DIRECTION (-1)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if JS_STACK_GROWTH_DIRECTION > 0
|
||||
# define JS_CHECK_STACK_SIZE(limit, sp) (MOZ_LIKELY((uintptr_t)(sp) < (limit)))
|
||||
#else
|
||||
|
|
|
@ -48,18 +48,6 @@ FinishRuntimeNumberState(JSRuntime* rt);
|
|||
extern JSObject*
|
||||
InitNumberClass(JSContext* cx, HandleObject obj);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
/*
|
||||
* String constants for global function names, used in jsapi.c and jsnum.c.
|
||||
*/
|
||||
extern const char js_isNaN_str[];
|
||||
extern const char js_isFinite_str[];
|
||||
extern const char js_parseFloat_str[];
|
||||
extern const char js_parseInt_str[];
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* When base == 10, this function implements ToString() as specified by
|
||||
* ECMA-262-5 section 9.8.1; but note that it handles integers specially for
|
||||
|
|
|
@ -138,8 +138,6 @@
|
|||
#define JS_HOWMANY(x,y) (((x)+(y)-1)/(y))
|
||||
#define JS_ROUNDUP(x,y) (JS_HOWMANY(x,y)*(y))
|
||||
|
||||
#include "jscpucfg.h"
|
||||
|
||||
/*
|
||||
* Define JS_64BIT iff we are building in an environment with 64-bit
|
||||
* addresses.
|
||||
|
|
|
@ -89,7 +89,6 @@ EXPORTS += [
|
|||
'jsalloc.h',
|
||||
'jsapi.h',
|
||||
'jsbytecode.h',
|
||||
'jscpucfg.h',
|
||||
'jsfriendapi.h',
|
||||
'jsprf.h',
|
||||
'jsprototypes.h',
|
||||
|
@ -100,9 +99,6 @@ EXPORTS += [
|
|||
'perf/jsperf.h',
|
||||
]
|
||||
|
||||
# If you add a header here, add it to js/src/jsapi-tests/testIntTypesABI.cpp so
|
||||
# that we ensure we don't over-expose our internal integer typedefs. Note that
|
||||
# LegacyIntTypes.h below is deliberately exempted from this requirement.
|
||||
EXPORTS.js += [
|
||||
'../public/CallArgs.h',
|
||||
'../public/CallNonGenericMethod.h',
|
||||
|
@ -121,7 +117,6 @@ EXPORTS.js += [
|
|||
'../public/HeapAPI.h',
|
||||
'../public/Id.h',
|
||||
'../public/Initialization.h',
|
||||
'../public/LegacyIntTypes.h',
|
||||
'../public/MemoryMetrics.h',
|
||||
'../public/Principals.h',
|
||||
'../public/ProfilingFrameIterator.h',
|
||||
|
|
|
@ -9122,7 +9122,7 @@ main(int argc, char** argv, char** envp)
|
|||
|| !op.addBoolOption('\0', "non-writable-jitcode", "(NOP for fuzzers) Allocate JIT code as non-writable memory.")
|
||||
|| !op.addBoolOption('\0', "no-sse3", "Pretend CPU does not support SSE3 instructions and above "
|
||||
"to test JIT codegen (no-op on platforms other than x86 and x64).")
|
||||
|| !op.addBoolOption('\0', "no-sse4", "Pretend CPU does not support SSE4 instructions"
|
||||
|| !op.addBoolOption('\0', "no-sse4", "Pretend CPU does not support SSE4 instructions "
|
||||
"to test JIT codegen (no-op on platforms other than x86 and x64).")
|
||||
|| !op.addBoolOption('\0', "enable-avx", "AVX is disabled by default. Enable AVX. "
|
||||
"(no-op on platforms other than x86 and x64).")
|
||||
|
@ -9139,6 +9139,7 @@ main(int argc, char** argv, char** envp)
|
|||
|| !op.addBoolOption('\0', "no-ggc", "Disable Generational GC")
|
||||
|| !op.addBoolOption('\0', "no-cgc", "Disable Compacting GC")
|
||||
|| !op.addBoolOption('\0', "no-incremental-gc", "Disable Incremental GC")
|
||||
|| !op.addBoolOption('\0', "nursery-strings", "Allocate strings in the nursery")
|
||||
|| !op.addIntOption('\0', "available-memory", "SIZE",
|
||||
"Select GC settings based on available memory (MB)", 0)
|
||||
|| !op.addStringOption('\0', "arm-hwcap", "[features]",
|
||||
|
@ -9286,6 +9287,9 @@ main(int argc, char** argv, char** envp)
|
|||
|
||||
js::UseInternalJobQueues(cx);
|
||||
|
||||
if (op.getBoolOption("nursery-strings"))
|
||||
cx->runtime()->gc.nursery().enableStrings();
|
||||
|
||||
if (!JS::InitSelfHostedCode(cx))
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "util/DoubleToString.h"
|
||||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
#include "jsprf.h"
|
||||
#include "jstypes.h"
|
||||
#include "jsutil.h"
|
||||
|
|
|
@ -8,24 +8,21 @@
|
|||
|
||||
#ifdef XP_WIN
|
||||
# include "util/Windows.h"
|
||||
|
||||
#elif defined(XP_DARWIN) || defined(DARWIN) || defined(XP_UNIX)
|
||||
# include <pthread.h>
|
||||
|
||||
# if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
# include <pthread_np.h>
|
||||
# endif
|
||||
|
||||
# if defined(ANDROID) && !defined(__aarch64__)
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
|
||||
#else
|
||||
# error "Unsupported platform"
|
||||
|
||||
#endif
|
||||
|
||||
#include "jsfriendapi.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
||||
void*
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
#include "jscpucfg.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsnum.h"
|
||||
#include "jstypes.h"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "vm/JSAtom-inl.h"
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/RangedPtr.h"
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ JSRope::new_(JSContext* cx,
|
|||
{
|
||||
if (!validateLength(cx, length))
|
||||
return nullptr;
|
||||
JSRope* str = js::Allocate<JSRope, allowGC>(cx, js::gc::TenuredHeap);
|
||||
JSRope* str = js::Allocate<JSRope, allowGC>(cx, js::gc::DefaultHeap);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
str->init(cx, left, right, length);
|
||||
|
@ -182,7 +182,7 @@ JSDependentString::new_(JSContext* cx, JSLinearString* baseArg, size_t start,
|
|||
if (baseArg->isExternal() && !baseArg->ensureFlat(cx))
|
||||
return nullptr;
|
||||
|
||||
JSDependentString* str = js::Allocate<JSDependentString, js::NoGC>(cx, js::gc::TenuredHeap);
|
||||
JSDependentString* str = js::Allocate<JSDependentString, js::NoGC>(cx, js::gc::DefaultHeap);
|
||||
if (str) {
|
||||
str->init(cx, baseArg, start, length);
|
||||
return str;
|
||||
|
@ -190,7 +190,7 @@ JSDependentString::new_(JSContext* cx, JSLinearString* baseArg, size_t start,
|
|||
|
||||
js::RootedLinearString base(cx, baseArg);
|
||||
|
||||
str = js::Allocate<JSDependentString>(cx, js::gc::TenuredHeap);
|
||||
str = js::Allocate<JSDependentString>(cx, js::gc::DefaultHeap);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
str->init(cx, base, start, length);
|
||||
|
@ -226,7 +226,7 @@ JSFlatString::new_(JSContext* cx, const CharT* chars, size_t length)
|
|||
if (cx->compartment()->isAtomsCompartment())
|
||||
str = js::Allocate<js::NormalAtom, allowGC>(cx);
|
||||
else
|
||||
str = js::Allocate<JSFlatString, allowGC>(cx, js::gc::TenuredHeap);
|
||||
str = js::Allocate<JSFlatString, allowGC>(cx, js::gc::DefaultHeap);
|
||||
if (!str)
|
||||
return nullptr;
|
||||
|
||||
|
@ -270,7 +270,7 @@ JSThinInlineString::new_(JSContext* cx)
|
|||
if (cx->compartment()->isAtomsCompartment())
|
||||
return (JSThinInlineString*)(js::Allocate<js::NormalAtom, allowGC>(cx));
|
||||
|
||||
return js::Allocate<JSThinInlineString, allowGC>(cx, js::gc::TenuredHeap);
|
||||
return js::Allocate<JSThinInlineString, allowGC>(cx, js::gc::DefaultHeap);
|
||||
}
|
||||
|
||||
template <js::AllowGC allowGC>
|
||||
|
@ -280,7 +280,7 @@ JSFatInlineString::new_(JSContext* cx)
|
|||
if (cx->compartment()->isAtomsCompartment())
|
||||
return (JSFatInlineString*)(js::Allocate<js::FatInlineAtom, allowGC>(cx));
|
||||
|
||||
return js::Allocate<JSFatInlineString, allowGC>(cx, js::gc::TenuredHeap);
|
||||
return js::Allocate<JSFatInlineString, allowGC>(cx, js::gc::DefaultHeap);
|
||||
}
|
||||
|
||||
template<>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "vm/TraceLogging.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "jsapi.h"
|
||||
#include "jsarray.h"
|
||||
#include "jscpucfg.h"
|
||||
#include "jsnum.h"
|
||||
#include "jstypes.h"
|
||||
#include "jsutil.h"
|
||||
|
|
|
@ -198,7 +198,9 @@ enum class AstExprKind
|
|||
ConversionOperator,
|
||||
CurrentMemory,
|
||||
Drop,
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
ExtraConversionOperator,
|
||||
#endif
|
||||
First,
|
||||
GetGlobal,
|
||||
GetLocal,
|
||||
|
@ -1142,6 +1144,7 @@ class AstConversionOperator final : public AstExpr
|
|||
AstExpr* operand() const { return operand_; }
|
||||
};
|
||||
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
// Like AstConversionOperator, but for opcodes encoded with the Numeric prefix.
|
||||
class AstExtraConversionOperator final : public AstExpr
|
||||
{
|
||||
|
@ -1158,6 +1161,7 @@ class AstExtraConversionOperator final : public AstExpr
|
|||
NumericOp op() const { return op_; }
|
||||
AstExpr* operand() const { return operand_; }
|
||||
};
|
||||
#endif
|
||||
|
||||
// This is an artificial AST node which can fill operand slots in an AST
|
||||
// constructed from parsing or decoding stack-machine code that doesn't have
|
||||
|
|
|
@ -750,6 +750,7 @@ RenderConversionOperator(WasmRenderContext& c, AstConversionOperator& conv)
|
|||
return c.buffer.append(opStr, strlen(opStr));
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
static bool
|
||||
RenderExtraConversionOperator(WasmRenderContext& c, AstExtraConversionOperator& conv)
|
||||
{
|
||||
|
@ -762,7 +763,6 @@ RenderExtraConversionOperator(WasmRenderContext& c, AstExtraConversionOperator&
|
|||
MAP_AST_EXPR(c, conv);
|
||||
const char* opStr;
|
||||
switch (conv.op()) {
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
case NumericOp::I32TruncSSatF32: opStr = "i32.trunc_s:sat/f32"; break;
|
||||
case NumericOp::I32TruncUSatF32: opStr = "i32.trunc_u:sat/f32"; break;
|
||||
case NumericOp::I32TruncSSatF64: opStr = "i32.trunc_s:sat/f64"; break;
|
||||
|
@ -771,11 +771,11 @@ RenderExtraConversionOperator(WasmRenderContext& c, AstExtraConversionOperator&
|
|||
case NumericOp::I64TruncUSatF32: opStr = "i64.trunc_u:sat/f32"; break;
|
||||
case NumericOp::I64TruncSSatF64: opStr = "i64.trunc_s:sat/f64"; break;
|
||||
case NumericOp::I64TruncUSatF64: opStr = "i64.trunc_u:sat/f64"; break;
|
||||
#endif
|
||||
default: return Fail(c, "unexpected extra conversion operator");
|
||||
}
|
||||
return c.buffer.append(opStr, strlen(opStr));
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool
|
||||
RenderIf(WasmRenderContext& c, AstIf& if_)
|
||||
|
@ -1354,10 +1354,12 @@ RenderExpr(WasmRenderContext& c, AstExpr& expr, bool newLine /* = true */)
|
|||
if (!RenderConversionOperator(c, expr.as<AstConversionOperator>()))
|
||||
return false;
|
||||
break;
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
case AstExprKind::ExtraConversionOperator:
|
||||
if (!RenderExtraConversionOperator(c, expr.as<AstExtraConversionOperator>()))
|
||||
return false;
|
||||
break;
|
||||
#endif
|
||||
case AstExprKind::Load:
|
||||
if (!RenderLoad(c, expr.as<AstLoad>()))
|
||||
return false;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "wasm/WasmJS.h"
|
||||
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/RangedPtr.h"
|
||||
|
||||
|
|
|
@ -91,7 +91,9 @@ class WasmToken
|
|||
Equal,
|
||||
Error,
|
||||
Export,
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
ExtraConversionOpcode,
|
||||
#endif
|
||||
Float,
|
||||
Func,
|
||||
GetGlobal,
|
||||
|
@ -218,6 +220,7 @@ class WasmToken
|
|||
kind_ == Load || kind_ == Store);
|
||||
u.op_ = op;
|
||||
}
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
explicit WasmToken(Kind kind, NumericOp op, const char16_t* begin, const char16_t* end)
|
||||
: kind_(kind),
|
||||
begin_(begin),
|
||||
|
@ -227,6 +230,7 @@ class WasmToken
|
|||
MOZ_ASSERT(kind_ == ExtraConversionOpcode);
|
||||
u.numericOp_ = op;
|
||||
}
|
||||
#endif
|
||||
explicit WasmToken(Kind kind, ThreadOp op, const char16_t* begin, const char16_t* end)
|
||||
: kind_(kind),
|
||||
begin_(begin),
|
||||
|
@ -288,10 +292,12 @@ class WasmToken
|
|||
kind_ == Load || kind_ == Store);
|
||||
return u.op_;
|
||||
}
|
||||
#ifdef ENABLE_WASM_SATURATING_TRUNC_OPS
|
||||
NumericOp numericOp() const {
|
||||
MOZ_ASSERT(kind_ == ExtraConversionOpcode);
|
||||
return u.numericOp_;
|
||||
}
|
||||
#endif
|
||||
ThreadOp threadOp() const {
|
||||
MOZ_ASSERT(kind_ == AtomicCmpXchg || kind_ == AtomicLoad || kind_ == AtomicRMW ||
|
||||
kind_ == AtomicStore || kind_ == Wait || kind_ == Wake);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/EnumSet.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
|
|
|
@ -3160,7 +3160,9 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
|
|||
MOZ_ASSERT(item.mItem->GetType() != DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO);
|
||||
|
||||
DisplayItemData* oldData =
|
||||
mLayerBuilder->GetOldLayerForFrame(item.mItem->Frame(), item.mItem->GetPerFrameKey());
|
||||
mLayerBuilder->GetOldLayerForFrame(item.mItem->Frame(),
|
||||
item.mItem->GetPerFrameKey(),
|
||||
item.mItem->HasMergedFrames() ? nullptr : item.mItem->GetDisplayItemData());
|
||||
InvalidateForLayerChange(item.mItem, data->mLayer, oldData);
|
||||
mLayerBuilder->AddPaintedDisplayItem(data, item.mItem, item.mClip,
|
||||
*this, item.mLayerState,
|
||||
|
|
|
@ -13,8 +13,11 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/MemoryChecking.h"
|
||||
#include "mozilla/Types.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -36,26 +39,26 @@ namespace mozilla {
|
|||
|
||||
struct FloatTypeTraits
|
||||
{
|
||||
typedef uint32_t Bits;
|
||||
using Bits = uint32_t;
|
||||
|
||||
static const unsigned kExponentBias = 127;
|
||||
static const unsigned kExponentShift = 23;
|
||||
static constexpr unsigned kExponentBias = 127;
|
||||
static constexpr unsigned kExponentShift = 23;
|
||||
|
||||
static const Bits kSignBit = 0x80000000UL;
|
||||
static const Bits kExponentBits = 0x7F800000UL;
|
||||
static const Bits kSignificandBits = 0x007FFFFFUL;
|
||||
static constexpr Bits kSignBit = 0x80000000UL;
|
||||
static constexpr Bits kExponentBits = 0x7F800000UL;
|
||||
static constexpr Bits kSignificandBits = 0x007FFFFFUL;
|
||||
};
|
||||
|
||||
struct DoubleTypeTraits
|
||||
{
|
||||
typedef uint64_t Bits;
|
||||
using Bits = uint64_t;
|
||||
|
||||
static const unsigned kExponentBias = 1023;
|
||||
static const unsigned kExponentShift = 52;
|
||||
static constexpr unsigned kExponentBias = 1023;
|
||||
static constexpr unsigned kExponentShift = 52;
|
||||
|
||||
static const Bits kSignBit = 0x8000000000000000ULL;
|
||||
static const Bits kExponentBits = 0x7ff0000000000000ULL;
|
||||
static const Bits kSignificandBits = 0x000fffffffffffffULL;
|
||||
static constexpr Bits kSignBit = 0x8000000000000000ULL;
|
||||
static constexpr Bits kExponentBits = 0x7ff0000000000000ULL;
|
||||
static constexpr Bits kSignificandBits = 0x000fffffffffffffULL;
|
||||
};
|
||||
|
||||
template<typename T> struct SelectTrait;
|
||||
|
@ -91,8 +94,8 @@ template<> struct SelectTrait<double> : public DoubleTypeTraits {};
|
|||
template<typename T>
|
||||
struct FloatingPoint : public SelectTrait<T>
|
||||
{
|
||||
typedef SelectTrait<T> Base;
|
||||
typedef typename Base::Bits Bits;
|
||||
using Base = SelectTrait<T>;
|
||||
using Bits = typename Base::Bits;
|
||||
|
||||
static_assert((Base::kSignBit & Base::kExponentBits) == 0,
|
||||
"sign bit shouldn't overlap exponent bits");
|
||||
|
@ -328,38 +331,134 @@ MinNumberValue()
|
|||
return BitwiseCast<T>(Bits(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* If aValue is equal to some int32_t value, set *aInt32 to that value and
|
||||
* return true; otherwise return false.
|
||||
*
|
||||
* Note that negative zero is "equal" to zero here. To test whether a value can
|
||||
* be losslessly converted to int32_t and back, use NumberIsInt32 instead.
|
||||
*/
|
||||
template<typename T>
|
||||
static MOZ_ALWAYS_INLINE bool
|
||||
NumberEqualsInt32(T aValue, int32_t* aInt32)
|
||||
namespace detail {
|
||||
|
||||
template<typename Float, typename SignedInteger>
|
||||
inline bool
|
||||
NumberEqualsSignedInteger(Float aValue, SignedInteger* aInteger)
|
||||
{
|
||||
/*
|
||||
* XXX Casting a floating-point value that doesn't truncate to int32_t, to
|
||||
* int32_t, induces undefined behavior. We should definitely fix this
|
||||
* (bug 744965), but as apparently it "works" in practice, it's not a
|
||||
* pressing concern now.
|
||||
*/
|
||||
return aValue == (*aInt32 = int32_t(aValue));
|
||||
static_assert(IsSame<Float, float>::value || IsSame<Float, double>::value,
|
||||
"Float must be an IEEE-754 floating point type");
|
||||
static_assert(IsSigned<SignedInteger>::value,
|
||||
"this algorithm only works for signed types: a different one "
|
||||
"will be required for unsigned types");
|
||||
static_assert(sizeof(SignedInteger) >= sizeof(int),
|
||||
"this function *might* require some finessing for signed types "
|
||||
"subject to integral promotion before it can be used on them");
|
||||
|
||||
MOZ_MAKE_MEM_UNDEFINED(aInteger, sizeof(*aInteger));
|
||||
|
||||
// NaNs and infinities are not integers.
|
||||
if (!IsFinite(aValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise do direct comparisons against the minimum/maximum |SignedInteger|
|
||||
// values that can be encoded in |Float|.
|
||||
|
||||
constexpr SignedInteger MaxIntValue =
|
||||
std::numeric_limits<SignedInteger>::max(); // e.g. INT32_MAX
|
||||
constexpr SignedInteger MinValue =
|
||||
std::numeric_limits<SignedInteger>::min(); // e.g. INT32_MIN
|
||||
|
||||
static_assert(IsPowerOfTwo(Abs(MinValue)),
|
||||
"MinValue should be is a small power of two, thus exactly "
|
||||
"representable in float/double both");
|
||||
|
||||
constexpr unsigned SignedIntegerWidth = CHAR_BIT * sizeof(SignedInteger);
|
||||
constexpr unsigned ExponentShift = FloatingPoint<Float>::kExponentShift;
|
||||
|
||||
// Careful! |MaxIntValue| may not be the maximum |SignedInteger| value that
|
||||
// can be encoded in |Float|. Its |SignedIntegerWidth - 1| bits of precision
|
||||
// may exceed |Float|'s |ExponentShift + 1| bits of precision. If necessary,
|
||||
// compute the maximum |SignedInteger| that fits in |Float| from IEEE-754
|
||||
// first principles. (|MinValue| doesn't have this problem because as a
|
||||
// [relatively] small power of two it's always representable in |Float|.)
|
||||
|
||||
// Per C++11 [expr.const]p2, unevaluated subexpressions of logical AND/OR and
|
||||
// conditional expressions *may* contain non-constant expressions, without
|
||||
// making the enclosing expression not constexpr. MSVC implements this -- but
|
||||
// it sometimes warns about undefined behavior in unevaluated subexpressions.
|
||||
// This bites us if we initialize |MaxValue| the obvious way including an
|
||||
// |uint64_t(1) << (SignedIntegerWidth - 2 - ExponentShift)| subexpression.
|
||||
// Pull that shift-amount out and give it a not-too-huge value when it's in an
|
||||
// unevaluated subexpression. 🙄
|
||||
constexpr unsigned PrecisionExceededShiftAmount =
|
||||
ExponentShift > SignedIntegerWidth - 1
|
||||
? 0
|
||||
: SignedIntegerWidth - 2 - ExponentShift;
|
||||
|
||||
constexpr SignedInteger MaxValue =
|
||||
ExponentShift > SignedIntegerWidth - 1
|
||||
? MaxIntValue
|
||||
: SignedInteger((uint64_t(1) << (SignedIntegerWidth - 1)) -
|
||||
(uint64_t(1) << PrecisionExceededShiftAmount));
|
||||
|
||||
if (static_cast<Float>(MinValue) <= aValue &&
|
||||
aValue <= static_cast<Float>(MaxValue))
|
||||
{
|
||||
auto possible = static_cast<SignedInteger>(aValue);
|
||||
if (static_cast<Float>(possible) == aValue) {
|
||||
*aInteger = possible;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename Float, typename SignedInteger>
|
||||
inline bool
|
||||
NumberIsSignedInteger(Float aValue, SignedInteger* aInteger)
|
||||
{
|
||||
static_assert(IsSame<Float, float>::value || IsSame<Float, double>::value,
|
||||
"Float must be an IEEE-754 floating point type");
|
||||
static_assert(IsSigned<SignedInteger>::value,
|
||||
"this algorithm only works for signed types: a different one "
|
||||
"will be required for unsigned types");
|
||||
static_assert(sizeof(SignedInteger) >= sizeof(int),
|
||||
"this function *might* require some finessing for signed types "
|
||||
"subject to integral promotion before it can be used on them");
|
||||
|
||||
MOZ_MAKE_MEM_UNDEFINED(aInteger, sizeof(*aInteger));
|
||||
|
||||
if (IsNegativeZero(aValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return NumberEqualsSignedInteger(aValue, aInteger);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/**
|
||||
* If d can be converted to int32_t and back to an identical double value,
|
||||
* set *aInt32 to that value and return true; otherwise return false.
|
||||
* If |aValue| is identical to some |int32_t| value, set |*aInt32| to that value
|
||||
* and return true. Otherwise return false, leaving |*aInt32| in an
|
||||
* indeterminate state.
|
||||
*
|
||||
* The difference between this and NumberEqualsInt32 is that this method returns
|
||||
* false for negative zero.
|
||||
* This method returns false for negative zero. If you want to consider -0 to
|
||||
* be 0, use NumberEqualsInt32 below.
|
||||
*/
|
||||
template<typename T>
|
||||
static MOZ_ALWAYS_INLINE bool
|
||||
NumberIsInt32(T aValue, int32_t* aInt32)
|
||||
{
|
||||
return !IsNegativeZero(aValue) && NumberEqualsInt32(aValue, aInt32);
|
||||
return detail::NumberIsSignedInteger(aValue, aInt32);
|
||||
}
|
||||
|
||||
/**
|
||||
* If |aValue| is equal to some int32_t value (where -0 and +0 are considered
|
||||
* equal), set |*aInt32| to that value and return true. Otherwise return false,
|
||||
* leaving |*aInt32| in an indeterminate state.
|
||||
*
|
||||
* |NumberEqualsInt32(-0.0, ...)| will return true. To test whether a value can
|
||||
* be losslessly converted to |int32_t| and back, use NumberIsInt32 above.
|
||||
*/
|
||||
template<typename T>
|
||||
static MOZ_ALWAYS_INLINE bool
|
||||
NumberEqualsInt32(T aValue, int32_t* aInt32)
|
||||
{
|
||||
return detail::NumberEqualsSignedInteger(aValue, aInt32);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -116,10 +116,10 @@ template<> struct AbsReturnType<long double> { typedef long double Type; };
|
|||
} // namespace detail
|
||||
|
||||
template<typename T>
|
||||
inline typename detail::AbsReturnType<T>::Type
|
||||
inline constexpr typename detail::AbsReturnType<T>::Type
|
||||
Abs(const T aValue)
|
||||
{
|
||||
typedef typename detail::AbsReturnType<T>::Type ReturnType;
|
||||
using ReturnType = typename detail::AbsReturnType<T>::Type;
|
||||
return aValue >= 0 ? ReturnType(aValue) : ~ReturnType(aValue) + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
* 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/. */
|
||||
|
||||
#include "mozilla/Compiler.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
|
||||
using mozilla::ExponentComponent;
|
||||
|
@ -319,13 +321,42 @@ TestDoublesPredicates()
|
|||
A(i == INT32_MIN);
|
||||
A(NumberEqualsInt32(double(INT32_MAX), &i));
|
||||
A(i == INT32_MAX);
|
||||
|
||||
// MSVC seems to compile 2**-1075, which should be half of the smallest
|
||||
// IEEE-754 double precision value, to equal 2**-1074 right now. This might
|
||||
// be the result of a missing compiler flag to force more-accurate floating
|
||||
// point calculations; bug 1440184 has been filed as a followup to fix this,
|
||||
// so that only the first half of this condition is necessary.
|
||||
A(pow(2.0, -1075.0) == 0.0 ||
|
||||
(MOZ_IS_MSVC && pow(2.0, -1075.0) == pow(2.0, -1074.0)));
|
||||
|
||||
A(pow(2.0, -1074.0) != 0.0);
|
||||
A(!NumberIsInt32(pow(2.0, -1074.0), &i));
|
||||
A(!NumberIsInt32(2 * pow(2.0, -1074.0), &i));
|
||||
A(!NumberIsInt32(0.5, &i));
|
||||
A(1.0 - pow(2.0, -54.0) == 1.0);
|
||||
A(1.0 - pow(2.0, -53.0) != 1.0);
|
||||
A(!NumberIsInt32(1.0 - pow(2.0, -53.0), &i));
|
||||
A(!NumberIsInt32(1.0 - pow(2.0, -52.0), &i));
|
||||
A(1.0 + pow(2.0, -53.0) == 1.0f);
|
||||
A(1.0 + pow(2.0, -52.0) != 1.0f);
|
||||
A(!NumberIsInt32(1.0 + pow(2.0, -52.0), &i));
|
||||
A(!NumberIsInt32(1.5f, &i));
|
||||
A(!NumberIsInt32(-double(2147483649), &i));
|
||||
A(!NumberIsInt32(double(2147483648), &i));
|
||||
A(!NumberIsInt32(-double(1ULL << 52) + 0.5, &i));
|
||||
A(!NumberIsInt32(double(1ULL << 52) - 0.5, &i));
|
||||
A(!NumberIsInt32(double(2147483648), &i));
|
||||
A(!NumberIsInt32(double(INT32_MAX) + 0.1, &i));
|
||||
A(!NumberIsInt32(double(INT32_MIN) - 0.1, &i));
|
||||
A(!NumberIsInt32(NegativeInfinity<double>(), &i));
|
||||
A(!NumberIsInt32(PositiveInfinity<double>(), &i));
|
||||
A(!NumberIsInt32(UnspecifiedNaN<double>(), &i));
|
||||
A(!NumberEqualsInt32(0.5, &i));
|
||||
A(!NumberEqualsInt32(-double(2147483649), &i));
|
||||
A(!NumberEqualsInt32(double(2147483648), &i));
|
||||
A(!NumberEqualsInt32(-double(1ULL << 52) + 0.5, &i));
|
||||
A(!NumberEqualsInt32(double(1ULL << 52) - 0.5, &i));
|
||||
A(!NumberEqualsInt32(double(INT32_MAX) + 0.1, &i));
|
||||
A(!NumberEqualsInt32(double(INT32_MIN) - 0.1, &i));
|
||||
A(!NumberEqualsInt32(NegativeInfinity<double>(), &i));
|
||||
|
@ -401,18 +432,38 @@ TestFloatsPredicates()
|
|||
A(i == 0);
|
||||
A(NumberIsInt32(float(INT32_MIN), &i));
|
||||
A(i == INT32_MIN);
|
||||
A(NumberIsInt32(float(2147483648 - 128), &i)); // max int32_t fitting in float
|
||||
A(i == 2147483648 - 128);
|
||||
A(NumberIsInt32(float(BIG), &i));
|
||||
A(i == BIG);
|
||||
A(NumberEqualsInt32(float(INT32_MIN), &i));
|
||||
A(i == INT32_MIN);
|
||||
A(NumberEqualsInt32(float(BIG), &i));
|
||||
A(i == BIG);
|
||||
A(powf(2.0f, -150.0f) == 0.0f);
|
||||
A(powf(2.0f, -149.0f) != 0.0f);
|
||||
A(!NumberIsInt32(powf(2.0f, -149.0f), &i));
|
||||
A(!NumberIsInt32(2 * powf(2.0f, -149.0f), &i));
|
||||
A(!NumberIsInt32(0.5f, &i));
|
||||
A(1.0f - powf(2.0f, -25.0f) == 1.0f);
|
||||
A(1.0f - powf(2.0f, -24.0f) != 1.0f);
|
||||
A(!NumberIsInt32(1.0f - powf(2.0f, -24.0f), &i));
|
||||
A(!NumberIsInt32(1.0f - powf(2.0f, -23.0f), &i));
|
||||
A(1.0f + powf(2.0f, -24.0f) == 1.0f);
|
||||
A(1.0f + powf(2.0f, -23.0f) != 1.0f);
|
||||
A(!NumberIsInt32(1.0f + powf(2.0f, -23.0f), &i));
|
||||
A(!NumberIsInt32(1.5f, &i));
|
||||
A(!NumberIsInt32(-float(2147483648) - 256, &i));
|
||||
A(!NumberIsInt32(float(2147483648), &i));
|
||||
A(!NumberIsInt32(float(2147483648) + 256, &i));
|
||||
A(!NumberIsInt32(float(BIG) + 0.1f, &i));
|
||||
A(!NumberIsInt32(NegativeInfinity<float>(), &i));
|
||||
A(!NumberIsInt32(PositiveInfinity<float>(), &i));
|
||||
A(!NumberIsInt32(UnspecifiedNaN<float>(), &i));
|
||||
A(!NumberEqualsInt32(0.5f, &i));
|
||||
A(!NumberEqualsInt32(-float(2147483648 + 256), &i));
|
||||
A(!NumberEqualsInt32(float(2147483648), &i));
|
||||
A(!NumberEqualsInt32(float(2147483648 + 256), &i));
|
||||
A(!NumberEqualsInt32(float(BIG) + 0.1f, &i));
|
||||
A(!NumberEqualsInt32(NegativeInfinity<float>(), &i));
|
||||
A(!NumberEqualsInt32(PositiveInfinity<float>(), &i));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
android:background="@color/text_and_tabs_tray_grey"
|
||||
app:layout_scrollFlags="scroll|enterAlways"/>
|
||||
|
||||
<org.mozilla.gecko.GeckoView
|
||||
<org.mozilla.geckoview.GeckoView
|
||||
android:id="@+id/gecko_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_below="@id/actionbar"
|
||||
|
@ -51,4 +51,4 @@
|
|||
android:alpha="0"
|
||||
android:layerType="hardware"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
android:layout_below="@+id/tablet_tab_strip"
|
||||
android:layout_above="@+id/find_in_page">
|
||||
|
||||
<org.mozilla.gecko.GeckoView android:id="@+id/layer_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"/>
|
||||
<org.mozilla.geckoview.GeckoView android:id="@+id/layer_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scrollbars="none"/>
|
||||
|
||||
<org.mozilla.gecko.FormAssistPopup android:id="@+id/form_assist_popup"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<org.mozilla.gecko.GeckoView
|
||||
<org.mozilla.geckoview.GeckoView
|
||||
android:id="@+id/pwa_gecko_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -24,4 +24,4 @@
|
|||
android:layout_height="match_parent"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.mozilla.gecko.util.EventCallback;
|
|||
import org.mozilla.gecko.util.GeckoBundle;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.widget.ActionModePresenter;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
|
|
@ -173,6 +173,7 @@ import org.mozilla.gecko.widget.AnchoredPopup;
|
|||
import org.mozilla.gecko.widget.AnimatedProgressBar;
|
||||
import org.mozilla.gecko.widget.GeckoActionProvider;
|
||||
import org.mozilla.gecko.widget.SplashScreen;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.mozilla.gecko;
|
|||
import org.mozilla.gecko.PrefsHelper.PrefHandlerBase;
|
||||
import org.mozilla.gecko.gfx.DynamicToolbarAnimator.PinReason;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.mozilla.gecko.util.GeckoBundle;
|
|||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.widget.SwipeDismissListViewTouchListener;
|
||||
import org.mozilla.gecko.widget.SwipeDismissListViewTouchListener.OnDismissCallback;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.util.GeckoBundle;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
|
|
|
@ -42,6 +42,9 @@ import org.mozilla.gecko.util.ThreadUtils;
|
|||
import org.mozilla.gecko.util.ViewUtil;
|
||||
import org.mozilla.gecko.widget.ActionModePresenter;
|
||||
import org.mozilla.gecko.widget.AnchoredPopup;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoSessionSettings;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.mozilla.gecko.AppConstants.Versions;
|
|||
|
||||
import org.mozilla.gecko.annotation.BuildFlag;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
/**
|
||||
* A MediaPlayerManager with API 17+ Presentation support.
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.GeckoSession;
|
||||
import org.mozilla.gecko.GeckoSessionSettings;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.ScreenManagerHelper;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoSessionSettings;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import com.google.android.gms.cast.CastMediaControlIntent;
|
||||
import com.google.android.gms.cast.CastPresentation;
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.mozilla.gecko.util.GeckoBundle;
|
|||
import org.mozilla.gecko.util.JavaUtil;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.webapps.WebAppManifest;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
|
|
|
@ -29,13 +29,13 @@ import android.widget.ImageButton;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.GeckoSession.ProgressListener.SecurityInformation;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.SiteIdentity;
|
||||
import org.mozilla.gecko.Tab;
|
||||
import org.mozilla.gecko.toolbar.SecurityModeUtil;
|
||||
import org.mozilla.gecko.util.ColorUtil;
|
||||
import org.mozilla.geckoview.GeckoSession.ProgressListener.SecurityInformation;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
/**
|
||||
* This class is used to maintain appearance of ActionBar of CustomTabsActivity, includes background
|
||||
|
|
|
@ -42,9 +42,6 @@ import org.mozilla.gecko.EventDispatcher;
|
|||
import org.mozilla.gecko.FormAssistPopup;
|
||||
import org.mozilla.gecko.GeckoAccessibility;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.GeckoSession;
|
||||
import org.mozilla.gecko.GeckoSessionSettings;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.SnackbarBuilder;
|
||||
|
@ -67,6 +64,9 @@ import org.mozilla.gecko.util.ThreadUtils;
|
|||
import org.mozilla.gecko.webapps.WebApps;
|
||||
import org.mozilla.gecko.widget.ActionModePresenter;
|
||||
import org.mozilla.gecko.widget.GeckoPopupMenu;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoSessionSettings;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ import android.widget.Toast;
|
|||
import org.mozilla.gecko.AboutPages;
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.EventDispatcher;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.GeckoSession.ProgressListener.SecurityInformation;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.SiteIdentity;
|
||||
import org.mozilla.gecko.SiteIdentity.SecurityMode;
|
||||
|
@ -35,6 +33,8 @@ import org.mozilla.gecko.util.ThreadUtils;
|
|||
import org.mozilla.gecko.widget.AnchoredPopup;
|
||||
import org.mozilla.gecko.widget.DoorHanger;
|
||||
import org.mozilla.gecko.widget.DoorHanger.OnButtonClickListener;
|
||||
import org.mozilla.geckoview.GeckoSession.ProgressListener.SecurityInformation;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
|
|
@ -15,7 +15,6 @@ import android.util.TypedValue;
|
|||
import android.view.ActionMode;
|
||||
|
||||
import org.mozilla.gecko.EventDispatcher;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
import org.mozilla.gecko.util.ActivityUtils;
|
||||
|
@ -23,6 +22,7 @@ import org.mozilla.gecko.util.BundleEventListener;
|
|||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.GeckoBundle;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ package org.mozilla.gecko.text;
|
|||
|
||||
import org.mozilla.gecko.ActionBarTextSelection;
|
||||
import org.mozilla.gecko.AppConstants.Versions;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.widget.ActionModePresenter;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
|
|
@ -37,10 +37,7 @@ import org.mozilla.gecko.DoorHangerPopup;
|
|||
import org.mozilla.gecko.FormAssistPopup;
|
||||
import org.mozilla.gecko.GeckoAccessibility;
|
||||
import org.mozilla.gecko.GeckoScreenOrientation;
|
||||
import org.mozilla.gecko.GeckoSession;
|
||||
import org.mozilla.gecko.GeckoSessionSettings;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.customtabs.CustomTabsActivity;
|
||||
|
@ -50,6 +47,9 @@ import org.mozilla.gecko.text.TextSelection;
|
|||
import org.mozilla.gecko.util.ActivityUtils;
|
||||
import org.mozilla.gecko.util.ColorUtil;
|
||||
import org.mozilla.gecko.widget.ActionModePresenter;
|
||||
import org.mozilla.geckoview.GeckoSession;
|
||||
import org.mozilla.geckoview.GeckoSessionSettings;
|
||||
import org.mozilla.geckoview.GeckoView;
|
||||
|
||||
public class WebAppActivity extends AppCompatActivity
|
||||
implements ActionModePresenter,
|
||||
|
|
|
@ -363,6 +363,16 @@ if CONFIG['MOZ_WEBRTC']:
|
|||
|
||||
gvjar = add_java_jar('gecko-view')
|
||||
|
||||
gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/geckoview/' + x
|
||||
for x in [
|
||||
'GeckoSession.java',
|
||||
'GeckoSessionHandler.java',
|
||||
'GeckoSessionSettings.java',
|
||||
'GeckoView.java',
|
||||
'TextInputController.java',
|
||||
'TrackingProtection.java',
|
||||
]]
|
||||
|
||||
gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x
|
||||
for x in [
|
||||
'AndroidGamepadManager.java',
|
||||
|
@ -379,12 +389,8 @@ gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x
|
|||
'GeckoProfile.java',
|
||||
'GeckoProfileDirectories.java',
|
||||
'GeckoScreenOrientation.java',
|
||||
'GeckoSession.java',
|
||||
'GeckoSessionHandler.java',
|
||||
'GeckoSessionSettings.java',
|
||||
'GeckoSharedPrefs.java',
|
||||
'GeckoThread.java',
|
||||
'GeckoView.java',
|
||||
'GeckoVRManager.java',
|
||||
'gfx/CompositorController.java',
|
||||
'gfx/DynamicToolbarAnimator.java',
|
||||
|
@ -443,9 +449,7 @@ gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x
|
|||
'sqlite/MatrixBlobCursor.java',
|
||||
'sqlite/SQLiteBridge.java',
|
||||
'sqlite/SQLiteBridgeException.java',
|
||||
'TextInputController.java',
|
||||
'TouchEventInterceptor.java',
|
||||
'TrackingProtection.java',
|
||||
'WakeLockDelegate.java',
|
||||
]]
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ public final class EventDispatcher extends JNIObject {
|
|||
mNativeQueue = GeckoThread.getNativeQueue();
|
||||
}
|
||||
|
||||
/* package */ EventDispatcher(final NativeQueue queue) {
|
||||
public EventDispatcher(final NativeQueue queue) {
|
||||
mNativeQueue = queue;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.util.ThreadUtils.AssertBehavior;
|
||||
import org.mozilla.geckoview.TextInputController;
|
||||
|
||||
import android.graphics.RectF;
|
||||
import android.os.Handler;
|
||||
|
@ -42,7 +43,7 @@ import android.view.KeyEvent;
|
|||
* The field mText contains the actual underlying
|
||||
* SpannableStringBuilder/Editable that contains our text.
|
||||
*/
|
||||
/* package */ final class GeckoEditable
|
||||
public final class GeckoEditable
|
||||
extends IGeckoEditableParent.Stub
|
||||
implements InvocationHandler,
|
||||
Editable,
|
||||
|
@ -600,7 +601,7 @@ import android.view.KeyEvent;
|
|||
}
|
||||
}
|
||||
|
||||
/* package */ GeckoEditable() {
|
||||
public GeckoEditable() {
|
||||
if (DEBUG) {
|
||||
// Called by TextInputController.
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
@ -616,7 +617,7 @@ import android.view.KeyEvent;
|
|||
mIcRunHandler = mIcPostHandler = ThreadUtils.getUiHandler();
|
||||
}
|
||||
|
||||
/* package */ void setDefaultEditableChild(final IGeckoEditableChild child) {
|
||||
public void setDefaultEditableChild(final IGeckoEditableChild child) {
|
||||
if (DEBUG) {
|
||||
// Called by TextInputController.
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
@ -625,7 +626,7 @@ import android.view.KeyEvent;
|
|||
mDefaultChild = child;
|
||||
}
|
||||
|
||||
/* package */ void setListener(final TextInputController.EditableListener newListener) {
|
||||
public void setListener(final TextInputController.EditableListener newListener) {
|
||||
if (DEBUG) {
|
||||
// Called by TextInputController.
|
||||
ThreadUtils.assertOnUiThread();
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.mozilla.gecko;
|
|||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.geckoview.TextInputController;
|
||||
|
||||
import android.graphics.RectF;
|
||||
import android.os.IBinder;
|
||||
|
@ -21,7 +22,7 @@ import android.view.KeyEvent;
|
|||
* process has an instance of GeckoEditableChild, which communicates with the
|
||||
* GeckoEditableParent instance in the main process.
|
||||
*/
|
||||
final class GeckoEditableChild extends JNIObject implements IGeckoEditableChild {
|
||||
public final class GeckoEditableChild extends JNIObject implements IGeckoEditableChild {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private static final String LOGTAG = "GeckoEditableChild";
|
||||
|
@ -74,7 +75,7 @@ final class GeckoEditableChild extends JNIObject implements IGeckoEditableChild
|
|||
private int mCurrentTextLength; // Used by Gecko thread
|
||||
|
||||
@WrapForJNI(calledFrom = "gecko")
|
||||
/* package */ GeckoEditableChild(final IGeckoEditableParent editableParent) {
|
||||
public GeckoEditableChild(final IGeckoEditableParent editableParent) {
|
||||
mEditableParent = editableParent;
|
||||
|
||||
final IBinder binder = editableParent.asBinder();
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче