Merge autoland to mozilla-central. a=merge

This commit is contained in:
Brindusan Cristian 2019-05-25 00:46:28 +03:00
commit bd1f354f25
282 changed files with 2797 additions and 19450 deletions

51
Cargo.lock generated
View File

@ -140,6 +140,23 @@ dependencies = [
"tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "authenticator"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"boxfnonce 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"devd-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)",
]
[[package]]
name = "autocfg"
version = "0.1.2"
@ -889,11 +906,11 @@ dependencies = [
[[package]]
name = "devd-rs"
version = "0.2.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1255,6 +1272,7 @@ dependencies = [
"arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"audioipc-client 0.4.0",
"audioipc-server 0.2.3",
"authenticator 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"bitsdownload 0.1.0",
"bookmark_sync 0.1.0",
"cert_storage 0.0.1",
@ -1280,7 +1298,6 @@ dependencies = [
"rsdparsa_capi 0.1.0",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"storage 0.1.0",
"u2fhid 0.2.4",
"webrender_bindings 0.1.0",
"xpcom 0.1.0",
"xulstore 0.1.0",
@ -1977,14 +1994,6 @@ name = "nodrop"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "nom"
version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nom"
version = "4.1.1"
@ -3297,22 +3306,6 @@ name = "typenum"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "u2fhid"
version = "0.2.4"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"boxfnonce 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"devd-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
"libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)",
]
[[package]]
name = "ucd-util"
version = "0.1.1"
@ -3727,6 +3720,7 @@ dependencies = [
"checksum ascii-canvas 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b385d69402821a1c254533a011a312531cbcc0e3e24f19bbb4747a5a2daf37e2"
"checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum authenticator 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ec149e5d5d4caa2c9ead53a8ce1ea9c4204c388c65bf3b96c2d1dc0fcf4aeb66"
"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
@ -3796,7 +3790,7 @@ dependencies = [
"checksum darling_macro 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "244e8987bd4e174385240cde20a3657f607fb0797563c28255c353b5819a07b1"
"checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86"
"checksum derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871"
"checksum devd-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e7c9ac481c38baf400d3b732e4a06850dfaa491d1b6379a249d9d40d14c2434c"
"checksum devd-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d009f166c0d9e9f9909dc751630b3a6411ab7f85a153d32d01deb364ffe52a7"
"checksum diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "3c2b69f912779fbb121ceb775d74d51e915af17aaebc38d28a592843a2dd0a3a"
"checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c"
"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a"
@ -3888,7 +3882,6 @@ dependencies = [
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4"
"checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2"
"checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b"
"checksum nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a"
"checksum num-derive 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2"
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"

View File

@ -19,4 +19,9 @@ class RFPHelperChild extends ActorChild {
this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
}
}
receiveMessage(aMessage) {
if (isLetterboxingEnabled) {
this.mm.sendAsyncMessage("Letterboxing:ContentSizeUpdated");
}
}
}

View File

@ -530,6 +530,7 @@ const startupPhases = {
{ // bug 1003968
path: "XREAppDist:searchplugins",
condition: WIN,
ignoreIfUnused: true, // with WebRender enabled this may happen during "before becoming idle"
stat: 1,
},
{
@ -643,6 +644,12 @@ const startupPhases = {
condition: WIN,
stat: 7,
},
{ // bug 1003968
path: "XREAppDist:searchplugins",
condition: WIN,
ignoreIfUnused: true, // with WebRender enabled this may happen during "before handling user events"
stat: 1,
},
],
};

View File

@ -21,3 +21,4 @@ environment =
[../browser_startup_mainthreadio.js]
[../browser_startup_content_mainthreadio.js]
[../browser_startup_syncIPC.js]
skip-if = webrender # bug 1554156

View File

@ -86,3 +86,5 @@ skip-if = os == 'mac'
[browser_viewsource_of_data_URI_in_file_process.js]
[browser_visibleTabs_bookmarkAllTabs.js]
[browser_visibleTabs_contextMenu.js]
[browser_tabswitch_window_focus.js]
support-files = open_window_in_new_tab.html

View File

@ -0,0 +1,35 @@
"use strict";
// Allow to open popups without any kind of interaction.
SpecialPowers.pushPrefEnv({"set": [["dom.disable_window_flip", false]]});
const FILE = getRootDirectory(gTestPath) + "open_window_in_new_tab.html";
add_task(async function() {
info("Opening first tab: " + FILE);
let firstTab = await BrowserTestUtils.openNewForegroundTab(gBrowser, FILE);
let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, FILE + "?opened", true);
info("Opening second tab using a click");
await ContentTask.spawn(firstTab.linkedBrowser, "", async function() {
content.document.querySelector("#open").click();
});
info("Waiting for the second tab to be opened");
let secondTab = await promiseTabOpened;
info("Going back to the first tab");
await BrowserTestUtils.switchTab(gBrowser, firstTab);
info("Focusing second tab by clicking on the first tab");
await BrowserTestUtils.switchTab(gBrowser, async function() {
await ContentTask.spawn(firstTab.linkedBrowser, "", async function() {
content.document.querySelector("#focus").click();
});
});
is(gBrowser.selectedTab, secondTab, "Should've switched tabs");
BrowserTestUtils.removeTab(firstTab);
BrowserTestUtils.removeTab(secondTab);
});

View File

@ -0,0 +1,8 @@
<!doctype html>
<script>
function openWindow() {
window.childWindow = window.open(location.href + "?opened", "", "");
}
</script>
<button id="open" onclick="openWindow()">Open window</button>
<button id="focus" onclick="window.childWindow.focus()">Focus window</button>

View File

@ -15,7 +15,7 @@ skip-if = debug # bug 1369731
skip-if = debug && (os == "win" || os == "mac") # bug 1393761
[browser_devices_get_user_media_paused.js]
[browser_devices_get_user_media_screen.js]
skip-if = (os == 'linux') # Bug 1503991
skip-if = (os == 'linux') || (os == 'win' && debug && webrender) # Bug 1503991 for linux, bug 1553579 for WR
[browser_devices_get_user_media_tear_off_tab.js]
[browser_devices_get_user_media_unprompted_access.js]
[browser_devices_get_user_media_unprompted_access_in_frame.js]

View File

@ -276,6 +276,10 @@ let LEGACY_ACTORS = {
events: {
"resize": {},
},
messages: [
"Finder:FindbarOpen",
"Finder:FindbarClose",
],
},
},

View File

@ -81,6 +81,7 @@ skip-if = (verify && (os == 'linux' || os == 'mac'))
[browser_ext_commands_execute_sidebar_action.js]
[browser_ext_commands_getAll.js]
[browser_ext_commands_onCommand.js]
skip-if = (webrender && debug) # bug 1553577
[browser_ext_commands_update.js]
[browser_ext_connect_and_move_tabs.js]
[browser_ext_contentscript_connect.js]

View File

@ -64,12 +64,15 @@
-moz-appearance: toolbarbutton;
}
#placesMenu > menu:active,
#placesMenu > menu:hover,
#placesMenu > menu[open] {
#placesMenu > menu:hover {
color: ButtonText;
}
#placesMenu > menu:active,
#placesMenu > menu[open] {
color: -moz-gtk-buttonactivetext;
}
#placesMenu > menu::after {
content: "";
display: -moz-box;

View File

@ -341,19 +341,6 @@ already_AddRefed<BasePrincipal> BasePrincipal::CreateCodebasePrincipal(
return BasePrincipal::CreateCodebasePrincipal(uri, attrs);
}
already_AddRefed<BasePrincipal> BasePrincipal::CloneForcingFirstPartyDomain(
nsIURI* aURI) {
if (NS_WARN_IF(!IsCodebasePrincipal())) {
return nullptr;
}
OriginAttributes attrs = OriginAttributesRef();
// XXX this is slow. Maybe we should consider to make it faster.
attrs.SetFirstPartyDomain(false, aURI, true /* aForced */);
return CloneForcingOriginAttributes(attrs);
}
already_AddRefed<BasePrincipal> BasePrincipal::CloneForcingOriginAttributes(
const OriginAttributes& aOriginAttributes) {
if (NS_WARN_IF(!IsCodebasePrincipal())) {

View File

@ -156,8 +156,6 @@ class BasePrincipal : public nsJSPrincipals {
PrincipalKind Kind() const { return mKind; }
already_AddRefed<BasePrincipal> CloneForcingFirstPartyDomain(nsIURI* aURI);
already_AddRefed<BasePrincipal> CloneForcingOriginAttributes(
const OriginAttributes& aOriginAttributes);

View File

@ -20,7 +20,14 @@ const {
const TreeViewClass = require("devtools/client/shared/components/tree/TreeView");
const PropertiesView = createFactory(require("./PropertiesView"));
const { div, input, span } = dom;
loader.lazyGetter(this, "Rep", function() {
return require("devtools/client/shared/components/reps/reps").REPS.Rep;
});
loader.lazyGetter(this, "MODE", function() {
return require("devtools/client/shared/components/reps/reps").MODE;
});
const { div, span } = dom;
const NOT_AVAILABLE = L10N.getStr("netmonitor.security.notAvailable");
const ERROR_LABEL = L10N.getStr("netmonitor.security.error");
const CIPHER_SUITE_LABEL = L10N.getStr("netmonitor.security.cipherSuite");
@ -96,16 +103,15 @@ class SecurityPanel extends Component {
return span({ className: "security-info-value" },
member.name === ERROR_LABEL ?
// Display multiline text for security error
value
:
// Display one line selectable text for security details
input({
className: "textbox-input",
readOnly: "true",
value,
})
,
// Display multiline text for security error for a label using a rep.
value : Rep(Object.assign(props, {
// FIXME: A workaround for the issue in StringRep
// Force StringRep to crop the text everytime
member: Object.assign({}, member, { open: false }),
mode: MODE.TINY,
cropLimit: 60,
noGrip: true,
})),
weaknessReasons.includes("cipher") &&
member.name === CIPHER_SUITE_LABEL ?
// Display an extra warning icon after the cipher suite

View File

@ -31,18 +31,18 @@ add_task(async function() {
"#security-panel .security-info-value"));
const tabpanel = document.querySelector("#security-panel");
const textboxes = tabpanel.querySelectorAll(".textbox-input");
const textboxes = tabpanel.querySelectorAll(".security-info-value");
// Connection
// The protocol will be TLS but the exact version depends on which protocol
// the test server example.com supports.
const protocol = textboxes[0].value;
const protocol = textboxes[0].textContent;
ok(protocol.startsWith("TLS"), "The protocol " + protocol + " seems valid.");
// The cipher suite used by the test server example.com might change at any
// moment but all of them should start with "TLS_".
// http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml
const suite = textboxes[1].value;
const suite = textboxes[1].textContent;
ok(suite.startsWith("TLS_"), "The suite " + suite + " seems valid.");
// Host
@ -50,36 +50,37 @@ add_task(async function() {
"Host example.com:",
"Label has the expected value.");
// These two values can change. So only check they're not empty.
ok(textboxes[2].value !== "", "Label value is not empty.");
ok(textboxes[3].value !== "", "Label value is not empty.");
is(textboxes[4].value, "Disabled", "Label has the expected value.");
is(textboxes[5].value, "Disabled", "Label has the expected value.");
ok(textboxes[2].textContent !== "", "Label value is not empty.");
ok(textboxes[3].textContent !== "", "Label value is not empty.");
is(textboxes[4].textContent, "Disabled", "Label has the expected value.");
is(textboxes[5].textContent, "Disabled", "Label has the expected value.");
// Cert
is(textboxes[6].value, "example.com", "Label has the expected value.");
is(textboxes[7].value, "<Not Available>", "Label has the expected value.");
is(textboxes[8].value, "<Not Available>", "Label has the expected value.");
is(textboxes[6].textContent, "example.com", "Label has the expected value.");
is(textboxes[7].textContent, "<Not Available>", "Label has the expected value.");
is(textboxes[8].textContent, "<Not Available>", "Label has the expected value.");
is(textboxes[9].value, "Temporary Certificate Authority",
is(textboxes[9].textContent, "Temporary Certificate Authority",
"Label has the expected value.");
is(textboxes[10].value, "Mozilla Testing", "Label has the expected value.");
is(textboxes[11].value, "Profile Guided Optimization", "Label has the expected value.");
is(textboxes[10].textContent, "Mozilla Testing", "Label has the expected value.");
is(textboxes[11].textContent, "Profile Guided Optimization",
"Label has the expected value.");
// Locale sensitive and varies between timezones. Cant't compare equality or
// Locale sensitive and varies between timezones. Can't compare equality or
// the test fails depending on which part of the world the test is executed.
// cert validity begins
isnot(textboxes[12].value, "", "Label was not empty.");
isnot(textboxes[12].textContent, "", "Label was not empty.");
// cert validity expires
isnot(textboxes[13].value, "", "Label was not empty.");
isnot(textboxes[13].textContent, "", "Label was not empty.");
// cert sha1 fingerprint
isnot(textboxes[14].value, "", "Label was not empty.");
isnot(textboxes[14].textContent, "", "Label was not empty.");
// cert sha256 fingerprint
isnot(textboxes[15].value, "", "Label was not empty.");
isnot(textboxes[15].textContent, "", "Label was not empty.");
// Certificate transparency
isnot(textboxes[16].value, "", "Label was not empty.");
isnot(textboxes[16].textContent, "", "Label was not empty.");
await teardown(monitor);
});

View File

@ -140,7 +140,7 @@ If not, maybe you'll be able to contribute with one by the time you fix your bug
We have several types of automated tests to help us when developing.
Some, like the linting tests, address coding style; others address functionality, such as unit and integration tests. This page has more [details on types of tests and how to run them](../tests.md).
Some, like the linting tests, address coding style; others address functionality, such as unit and integration tests. This page has more [details on types of tests and how to run them](../tests/).
You might want to run the unit and integration types of tests quite frequently, to confirm you're not breaking anything else. Depending on what you're doing, it might be even possible to run just one test file which addresses the specific change you're implementing:

View File

@ -173,14 +173,14 @@ BreakpointActor.prototype = {
// Don't pause if we are currently stepping (in or over) or the frame is
// black-boxed.
const {
generatedSourceActor,
generatedLine,
generatedColumn,
sourceActor,
line,
column,
} = this.threadActor.sources.getFrameLocation(frame);
const url = generatedSourceActor.url;
const url = sourceActor.url;
if (
this.threadActor.sources.isBlackBoxed(url, generatedLine, generatedColumn) ||
this.threadActor.sources.isBlackBoxed(url, line, column) ||
this.threadActor.skipBreakpoints ||
frame.onStep
) {
@ -189,11 +189,11 @@ BreakpointActor.prototype = {
// If we're trying to pop this frame, and we see a breakpoint at
// the spot at which popping started, ignore it. See bug 970469.
const locationAtFinish = frame.onPop && frame.onPop.generatedLocation;
const locationAtFinish = frame.onPop && frame.onPop.location;
if (
locationAtFinish &&
locationAtFinish.generatedLine === generatedLine &&
locationAtFinish.generatedColumn === generatedColumn
locationAtFinish.line === line &&
locationAtFinish.column === column
) {
return undefined;
}
@ -239,8 +239,8 @@ BreakpointActor.prototype = {
const message = {
filename: url,
lineNumber: generatedLine,
columnNumber: generatedColumn,
lineNumber: line,
columnNumber: column,
level: "logPoint",
arguments: value,
};

View File

@ -105,16 +105,16 @@ ActorPool.prototype = {
exports.ActorPool = ActorPool;
/**
* A GeneratedLocation represents a location in a generated source.
* A SourceLocation represents a location in a source.
*
* @param SourceActor actor
* A SourceActor representing a generated source.
* A SourceActor representing a source.
* @param Number line
* A line within the given source.
* @param Number column
* A column within the given line.
*/
function GeneratedLocation(actor, line, column, lastColumn) {
function SourceLocation(actor, line, column, lastColumn) {
this._connection = actor ? actor.conn : null;
this._actorID = actor ? actor.actorID : undefined;
this._line = line;
@ -122,66 +122,47 @@ function GeneratedLocation(actor, line, column, lastColumn) {
this._lastColumn = (lastColumn !== undefined) ? lastColumn : column + 1;
}
GeneratedLocation.prototype = {
get originalSourceActor() {
throw new Error();
},
SourceLocation.prototype = {
get originalUrl() {
throw new Error("Shouldn't access originalUrl from a GeneratedLocation");
},
get originalLine() {
throw new Error("Shouldn't access originalLine from a GeneratedLocation");
},
get originalColumn() {
throw new Error("Shouldn't access originalColumn from a GeneratedLocation");
},
get originalName() {
throw new Error("Shouldn't access originalName from a GeneratedLocation");
},
get generatedSourceActor() {
get sourceActor() {
return this._connection ? this._connection.getActor(this._actorID) : null;
},
get generatedUrl() {
return this.generatedSourceActor.url;
get url() {
return this.sourceActor.url;
},
get generatedLine() {
get line() {
return this._line;
},
get generatedColumn() {
get column() {
return this._column;
},
get generatedLastColumn() {
get lastColumn() {
return this._lastColumn;
},
equals: function(other) {
return this.generatedSourceActor.url == other.generatedSourceActor.url &&
this.generatedLine === other.generatedLine &&
(this.generatedColumn === undefined ||
other.generatedColumn === undefined ||
this.generatedColumn === other.generatedColumn);
return this.sourceActor.url == other.sourceActor.url &&
this.line === other.line &&
(this.column === undefined ||
other.column === undefined ||
this.column === other.column);
},
toJSON: function() {
return {
source: this.generatedSourceActor.form(),
line: this.generatedLine,
column: this.generatedColumn,
lastColumn: this.generatedLastColumn,
source: this.sourceActor.form(),
line: this.line,
column: this.column,
lastColumn: this.lastColumn,
};
},
};
exports.GeneratedLocation = GeneratedLocation;
exports.SourceLocation = SourceLocation;
/**
* A method decorator that ensures the actor is in the expected state before

View File

@ -102,11 +102,11 @@ const FrameActor = ActorClassWithSpec(frameSpec, {
form.displayName = formatDisplayName(this.frame);
form.arguments = this._args();
if (this.frame.script) {
const generatedLocation = this.threadActor.sources.getFrameLocation(this.frame);
const location = this.threadActor.sources.getFrameLocation(this.frame);
form.where = {
actor: generatedLocation.generatedSourceActor.actorID,
line: generatedLocation.generatedLine,
column: generatedLocation.generatedColumn,
actor: location.sourceActor.actorID,
line: location.line,
column: location.column,
};
}

View File

@ -517,21 +517,21 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
packet.why = reason;
const {
generatedSourceActor,
generatedLine,
generatedColumn,
sourceActor,
line,
column,
} = this.sources.getFrameLocation(frame);
if (!generatedSourceActor) {
if (!sourceActor) {
// If the frame location is in a source that not pass the 'allowSource'
// check and thus has no actor, we do not bother pausing.
return undefined;
}
packet.frame.where = {
actor: generatedSourceActor.actorID,
line: generatedLine,
column: generatedColumn,
actor: sourceActor.actorID,
line: line,
column: column,
};
const pkt = onPacket(packet);
@ -559,9 +559,9 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
_makeOnEnterFrame: function({ thread, pauseAndRespond }) {
return frame => {
const { generatedSourceActor } = this.sources.getFrameLocation(frame);
const { sourceActor } = this.sources.getFrameLocation(frame);
const url = generatedSourceActor.url;
const url = sourceActor.url;
if (this.sources.isBlackBoxed(url)) {
return undefined;
}
@ -593,10 +593,10 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
_makeOnPop: function({ thread, pauseAndRespond, startLocation, steppingType }) {
const result = function(completion) {
// onPop is called with 'this' set to the current frame.
const generatedLocation = thread.sources.getFrameLocation(this);
const location = thread.sources.getFrameLocation(this);
const { generatedSourceActor } = generatedLocation;
const url = generatedSourceActor.url;
const { sourceActor } = location;
const url = sourceActor.url;
if (thread.sources.isBlackBoxed(url)) {
return undefined;
@ -613,12 +613,12 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
// replaying, as we can't use its contents after resuming.
const ncompletion = thread.dbg.replaying ? null : completion;
const { onStep, onPop } = thread._makeSteppingHooks(
generatedLocation, "next", false, ncompletion
location, "next", false, ncompletion
);
if (thread.dbg.replaying) {
const parentGeneratedLocation = thread.sources.getFrameLocation(parentFrame);
const parentLocation = thread.sources.getFrameLocation(parentFrame);
const offsets =
thread._findReplayingStepOffsets(parentGeneratedLocation, parentFrame,
thread._findReplayingStepOffsets(parentLocation, parentFrame,
/* rewinding = */ false);
parentFrame.setReplayingOnStep(onStep, offsets);
} else {
@ -646,12 +646,12 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
// When stepping out, we don't want to stop at a breakpoint that
// happened to be set exactly at the spot where we stepped out.
// See bug 970469. We record the generated location here and check
// See bug 970469. We record the location here and check
// it when a breakpoint is hit. Furthermore we store this on the
// function because, while we could store it directly on the
// frame, if we did we'd also have to find the appropriate spot to
// clear it.
result.generatedLocation = startLocation;
result.location = startLocation;
return result;
},
@ -664,27 +664,27 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
return false;
}
const generatedLocation = this.sources.getScriptOffsetLocation(script, offset);
const location = this.sources.getScriptOffsetLocation(script, offset);
if (!startLocation || startLocation.generatedUrl !== generatedLocation.generatedUrl) {
if (!startLocation || startLocation.url !== location.url) {
return true;
}
// TODO(logan): When we remove points points, this can be removed too as
// we assert that we're at a different frame offset from the last time
// we paused.
const lineChanged = startLocation.generatedLine !== generatedLocation.generatedLine;
const lineChanged = startLocation.line !== location.line;
const columnChanged =
startLocation.generatedColumn !== generatedLocation.generatedColumn;
startLocation.column !== location.column;
if (!lineChanged && !columnChanged) {
return false;
}
// When pause points are specified for the source,
// we should pause when we are at a stepOver pause point
const pausePoints = generatedLocation.generatedSourceActor.pausePoints;
const pausePoints = location.sourceActor.pausePoints;
const pausePoint = pausePoints &&
findPausePointForLocation(pausePoints, generatedLocation);
findPausePointForLocation(pausePoints, location);
if (pausePoint) {
return pausePoint.step;
@ -698,15 +698,15 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
return function() {
// onStep is called with 'this' set to the current frame.
const generatedLocation = thread.sources.getFrameLocation(this);
const location = thread.sources.getFrameLocation(this);
// Always continue execution if either:
//
// 1. We are in a source mapped region, but inside a null mapping
// (doesn't correlate to any region of generated source)
// (doesn't correlate to any region of source)
// 2. The source we are in is black boxed.
if (generatedLocation.generatedUrl == null
|| thread.sources.isBlackBoxed(generatedLocation.generatedUrl)) {
if (location.url == null
|| thread.sources.isBlackBoxed(location.url)) {
return undefined;
}
@ -838,9 +838,9 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
steppingType = "next";
}
const generatedLocation = this.sources.getFrameLocation(this.youngestFrame);
const location = this.sources.getFrameLocation(this.youngestFrame);
const { onEnterFrame, onPop, onStep } = this._makeSteppingHooks(
generatedLocation,
location,
steppingType,
rewinding
);
@ -859,7 +859,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
if (stepFrame.script) {
if (this.dbg.replaying) {
const offsets =
this._findReplayingStepOffsets(generatedLocation, stepFrame, rewinding);
this._findReplayingStepOffsets(location, stepFrame, rewinding);
stepFrame.setReplayingOnStep(onStep, offsets);
} else {
stepFrame.onStep = onStep;
@ -1480,8 +1480,8 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
onDebuggerStatement: function(frame) {
// Don't pause if we are currently stepping (in or over) or the frame is
// black-boxed.
const { generatedSourceActor } = this.sources.getFrameLocation(frame);
const url = generatedSourceActor ? generatedSourceActor.url : null;
const { sourceActor } = this.sources.getFrameLocation(frame);
const url = sourceActor ? sourceActor.url : null;
if (this.skipBreakpoints || this.sources.isBlackBoxed(url) || frame.onStep) {
return undefined;
@ -1569,8 +1569,8 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
return undefined;
}
const { generatedSourceActor } = this.sources.getFrameLocation(youngestFrame);
const url = generatedSourceActor ? generatedSourceActor.url : null;
const { sourceActor } = this.sources.getFrameLocation(youngestFrame);
const url = sourceActor ? sourceActor.url : null;
// Don't pause on exceptions thrown while inside an evaluation being done on
// behalf of the client.
@ -1772,7 +1772,7 @@ this.reportError = function(error, prefix = "") {
};
function findPausePointForLocation(pausePoints, location) {
const { generatedLine: line, generatedColumn: column } = location;
const { line: line, column: column } = location;
return pausePoints[line] && pausePoints[line][column];
}

View File

@ -7,7 +7,7 @@
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { assert } = DevToolsUtils;
const EventEmitter = require("devtools/shared/event-emitter");
const { GeneratedLocation } = require("devtools/server/actors/common");
const { SourceLocation } = require("devtools/server/actors/common");
loader.lazyRequireGetter(this, "SourceActor", "devtools/server/actors/source", true);
loader.lazyRequireGetter(this, "isEvalSource", "devtools/server/actors/source", true);
@ -323,7 +323,7 @@ TabSources.prototype = {
*/
getScriptOffsetLocation: function(script, offset) {
const {lineNumber, columnNumber} = script.getOffsetMetadata(offset);
return new GeneratedLocation(
return new SourceLocation(
this.createSourceActor(script.source),
lineNumber,
columnNumber
@ -341,7 +341,7 @@ TabSources.prototype = {
*/
getFrameLocation: function(frame) {
if (!frame || !frame.script) {
return new GeneratedLocation();
return new SourceLocation();
}
return this.getScriptOffsetLocation(frame.script, frame.offset);
},

View File

@ -3952,7 +3952,7 @@ nsresult nsDocShell::LoadURI(const nsAString& aURI,
} else {
popupState = PopupBlocker::openOverridden;
}
nsAutoPopupStatePusher statePusher(popupState);
AutoPopupStatePusher statePusher(popupState);
bool forceAllowDataURI = loadFlags & LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
@ -12460,7 +12460,7 @@ class OnLinkClickEvent : public Runnable {
nsIContentSecurityPolicy* aCsp);
NS_IMETHOD Run() override {
nsAutoPopupStatePusher popupStatePusher(mPopupState);
AutoPopupStatePusher popupStatePusher(mPopupState);
// We need to set up an AutoJSAPI here for the following reason: When we
// do OnLinkClickSync we'll eventually end up in

View File

@ -13,7 +13,7 @@
<script type="application/javascript"><![CDATA[
// Global variable that holds a reference to the find bar.
var gFindBar;
// Define the generator-iterator for the tests.
var tests = testIterator();
@ -25,7 +25,7 @@
}
////
// Generator function for test steps for bug 298622:
// Generator function for test steps for bug 298622:
// Find should work correctly on a page loaded from the
// bfcache.
//
@ -33,7 +33,7 @@
{
// Make sure bfcache is on.
enableBFCache(true);
// Load a test page which contains some text to be found.
doPageNavigation({
uri: "data:text/html,<html><head><title>test1</title></head>" +
@ -79,12 +79,12 @@
// before continuing
waitForTrue(function() {
return (
TestWindow.getWindow().getSelection().toString().toLowerCase() ==
TestWindow.getWindow().getSelection().toString().toLowerCase() ==
"a generic page");
}, nextTest, 20);
yield undefined;
is(gFindBar._findField.inputField.value, "A generic page",
is(gFindBar._findField.value, "A generic page",
"expected text not present in find input field");
is(TestWindow.getWindow().getSelection().toString().toLowerCase(),
"a generic page",
@ -103,7 +103,7 @@
yield undefined;
// Search for some text that's on the original page (but not
// the dummy page loaded above), and verify that it can
// the dummy page loaded above), and verify that it can
// be found.
gFindBar = document.getElementById("FindToolbar");
document.getElementById("cmd_find").doCommand();
@ -117,12 +117,12 @@
isnot(gFindBar._findField.getAttribute("status"), "notfound",
"Findfield status attribute should not have been 'notfound'" +
" after Find");
// Make sure the key events above have time to be processed
// before continuing
waitForTrue(function() {
return (
TestWindow.getWindow().getSelection().toString().toLowerCase() ==
TestWindow.getWindow().getSelection().toString().toLowerCase() ==
"find this");
}, nextTest, 20);
yield undefined;
@ -130,11 +130,11 @@
is(TestWindow.getWindow().getSelection().toString().toLowerCase(),
"find this",
"find failed on page loaded from bfcache");
// Tell the framework the test is finished.
finish();
}
]]></script>
<commandset>

View File

@ -444,14 +444,14 @@ void PopupBlocker::ResetLastExternalProtocolIframeAllowed() {
} // namespace dom
} // namespace mozilla
nsAutoPopupStatePusherInternal::nsAutoPopupStatePusherInternal(
AutoPopupStatePusherInternal::AutoPopupStatePusherInternal(
mozilla::dom::PopupBlocker::PopupControlState aState, bool aForce)
: mOldState(
mozilla::dom::PopupBlocker::PushPopupControlState(aState, aForce)) {
mozilla::dom::PopupBlocker::PopupStatePusherCreated();
}
nsAutoPopupStatePusherInternal::~nsAutoPopupStatePusherInternal() {
AutoPopupStatePusherInternal::~AutoPopupStatePusherInternal() {
mozilla::dom::PopupBlocker::PopPopupControlState(mOldState);
mozilla::dom::PopupBlocker::PopupStatePusherDestroyed();
}

View File

@ -72,9 +72,9 @@ class PopupBlocker final {
} // namespace mozilla
#ifdef MOZILLA_INTERNAL_API
# define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherInternal
# define AUTO_POPUP_STATE_PUSHER AutoPopupStatePusherInternal
#else
# define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherExternal
# define AUTO_POPUP_STATE_PUSHER AutoPopupStatePusherExternal
#endif
// Helper class that helps with pushing and popping popup control
@ -82,25 +82,24 @@ class PopupBlocker final {
// part of the layout library than it does in code outside the layout
// library. We give the two object layouts different names so the symbols
// don't conflict, but code should always use the name
// |nsAutoPopupStatePusher|.
class NS_AUTO_POPUP_STATE_PUSHER {
// |AutoPopupStatePusher|.
class MOZ_RAII AUTO_POPUP_STATE_PUSHER final {
public:
#ifdef MOZILLA_INTERNAL_API
explicit NS_AUTO_POPUP_STATE_PUSHER(
explicit AUTO_POPUP_STATE_PUSHER(
mozilla::dom::PopupBlocker::PopupControlState aState,
bool aForce = false);
~NS_AUTO_POPUP_STATE_PUSHER();
~AUTO_POPUP_STATE_PUSHER();
#else
NS_AUTO_POPUP_STATE_PUSHER(
nsPIDOMWindowOuter* aWindow,
mozilla::dom::PopupBlocker::PopupControlState aState)
AUTO_POPUP_STATE_PUSHER(nsPIDOMWindowOuter* aWindow,
mozilla::dom::PopupBlocker::PopupControlState aState)
: mWindow(aWindow), mOldState(openAbused) {
if (aWindow) {
mOldState = PopupBlocker::PushPopupControlState(aState, false);
}
}
~NS_AUTO_POPUP_STATE_PUSHER() {
~AUTO_POPUP_STATE_PUSHER() {
if (mWindow) {
PopupBlocker::PopPopupControlState(mOldState);
}
@ -112,13 +111,8 @@ class NS_AUTO_POPUP_STATE_PUSHER {
nsCOMPtr<nsPIDOMWindowOuter> mWindow;
#endif
mozilla::dom::PopupBlocker::PopupControlState mOldState;
private:
// Hide so that this class can only be stack-allocated
static void* operator new(size_t /*size*/) CPP_THROW_NEW { return nullptr; }
static void operator delete(void* /*memory*/) {}
};
#define nsAutoPopupStatePusher NS_AUTO_POPUP_STATE_PUSHER
#define AutoPopupStatePusher AUTO_POPUP_STATE_PUSHER
#endif // mozilla_PopupBlocker_h

View File

@ -5694,7 +5694,7 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
// eabled the first time a timeout fires that was created while
// popups were enabled and with a delay less than
// "dom.disable_open_click_delay".
nsAutoPopupStatePusher popupStatePusher(timeout->mPopupState);
AutoPopupStatePusher popupStatePusher(timeout->mPopupState);
// Clear the timeout's popup state, if any, to prevent interval
// timeouts from repeatedly opening poups.

View File

@ -2660,7 +2660,7 @@ bool nsGlobalWindowOuter::ConfirmDialogIfNeeded() {
// Reset popup state while opening a modal dialog, and firing events
// about the dialog, to prevent the current state from being active
// the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
bool disableDialog = false;
nsAutoString label, title;
@ -4702,7 +4702,7 @@ bool nsGlobalWindowOuter::AlertOrConfirm(bool aAlert, const nsAString& aMessage,
// Reset popup state while opening a modal dialog, and firing events
// about the dialog, to prevent the current state from being active
// the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
// Before bringing up the window, unsuppress painting and flush
// pending reflows.
@ -4790,7 +4790,7 @@ void nsGlobalWindowOuter::PromptOuter(const nsAString& aMessage,
// Reset popup state while opening a modal dialog, and firing events
// about the dialog, to prevent the current state from being active
// the whole time a modal dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
// Before bringing up the window, unsuppress painting and flush
// pending reflows.
@ -7195,7 +7195,7 @@ nsresult nsGlobalWindowOuter::OpenInternal(
// Reset popup state while opening a window to prevent the
// current state from being active the whole time a modal
// dialog is open.
nsAutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
AutoPopupStatePusher popupStatePusher(PopupBlocker::openAbused, true);
if (!aCalledNoScript) {
// We asserted at the top of this function that aNavigate is true for

View File

@ -249,7 +249,11 @@ nsresult nsLineBreaker::AppendText(nsAtom* aHyphenationLanguage,
if (isSpace || ch == '\n') {
if (offset > wordStart && aSink) {
if (!(aFlags & BREAK_SUPPRESS_INSIDE)) {
if (wordHasComplexChar) {
if (mStrictness == LineBreaker::Strictness::Anywhere) {
memset(breakState.Elements() + wordStart,
gfxTextRun::CompressedGlyph::FLAG_BREAK_TYPE_NORMAL,
offset - wordStart);
} else if (wordHasComplexChar) {
// Save current start-of-word state because GetJISx4051Breaks will
// set it to false
uint8_t currentStart = breakState[wordStart];
@ -407,8 +411,12 @@ nsresult nsLineBreaker::AppendText(nsAtom* aHyphenationLanguage,
mAfterBreakableSpace = isBreakableSpace;
if (isSpace) {
if (offset > wordStart && wordHasComplexChar) {
if (aSink && !(aFlags & BREAK_SUPPRESS_INSIDE)) {
if (offset > wordStart && aSink && !(aFlags & BREAK_SUPPRESS_INSIDE)) {
if (mStrictness == LineBreaker::Strictness::Anywhere) {
memset(breakState.Elements() + wordStart,
gfxTextRun::CompressedGlyph::FLAG_BREAK_TYPE_NORMAL,
offset - wordStart);
} else if (wordHasComplexChar) {
// Save current start-of-word state because GetJISx4051Breaks will
// set it to false
uint8_t currentStart = breakState[wordStart];
@ -417,9 +425,9 @@ nsresult nsLineBreaker::AppendText(nsAtom* aHyphenationLanguage,
mScriptIsChineseOrJapanese, breakState.Elements() + wordStart);
breakState[wordStart] = currentStart;
}
wordHasComplexChar = false;
}
wordHasComplexChar = false;
++offset;
if (offset >= aLength) break;
wordStart = offset;

View File

@ -49,23 +49,6 @@
DOMInterfaces = {
'AbstractWorker': {
'concrete': False
},
'AddonManagerPermissions': {
'wrapperCache': False,
'concrete': False
},
'AnimationEffect': {
'concrete': False
},
'AnimationTimeline': {
'concrete': False
},
'AnonymousContent': {
'wrapperCache': False
},
@ -87,7 +70,6 @@ DOMInterfaces = {
},
'AudioNode' : {
'concrete': False,
'binaryNames': {
'channelCountMode': 'channelCountModeValue',
'channelInterpretation': 'channelInterpretationValue',
@ -115,6 +97,10 @@ DOMInterfaces = {
'headerFile': 'BatteryManager.h'
},
'BrowsingContext': {
'concrete': True,
},
'Cache': {
'implicitJSContext': [ 'add', 'addAll', 'match', 'matchAll', 'put',
'delete', 'keys' ],
@ -143,8 +129,8 @@ DOMInterfaces = {
'nativeType': 'mozilla::extensions::ChannelWrapper',
},
'CharacterData': {
'concrete': False
'Client' : {
'concrete': True,
},
'Clipboard' : {
@ -167,6 +153,10 @@ DOMInterfaces = {
'headerFile': 'nsGeoPosition.h'
},
'Credential' : {
'concrete': True,
},
'Crypto' : {
'headerFile': 'Crypto.h'
},
@ -176,13 +166,11 @@ DOMInterfaces = {
},
'CSSConditionRule': {
'concrete': False,
'nativeType': 'mozilla::css::ConditionRule',
'headerFile': 'mozilla/css/GroupRule.h',
},
'CSSGroupingRule': {
'concrete': False,
'nativeType': 'mozilla::css::GroupRule',
},
@ -191,12 +179,13 @@ DOMInterfaces = {
},
'CSSRule': {
'concrete': False,
'nativeType': 'mozilla::css::Rule'
},
'CSSStyleDeclaration': {
'nativeType': 'nsICSSDeclaration'
'nativeType': 'nsICSSDeclaration',
# Concrete because of the font-face mess.
'concrete': True,
},
'CSSStyleRule': {
@ -257,6 +246,7 @@ DOMInterfaces = {
'DOMRequest': {
'implicitJSContext': [ 'then' ],
'concrete': True,
},
'DOMStringMap': {
@ -273,6 +263,10 @@ DOMInterfaces = {
},
},
'Element': {
'concrete': True,
},
'Event': {
'implicitJSContext': [ 'preventDefault' ],
},
@ -314,6 +308,10 @@ DOMInterfaces = {
'wrapperCache': False,
},
'FileSystemEntry': {
'concrete': True,
},
'FontFaceSet': {
'implicitJSContext': [ 'load' ],
},
@ -354,6 +352,7 @@ DOMInterfaces = {
'nativeType': 'nsIHTMLCollection',
# nsContentList.h pulls in nsIHTMLCollection.h
'headerFile': 'nsContentList.h',
'concrete': True,
},
'HTMLDirectoryElement': {
@ -366,6 +365,7 @@ DOMInterfaces = {
'HTMLDocument': {
'nativeType': 'nsHTMLDocument',
'concrete': True,
},
'HTMLElement': {
@ -380,10 +380,6 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::HTMLSharedElement'
},
'HTMLMediaElement': {
'concrete': False
},
'HTMLOListElement': {
'nativeType' : 'mozilla::dom::HTMLSharedListElement'
},
@ -410,7 +406,8 @@ DOMInterfaces = {
'implicitJSContext': [ 'delete' ],
'binaryNames': {
'direction': 'getDirection'
}
},
'concrete': True,
},
'IDBCursorWithValue': {
@ -436,6 +433,7 @@ DOMInterfaces = {
'IDBKeyRange': {
'wrapperCache': False,
'concrete': True,
},
'IDBLocaleAwareKeyRange': {
@ -454,6 +452,10 @@ DOMInterfaces = {
'headerFile': 'IDBRequest.h'
},
'IDBRequest': {
'concrete': True,
},
'IDBVersionChangeEvent': {
'headerFile': 'IDBEvents.h',
},
@ -488,10 +490,6 @@ DOMInterfaces = {
'binaryNames': { 'constructor': 'ConstructorJS' },
},
'KeyEvent': {
'concrete': False
},
'LegacyMozTCPSocket': {
'headerFile': 'TCPSocket.h',
'wrapperCache': False,
@ -535,18 +533,6 @@ DOMInterfaces = {
'headerFile': 'MediaRecorder.h',
},
'MessageBroadcaster': {
'concrete': False
},
'MessageListenerManager': {
'concrete': False
},
'MessageSender': {
'concrete': False
},
'MimeType': {
'headerFile' : 'nsMimeTypeArray.h',
'nativeType': 'nsMimeType',
@ -577,6 +563,7 @@ DOMInterfaces = {
'MozSharedMap': {
'nativeType': 'mozilla::dom::ipc::SharedMap',
'concrete': True,
},
'MozWritableSharedMap': {
@ -626,7 +613,6 @@ DOMInterfaces = {
'Node': {
'nativeType': 'nsINode',
'concrete': False,
},
'NodeIterator': {
@ -635,6 +621,7 @@ DOMInterfaces = {
'NodeList': {
'nativeType': 'nsINodeList',
'concrete': True,
},
'NotificationEvent': {
@ -666,6 +653,18 @@ DOMInterfaces = {
'wrapperCache': False
},
'PerformanceResourceTiming' : {
'concrete': True,
},
'PlacesBookmark' : {
'concrete': True,
},
'PlacesEvent' : {
'concrete': True,
},
'TransceiverImpl': {
'nativeType': 'mozilla::TransceiverImpl',
'headerFile': 'TransceiverImpl.h',
@ -693,10 +692,6 @@ DOMInterfaces = {
'headerFile': 'nsGeoPosition.h'
},
'PromiseDebugging': {
'concrete': False,
},
'PromiseNativeHandler': {
'wrapperCache': False,
},
@ -839,12 +834,8 @@ DOMInterfaces = {
'headerFile': 'DOMSVGAngle.h'
},
'SVGAnimationElement': {
'concrete': False
},
'SVGComponentTransferFunctionElement': {
'concrete': False,
'SVGElement': {
'concrete': True,
},
'SVGFEFuncAElement': {
@ -863,14 +854,6 @@ DOMInterfaces = {
'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
},
'SVGGraphicsElement': {
'concrete': False,
},
'SVGGradientElement': {
'concrete': False,
},
'SVGLength': {
'nativeType': 'mozilla::dom::DOMSVGLength',
'headerFile': 'DOMSVGLength.h'
@ -898,7 +881,6 @@ DOMInterfaces = {
'SVGPathSeg': {
'nativeType': 'mozilla::DOMSVGPathSeg',
'headerFile': 'DOMSVGPathSeg.h',
'concrete': False,
},
'SVGPathSegClosePath': {
@ -1029,14 +1011,6 @@ DOMInterfaces = {
'headerFile': 'DOMSVGStringList.h',
},
'SVGTextContentElement': {
'concrete': False
},
'SVGTextPositioningElement': {
'concrete': False
},
'SVGTransform': {
'nativeType': 'mozilla::dom::DOMSVGTransform',
'headerFile': 'DOMSVGTransform.h',
@ -1051,14 +1025,13 @@ DOMInterfaces = {
},
'SVGUnitTypes' : {
# Maybe should be a namespace.
'concrete': False,
},
'SVGZoomAndPan' : {
'concrete': False,
},
'SyncMessageSender' : {
# Part of a kinda complicated legacy setup for putting some constants on
# both interfaces and this thing, which ideally should be a namespace.
'concrete': False,
},
@ -1528,8 +1501,6 @@ DOMInterfaces = {
'WebrtcGlobalInformation': {
'nativeType': 'mozilla::dom::WebrtcGlobalInformation',
'headerFile': 'WebrtcGlobalInformation.h',
'wrapperCache': False,
'concrete': False,
},
'Window': {
@ -1563,7 +1534,6 @@ DOMInterfaces = {
'WorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
'implicitJSContext': [ 'createImageBitmap', 'importScripts' ],
'concrete': False,
# Rename a few things so we don't have both classes and methods
# with the same name
'binaryNames': {
@ -1571,12 +1541,13 @@ DOMInterfaces = {
},
},
'XMLHttpRequest': {
'implicitJSContext': [ 'send'],
'Worklet': {
# Paint worklets just use the Worklet interface.
'concrete': True,
},
'XMLHttpRequestEventTarget': {
'concrete': False
'XMLHttpRequest': {
'implicitJSContext': [ 'send'],
},
'XMLSerializer': {
@ -1585,7 +1556,8 @@ DOMInterfaces = {
},
'XPathEvaluator': {
'wrapperCache': False
'wrapperCache': False,
'concrete': True,
},
'XPathExpression': {
@ -1705,7 +1677,6 @@ DOMInterfaces = {
'headerFile': 'TestBindingHeader.h',
'register': False,
'castable': False,
'concrete': False
},
'OnlyForUseInConstructor' : {
@ -1715,43 +1686,36 @@ DOMInterfaces = {
'ImplementedInterface' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False,
},
'ImplementedInterfaceParent' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False
},
'DiamondImplements' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False
},
'DiamondBranch1A' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False
},
'DiamondBranch1B' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False
},
'DiamondBranch2A' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False
},
'DiamondBranch2B' : {
'headerFile': 'TestBindingHeader.h',
'concrete': False,
'register': False
},

View File

@ -15473,20 +15473,21 @@ class CGBindingImplClass(CGClass):
[]),
{"infallible": True}))
wrapArgs = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aGivenProto')]
if not descriptor.wrapperCache:
wrapReturnType = "bool"
wrapArgs.append(Argument('JS::MutableHandle<JSObject*>',
'aReflector'))
else:
wrapReturnType = "JSObject*"
self.methodDecls.insert(0,
ClassMethod(wrapMethodName, wrapReturnType,
wrapArgs, virtual=descriptor.wrapperCache,
breakAfterReturnDecl=" ",
override=descriptor.wrapperCache,
body=self.getWrapObjectBody()))
if descriptor.concrete:
wrapArgs = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aGivenProto')]
if not descriptor.wrapperCache:
wrapReturnType = "bool"
wrapArgs.append(Argument('JS::MutableHandle<JSObject*>',
'aReflector'))
else:
wrapReturnType = "JSObject*"
self.methodDecls.insert(0,
ClassMethod(wrapMethodName, wrapReturnType,
wrapArgs, virtual=descriptor.wrapperCache,
breakAfterReturnDecl=" ",
override=descriptor.wrapperCache,
body=self.getWrapObjectBody()))
if descriptor.hasCEReactions():
self.methodDecls.insert(0,
ClassMethod("GetDocGroup", "DocGroup*", [],
@ -15570,7 +15571,9 @@ class CGExampleClass(CGBindingImplClass):
def define(self):
# Just override CGClass and do our own thing
ctordtor = dedent("""
nativeType = self.nativeLeafName(self.descriptor)
ctordtor = fill("""
${nativeType}::${nativeType}()
{
// Add |MOZ_COUNT_CTOR(${nativeType});| for a non-refcounted object.
@ -15580,10 +15583,11 @@ class CGExampleClass(CGBindingImplClass):
{
// Add |MOZ_COUNT_DTOR(${nativeType});| for a non-refcounted object.
}
""")
""",
nativeType=nativeType)
if self.parentIface:
ccImpl = dedent("""
ccImpl = fill("""
// Only needed for refcounted objects.
# error "If you don't have members that need cycle collection,
@ -15596,9 +15600,11 @@ class CGExampleClass(CGBindingImplClass):
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(${nativeType})
NS_INTERFACE_MAP_END_INHERITING(${parentType})
""")
""",
nativeType=nativeType,
parentType=self.nativeLeafName(self.parentDesc))
else:
ccImpl = dedent("""
ccImpl = fill("""
// Only needed for refcounted objects.
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(${nativeType})
@ -15609,31 +15615,35 @@ class CGExampleClass(CGBindingImplClass):
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
""")
""",
nativeType=nativeType)
if self.descriptor.wrapperCache:
reflectorArg = ""
reflectorPassArg = ""
returnType = "JSObject*"
else:
reflectorArg = ", JS::MutableHandle<JSObject*> aReflector"
reflectorPassArg = ", aReflector"
returnType = "bool"
classImpl = ccImpl + ctordtor + "\n" + dedent("""
${returnType}
${nativeType}::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto${reflectorArg})
{
return ${ifaceName}_Binding::Wrap(aCx, this, aGivenProto${reflectorPassArg});
}
classImpl = ccImpl + ctordtor + "\n"
if self.descriptor.concrete:
if self.descriptor.wrapperCache:
reflectorArg = ""
reflectorPassArg = ""
returnType = "JSObject*"
else:
reflectorArg = ", JS::MutableHandle<JSObject*> aReflector"
reflectorPassArg = ", aReflector"
returnType = "bool"
classImpl += fill(
"""
${returnType}
${nativeType}::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto${reflectorArg})
{
return ${ifaceName}_Binding::Wrap(aCx, this, aGivenProto${reflectorPassArg});
}
""")
return string.Template(classImpl).substitute(
ifaceName=self.descriptor.name,
nativeType=self.nativeLeafName(self.descriptor),
parentType=self.nativeLeafName(self.parentDesc) if self.parentIface else "",
returnType=returnType,
reflectorArg=reflectorArg,
reflectorPassArg=reflectorPassArg)
""",
returnType=returnType,
nativeType=nativeType,
reflectorArg=reflectorArg,
ifaceName=self.descriptor.name,
reflectorPassArg=reflectorPassArg)
return classImpl
@staticmethod
def nativeLeafName(descriptor):

View File

@ -401,10 +401,21 @@ class Descriptor(DescriptorProvider):
# If we're concrete, we need to crawl our ancestor interfaces and mark
# them as having a concrete descendant.
self.concrete = (not self.interface.isExternal() and
not self.interface.isCallback() and
not self.interface.isNamespace() and
desc.get('concrete', True))
concreteDefault = (not self.interface.isExternal() and
not self.interface.isCallback() and
# Exclude interfaces that are used as the RHS of
# "implements", because those would typically not be
# concrete.
not self.interface.isConsequential() and
not self.interface.isNamespace() and
# We're going to assume that leaf interfaces are
# concrete; otherwise what's the point? Also
# interfaces with constructors had better be
# concrete; otherwise how can you construct them?
(not self.interface.hasChildInterfaces() or
self.interface.ctor() is not None))
self.concrete = desc.get('concrete', concreteDefault)
self.hasUnforgeableMembers = (self.concrete and
any(MemberIsUnforgeable(m, self) for m in
self.interface.members))
@ -730,7 +741,7 @@ class Descriptor(DescriptorProvider):
def isMaybeCrossOriginObject(self):
# If we're isGlobal and have cross-origin members, we're a Window, and
# that's not a cross-origin object. The WindowProxy is.
return self.hasCrossOriginMembers and not self.isGlobal()
return self.concrete and self.hasCrossOriginMembers and not self.isGlobal()
def needsHeaderInclude(self):
"""

View File

@ -1809,7 +1809,9 @@ class IDLNamespace(IDLInterfaceOrNamespace):
if not attr.noArguments():
raise WebIDLError("[%s] must not have arguments" % identifier,
[attr.location])
elif identifier == "Pref" or identifier == "Func":
elif (identifier == "Pref" or
identifier == "HeaderFile" or
identifier == "Func"):
# Known extended attributes that take a string value
if not attr.hasValue():
raise WebIDLError("[%s] must have a value" % identifier,

View File

@ -51,7 +51,7 @@ callback interface UncaughtRejectionObserver {
};
[ChromeOnly, Exposed=Window]
interface PromiseDebugging {
namespace PromiseDebugging {
/**
* The various functions on this interface all expect to take promises but
* don't want the WebIDL behavior of assimilating random passed-in objects
@ -65,21 +65,21 @@ interface PromiseDebugging {
* Get the current state of the given promise.
*/
[Throws]
static PromiseDebuggingStateHolder getState(object p);
PromiseDebuggingStateHolder getState(object p);
/**
* Return an identifier for a promise. This identifier is guaranteed
* to be unique to the current process.
*/
[Throws]
static DOMString getPromiseID(object p);
DOMString getPromiseID(object p);
/**
* Return the stack to the promise's allocation point. This can
* return null if the promise was not created from script.
*/
[Throws]
static object? getAllocationStack(object p);
object? getAllocationStack(object p);
/**
* Return the stack to the promise's rejection point, if the
@ -87,7 +87,7 @@ interface PromiseDebugging {
* promise has not been rejected or was not rejected from script.
*/
[Throws]
static object? getRejectionStack(object p);
object? getRejectionStack(object p);
/**
* Return the stack to the promise's fulfillment point, if the
@ -95,7 +95,7 @@ interface PromiseDebugging {
* promise has not been fulfilled or was not fulfilled from script.
*/
[Throws]
static object? getFullfillmentStack(object p);
object? getFullfillmentStack(object p);
/**
* Watching uncaught rejections on the current thread.
@ -103,6 +103,6 @@ interface PromiseDebugging {
* Adding an observer twice will cause it to be notified twice
* of events.
*/
static void addUncaughtRejectionObserver(UncaughtRejectionObserver o);
static boolean removeUncaughtRejectionObserver(UncaughtRejectionObserver o);
void addUncaughtRejectionObserver(UncaughtRejectionObserver o);
boolean removeUncaughtRejectionObserver(UncaughtRejectionObserver o);
};

View File

@ -1141,7 +1141,7 @@ void EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
aEvent->PreventDefault();
}
Maybe<nsAutoPopupStatePusher> popupStatePusher;
Maybe<AutoPopupStatePusher> popupStatePusher;
if (mIsMainThreadELM) {
popupStatePusher.emplace(
PopupBlocker::GetEventPopupControlState(aEvent, *aDOMEvent));

View File

@ -695,7 +695,7 @@ nsresult HTMLFormElement::SubmitSubmission(
nsCOMPtr<nsIDocShell> docShell;
{
nsAutoPopupStatePusher popupStatePusher(mSubmitPopupState);
AutoPopupStatePusher popupStatePusher(mSubmitPopupState);
AutoHandlingUserInputStatePusher userInpStatePusher(
aFormSubmission->IsInitiatedFromUserInput(), nullptr, doc);

View File

@ -194,7 +194,7 @@ bool HTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
WidgetMouseEvent::eReal);
event.mInputSource = MouseEvent_Binding::MOZ_SOURCE_KEYBOARD;
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
aIsTrustedEvent ? PopupBlocker::openAllowed : PopupBlocker::openAbused);
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,

View File

@ -240,40 +240,39 @@ void TextTrackManager::UpdateCueDisplay() {
mUpdateCueDisplayDispatched = false;
if (!mMediaElement || !mTextTracks || IsShutdown()) {
WEBVTT_LOG("Abort UpdateCueDisplay.");
return;
}
nsIFrame* frame = mMediaElement->GetPrimaryFrame();
nsVideoFrame* videoFrame = do_QueryFrame(frame);
if (!videoFrame) {
WEBVTT_LOG("Abort UpdateCueDisplay, because of no video frame.");
return;
}
nsCOMPtr<nsIContent> overlay = videoFrame->GetCaptionOverlay();
nsCOMPtr<nsIContent> controls = videoFrame->GetVideoControls();
if (!overlay) {
WEBVTT_LOG("Abort UpdateCueDisplay, because of no overlay.");
return;
}
nsPIDOMWindowInner* window = mMediaElement->OwnerDoc()->GetInnerWindow();
if (!window) {
WEBVTT_LOG("Abort UpdateCueDisplay, because of no window.");
}
nsTArray<RefPtr<TextTrackCue>> showingCues;
mTextTracks->GetShowingCues(showingCues);
if (showingCues.Length() > 0) {
WEBVTT_LOG("UpdateCueDisplay, processCues, showingCuesNum=%zu",
showingCues.Length());
RefPtr<nsVariantCC> jsCues = new nsVariantCC();
jsCues->SetAsArray(nsIDataType::VTYPE_INTERFACE, &NS_GET_IID(EventTarget),
showingCues.Length(),
static_cast<void*>(showingCues.Elements()));
nsPIDOMWindowInner* window = mMediaElement->OwnerDoc()->GetInnerWindow();
if (window) {
sParserWrapper->ProcessCues(window, jsCues, overlay, controls);
}
} else if (overlay->Length() > 0) {
WEBVTT_LOG("UpdateCueDisplay EmptyString");
nsContentUtils::SetNodeTextContent(overlay, EmptyString(), true);
}
WEBVTT_LOG("UpdateCueDisplay, processCues, showingCuesNum=%zu",
showingCues.Length());
RefPtr<nsVariantCC> jsCues = new nsVariantCC();
jsCues->SetAsArray(nsIDataType::VTYPE_INTERFACE, &NS_GET_IID(EventTarget),
showingCues.Length(),
static_cast<void*>(showingCues.Elements()));
nsCOMPtr<nsIContent> controls = videoFrame->GetVideoControls();
sParserWrapper->ProcessCues(window, jsCues, overlay, controls);
}
void TextTrackManager::NotifyCueAdded(TextTrackCue& aCue) {

View File

@ -2343,7 +2343,7 @@ bool nsGenericHTMLElement::PerformAccesskey(bool aKeyCausesActivation,
if (aKeyCausesActivation) {
// Click on it if the users prefs indicate to do so.
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
aIsTrustedEvent ? PopupBlocker::openAllowed : PopupBlocker::openAbused);
DispatchSimulatedClick(this, aIsTrustedEvent, presContext);
}

View File

@ -217,7 +217,7 @@ nsresult nsJSThunk::EvaluateScript(
}
// Push our popup control state
nsAutoPopupStatePusher popupStatePusher(aPopupState);
AutoPopupStatePusher popupStatePusher(aPopupState);
// Make sure we still have the same inner window as we used to.
nsCOMPtr<nsPIDOMWindowOuter> win = do_QueryInterface(global);

View File

@ -6,6 +6,7 @@
# include <mozilla/Unused.h>
# include <mozilla/Atomics.h>
# include <mozilla/DebugOnly.h>
# include <mozilla/Sprintf.h>
# include <ByteWriter.h>
/**

View File

@ -1269,6 +1269,9 @@ tags = webvtt
[test_webvtt_update_display_after_adding_or_removing_cue.html]
skip-if = android_version == '22' # android(bug 1368010)
tags = webvtt
[test_webvtt_overlapping_time.html]
skip-if = android_version == '22' # android(bug 1368010)
tags = webvtt
[test_webvtt_positionalign.html]
skip-if = android_version == '22' # android(bug 1368010)
tags = webvtt

View File

@ -0,0 +1,7 @@
WEBVTT FILE
00:00:00.000 --> 00:00:01.000
First cue
00:00:00.000 --> 00:00:04.000
Second cue

View File

@ -3,3 +3,4 @@ skip-if(Android) fuzzy-if(OSX,0-60,0-76797) fuzzy-if(winWidget,0-60,0-76797) fuz
skip-if(Android) skip-if(winWidget) fuzzy-if(gtkWidget&&layersGPUAccelerated,0-55,0-4281) fuzzy-if(OSX,55-55,4173-4173) HTTP(..) == bipbop_300_215kbps.mp4.lastframe.html bipbop_300_215kbps.mp4.lastframe-ref.html
skip-if(Android) fuzzy-if(OSX,0-25,0-175921) fuzzy-if(winWidget,0-71,0-179198) fuzzy-if((/^Windows\x20NT\x2010\.0/.test(http.oscpu))&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)),0-255,0-179500) HTTP(..) == gizmo.mp4.seek.html gizmo.mp4.55thframe-ref.html
skip-if(Android) fuzzy-if((/^Windows\x20NT\x2010\.0/.test(http.oscpu))&&(/^aarch64-msvc/.test(xulRuntime.XPCOMABI)),0-136,0-427680) == vtt_update_display_after_removed_cue.html vtt_update_display_after_removed_cue_ref.html
skip-if(Android) fuzzy-if(winWidget,0-170,0-170) == vtt_overlapping_time.html vtt_overlapping_time-ref.html

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
</head>
<body>
<video id="v1" src="../black.mp4" width="320" height="180">
<track label="English" src="cues_time_overlapping.webvtt" default>
</video>
<script type="text/javascript">
/**
* This test is to ensure that when cues with overlapping times, the one with
* earlier end timestamp should disappear when the media time reaches its
* end time. This vtt file contains two cues, the first cue is [0,1], the second
* cue is [0,4], so if we seek video to 2s, only cue2 should be displayed.
*/
async function testTimeOverlappingCues() {
const video = document.getElementById("v1");
video.currentTime = 2;
video.onseeked = () => {
video.onseeked = null;
document.documentElement.removeAttribute('class');
}
};
window.addEventListener("MozReftestInvalidate",
testTimeOverlappingCues);
</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE HTML>
<html class="reftest-wait">
<head>
</head>
<body>
<video id="v1" src="../black.mp4" autoplay width="320" height="180">
<track label="English" src="cues_time_overlapping.webvtt" default>
</video>
<script type="text/javascript">
/**
* This test is to ensure that when cues with overlapping times, the one with
* earlier end timestamp should disappear when the media time reaches its
* end time. This vtt file contains two cues, the first cue is [0,1], the second
* cue is [0,4], so after video is playing over 1s, only cue2 should be displayed.
*/
async function testTimeOverlappingCues() {
const video = document.getElementById("v1");
video.ontimeupdate = () => {
if (video.currentTime > 1.0) {
document.documentElement.removeAttribute('class');
video.ontimeupdate = null;
}
}
};
window.addEventListener("MozReftestInvalidate",
testTimeOverlappingCues);
</script>
</body>
</html>

View File

@ -0,0 +1,100 @@
<!DOCTYPE HTML>
<html>
<head>
<title>WebVTT : cues with overlapping time should be displayed correctly </title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="manifest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<video id ="v" src="gizmo.mp4" controls>
<script class="testbody" type="text/javascript">
/**
* This test is used to ensure that when cues with overlapping times, the one
* with earlier end timestamp should disappear when the media time reaches its
* end time. In this test, we have two cues with overlapping time, when the video
* starts, both cues should be displayed. When the time passes 1 seconds, the
* first cue should disappear and the second cues should be still displayed.
*/
var CUES_INFO = [
{ id: 0, startTime: 0, endTime: 1, text: "This is cue 0."},
{ id: 1, startTime: 0, endTime: 6, text: "This is cue 1."},
];
var video = document.getElementById("v");
async function startTest() {
const cues = createCues();
await startVideo();
await waitUntilCueIsShowing(cues[0]);
await waitUntilCueIsShowing(cues[1]);
await waitUntilCueIsHiding(cues[0]);
await waitUntilCueIsShowing(cues[1]);
IsVideoStillPlaying();
endTestAndClearVideo();
}
SimpleTest.waitForExplicitFinish();
onload = startTest;
/**
* The following are test helper functions.
*/
function createCues() {
let track = video.addTextTrack("subtitles");
track.mode = "showing";
let cue0 = new VTTCue(CUES_INFO[0].startTime, CUES_INFO[0].endTime,
CUES_INFO[0].text);
cue0.id = CUES_INFO[0].id;
let cue1 = new VTTCue(CUES_INFO[1].startTime, CUES_INFO[1].endTime,
CUES_INFO[1].text);
cue1.id = CUES_INFO[1].id;
track.addCue(cue0);
track.addCue(cue1);
// Convert them to chrome objects in order to use chrome privilege APIs.
cue0 = SpecialPowers.wrap(cue0);
cue1 = SpecialPowers.wrap(cue1);
return [cue0, cue1];
}
async function startVideo() {
info(`start play video`);
const played = video && await video.play().then(() => true, () => false);
ok(played, "video has started playing");
}
async function waitUntilCueIsShowing(cue) {
info(`wait until cue ${cue.id} is showing`);
// cue has not been showing yet.
if (!cue.getActive) {
await once(cue, "enter");
}
info(`video current time=${video.currentTime}`);
ok(cue.getActive, `cue ${cue.id} is showing`);
}
async function waitUntilCueIsHiding(cue) {
info(`wait until cue ${cue.id} is hiding`);
// cue has not been hidden yet.
if (cue.getActive) {
await once(cue, "exit");
}
info(`video current time=${video.currentTime}`);
ok(!cue.getActive, `cue ${cue.id} is hidding`);
}
function IsVideoStillPlaying() {
ok(!video.paused, `video is still playing, currentTime=${video.currentTime}`);
}
function endTestAndClearVideo() {
removeNodeAndSource(video);
SimpleTest.finish();
}
</script>
</body>
</html>

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AudioScheduledSourceNode.h"
#include "mozilla/dom/AudioScheduledSourceNodeBinding.h"
namespace mozilla {
namespace dom {
@ -16,11 +15,5 @@ AudioScheduledSourceNode::AudioScheduledSourceNode(
ChannelInterpretation aChannelInterpretation)
: AudioNode(aContext, aChannelCount, aChannelCountMode,
aChannelInterpretation) {}
JSObject* AudioScheduledSourceNode::WrapObject(
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
return AudioScheduledSourceNode_Binding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

View File

@ -17,9 +17,6 @@ class AudioContext;
class AudioScheduledSourceNode : public AudioNode {
public:
JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
virtual void Start(double aWhen, ErrorResult& aRv) = 0;
virtual void Stop(double aWhen, ErrorResult& aRv) = 0;

View File

@ -1084,14 +1084,29 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "supportPseudo",
return parseContent(window, cuetext, PARSE_CONTENT_MODE.DOCUMENT_FRAGMENT);
};
function clearAllCuesDiv(overlay) {
while (overlay.firstChild) {
overlay.firstChild.remove();
}
}
// It's used to record how many cues we process in the last `processCues` run.
var lastDisplayedCueNums = 0;
// Runs the processing model over the cues and regions passed to it.
// @param overlay A block level element (usually a div) that the computed cues
// Spec https://www.w3.org/TR/webvtt1/#processing-model
// @parem window : JS window
// @param cues : the VTT cues are going to be displayed.
// @param overlay : A block level element (usually a div) that the computed cues
// and regions will be placed into.
// @param controls A Control bar element. Cues' position will be
// @param controls : A Control bar element. Cues' position will be
// affected and repositioned according to it.
WebVTT.processCues = function(window, cues, overlay, controls) {
if (!window || !cues || !overlay) {
return null;
if (!cues) {
LOG(`Abort processing because no cue.`);
clearAllCuesDiv(overlay);
lastDisplayedCueNums = 0;
return;
}
let controlBar, controlBarShown;
@ -1107,8 +1122,12 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "supportPseudo",
// Determine if we need to compute the display states of the cues. This could
// be the case if a cue's state has been changed since the last computation or
// if it has not been computed yet.
// if it has not been computed yet, or the displayed cues number changes.
function shouldCompute(cues) {
if (lastDisplayedCueNums != cues.length) {
return true;
}
if (overlay.lastControlBarShownStatus != controlBarShown) {
return true;
}
@ -1123,14 +1142,12 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "supportPseudo",
// We don't need to recompute the cues' display states. Just reuse them.
if (!shouldCompute(cues)) {
LOG(`Abort processing because no need to compute cues' display state.`);
return;
}
overlay.lastControlBarShownStatus = controlBarShown;
// Remove all previous children.
while (overlay.firstChild) {
overlay.firstChild.remove();
}
clearAllCuesDiv(overlay);
let rootOfCues = window.document.createElement("div");
rootOfCues.style.position = "absolute";
rootOfCues.style.left = "0";
@ -1154,8 +1171,9 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "supportPseudo",
let regionNodeBoxes = {};
let regionNodeBox;
LOG(`=== processCues ===`);
LOG(`=== processCues, ` +
`lastDisplayedCueNums=${lastDisplayedCueNums}, currentCueNums=${cues.length} ===`);
lastDisplayedCueNums = cues.length;
for (let i = 0; i < cues.length; i++) {
cue = cues[i];
if (cue.region != null) {

View File

@ -73,11 +73,6 @@ bool MIDIPort::Initialize(const MIDIPortInfo& aPortInfo, bool aSysexEnabled) {
void MIDIPort::UnsetIPCPort() { mPort = nullptr; }
JSObject* MIDIPort::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return MIDIPort_Binding::Wrap(aCx, this, aGivenProto);
}
void MIDIPort::GetId(nsString& aRetVal) const {
MOZ_ASSERT(mPort);
aRetVal = mPort->MIDIPortInterface::Id();

View File

@ -13,7 +13,6 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/MIDIAccess.h"
#include "mozilla/dom/MIDIPortBinding.h"
#include "mozilla/dom/MIDIPortInterface.h"
struct JSContext;
@ -47,9 +46,6 @@ class MIDIPort : public DOMEventTargetHelper,
public:
nsPIDOMWindowInner* GetParentObject() const { return GetOwner(); }
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
// Getters
void GetId(nsString& aRetVal) const;
void GetManufacturer(nsString& aRetVal) const;

View File

@ -6,7 +6,6 @@
#include "PerformanceEntry.h"
#include "MainThreadUtils.h"
#include "mozilla/dom/PerformanceEntryBinding.h"
#include "nsIURI.h"
using namespace mozilla::dom;
@ -27,11 +26,6 @@ PerformanceEntry::PerformanceEntry(nsISupports* aParent, const nsAString& aName,
PerformanceEntry::~PerformanceEntry() {}
JSObject* PerformanceEntry::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return mozilla::dom::PerformanceEntry_Binding::Wrap(aCx, this, aGivenProto);
}
size_t PerformanceEntry::SizeOfExcludingThis(
mozilla::MallocSizeOf aMallocSizeOf) const {
return mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +

View File

@ -29,9 +29,6 @@ class PerformanceEntry : public nsISupports, public nsWrapperCache {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PerformanceEntry)
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
nsISupports* GetParentObject() const { return mParent; }
void GetName(nsAString& aName) const { aName = mName; }

View File

@ -427,7 +427,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL(
int32_t blockPopups =
Preferences::GetInt("privacy.popups.disable_from_plugins");
nsAutoPopupStatePusher popupStatePusher(
AutoPopupStatePusher popupStatePusher(
(PopupBlocker::PopupControlState)blockPopups);
// if security checks (in particular CheckLoadURIWithPrincipal) needs

View File

@ -5,6 +5,7 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/WeakPtr.h"
#include "windows.h"
#include "windowsx.h"
@ -21,7 +22,6 @@
#include "nsWindowsDllInterceptor.h"
#include "nsPluginNativeWindow.h"
#include "nsThreadUtils.h"
#include "nsTWeakRef.h"
#include "nsCrashOnException.h"
using namespace mozilla;
@ -40,7 +40,7 @@ using namespace mozilla;
#define WM_USER_FLASH WM_USER + 1
static UINT sWM_FLASHBOUNCEMSG = 0;
typedef nsTWeakRef<class nsPluginNativeWindowWin> PluginWindowWeakRef;
class nsPluginNativeWindowWin;
/**
* PLEvent handling code
@ -48,8 +48,8 @@ typedef nsTWeakRef<class nsPluginNativeWindowWin> PluginWindowWeakRef;
class PluginWindowEvent : public Runnable {
public:
PluginWindowEvent();
void Init(const PluginWindowWeakRef& ref, HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam);
void Init(WeakPtr<nsPluginNativeWindowWin> aRef, HWND aWnd, UINT aMsg,
WPARAM aParam, LPARAM aLParam);
void Clear();
HWND GetWnd() { return mWnd; };
UINT GetMsg() { return mMsg; };
@ -60,7 +60,7 @@ class PluginWindowEvent : public Runnable {
NS_DECL_NSIRUNNABLE
protected:
PluginWindowWeakRef mPluginWindowRef;
WeakPtr<nsPluginNativeWindowWin> mPluginWindowRef;
HWND mWnd;
UINT mMsg;
WPARAM mWParam;
@ -78,11 +78,11 @@ void PluginWindowEvent::Clear() {
mLParam = 0;
}
void PluginWindowEvent::Init(const PluginWindowWeakRef& ref, HWND aWnd,
void PluginWindowEvent::Init(WeakPtr<nsPluginNativeWindowWin> aRef, HWND aWnd,
UINT aMsg, WPARAM aWParam, LPARAM aLParam) {
NS_ASSERTION(aWnd != nullptr, "invalid plugin event value");
NS_ASSERTION(mWnd == nullptr, "event already in use");
mPluginWindowRef = ref;
mPluginWindowRef = aRef;
mWnd = aWnd;
mMsg = aMsg;
mWParam = aWParam;
@ -93,10 +93,12 @@ void PluginWindowEvent::Init(const PluginWindowWeakRef& ref, HWND aWnd,
* nsPluginNativeWindow Windows specific class declaration
*/
class nsPluginNativeWindowWin : public nsPluginNativeWindow {
class nsPluginNativeWindowWin
: public nsPluginNativeWindow,
public SupportsWeakPtr<nsPluginNativeWindowWin> {
public:
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(nsPluginNativeWindowWin)
nsPluginNativeWindowWin();
virtual ~nsPluginNativeWindowWin();
virtual nsresult CallSetWindow(
RefPtr<nsNPAPIPluginInstance>& aPluginInstance);
@ -116,7 +118,7 @@ class nsPluginNativeWindowWin : public nsPluginNativeWindow {
private:
WNDPROC mPluginWinProc;
WNDPROC mPrevWinProc;
PluginWindowWeakRef mWeakRef;
WeakPtr<nsPluginNativeWindowWin> mWeakRef;
RefPtr<PluginWindowEvent> mCachedPluginWindowEvent;
HWND mParentWnd;
@ -458,18 +460,12 @@ nsPluginNativeWindowWin::nsPluginNativeWindowWin() : nsPluginNativeWindow() {
}
}
nsPluginNativeWindowWin::~nsPluginNativeWindowWin() {
// clear weak reference to self to prevent any pending events from
// dereferencing this.
mWeakRef.forget();
}
WNDPROC nsPluginNativeWindowWin::GetPrevWindowProc() { return mPrevWinProc; }
WNDPROC nsPluginNativeWindowWin::GetWindowProc() { return mPluginWinProc; }
NS_IMETHODIMP PluginWindowEvent::Run() {
nsPluginNativeWindowWin* win = mPluginWindowRef.get();
nsPluginNativeWindowWin* win = mPluginWindowRef;
if (!win) return NS_OK;
HWND hWnd = GetWnd();

View File

@ -9,7 +9,7 @@ support-files =
[browser_bug1163570.js]
skip-if = true # Bug 1249878
[browser_bug1196539.js]
skip-if = (!e10s || os != "win")
skip-if = (!e10s || os != "win" || webrender) # plugin painting test doesn't work with WR
[browser_tabswitchbetweenplugins.js]
skip-if = true #Bug 1538425
[browser_pluginscroll.js]

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/ReportBody.h"
#include "mozilla/dom/ReportingBinding.h"
#include "nsPIDOMWindow.h"
namespace mozilla {
@ -26,10 +25,5 @@ ReportBody::ReportBody(nsPIDOMWindowInner* aWindow) : mWindow(aWindow) {
ReportBody::~ReportBody() = default;
JSObject* ReportBody::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return ReportBody_Binding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla

View File

@ -27,9 +27,6 @@ class ReportBody : public nsISupports, public nsWrapperCache {
explicit ReportBody(nsPIDOMWindowInner* aWindow);
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
virtual void ToJSON(JSONWriter& aJSONWriter) const = 0;

View File

@ -8,6 +8,7 @@
#include "SVGCircleElement.h"
#include "SVGEllipseElement.h"
#include "SVGForeignObjectElement.h"
#include "SVGImageElement.h"
#include "SVGRectElement.h"
namespace mozilla {
@ -63,6 +64,9 @@ nsCSSPropertyID AttrEnumToCSSPropId(const SVGElement* aElement,
if (aElement->IsSVGElement(nsGkAtoms::ellipse)) {
return SVGEllipseElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
if (aElement->IsSVGElement(nsGkAtoms::image)) {
return SVGImageElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
if (aElement->IsSVGElement(nsGkAtoms::foreignObject)) {
return SVGForeignObjectElement::GetCSSPropertyIdForAttrEnum(aAttrEnum);
}
@ -79,6 +83,7 @@ bool ElementMapsLengthsToStyle(SVGElement const* aElement) {
return aElement->IsSVGElement(nsGkAtoms::rect) ||
aElement->IsSVGElement(nsGkAtoms::circle) ||
aElement->IsSVGElement(nsGkAtoms::ellipse) ||
aElement->IsSVGElement(nsGkAtoms::image) ||
aElement->IsSVGElement(nsGkAtoms::foreignObject);
}

View File

@ -8,9 +8,11 @@
#define mozilla_dom_SVGGeometryProperty_SVGGeometryProperty_h
#include "mozilla/dom/SVGElement.h"
#include "SVGAnimatedLength.h"
#include "ComputedStyle.h"
#include "SVGAnimatedLength.h"
#include "nsGkAtoms.h"
#include "nsIFrame.h"
#include "nsSVGImageFrame.h"
#include <type_traits>
namespace mozilla {
@ -38,13 +40,25 @@ SVGGEOMETRYPROPERTY_GENERATETAG(Y, LengthPercentNoAuto, Y, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Cx, LengthPercentNoAuto, X, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Cy, LengthPercentNoAuto, Y, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(R, LengthPercentNoAuto, XY, nsStyleSVGReset);
SVGGEOMETRYPROPERTY_GENERATETAG(Width, LengthPercentWidthHeight, X,
nsStylePosition);
SVGGEOMETRYPROPERTY_GENERATETAG(Height, LengthPercentWidthHeight, Y,
nsStylePosition);
#undef SVGGEOMETRYPROPERTY_GENERATETAG
struct Height;
struct Width {
using ResolverType = ResolverTypes::LengthPercentWidthHeight;
constexpr static auto CtxDirection = SVGContentUtils::X;
constexpr static auto Getter = &nsStylePosition::mWidth;
constexpr static auto SizeGetter = &gfx::Size::width;
using CounterPart = Height;
};
struct Height {
using ResolverType = ResolverTypes::LengthPercentWidthHeight;
constexpr static auto CtxDirection = SVGContentUtils::Y;
constexpr static auto Getter = &nsStylePosition::mHeight;
constexpr static auto SizeGetter = &gfx::Size::height;
using CounterPart = Width;
};
struct Ry;
struct Rx {
using ResolverType = ResolverTypes::LengthPercentRXY;
@ -94,7 +108,46 @@ float ResolveImpl(ComputedStyle const& aStyle, SVGElement* aElement,
aElement, value.AsLengthPercentage());
}
// |auto| and |max-content| etc. are treated as 0.
if (aElement->IsSVGElement(nsGkAtoms::image)) {
// It's not clear per SVG2 spec what should be done for values other
// than |auto| (e.g. |max-content|). We treat them as nonsense, thus
// using the initial value behavior, i.e. |auto|.
auto* f = aElement->GetPrimaryFrame();
MOZ_ASSERT(f && f->IsSVGImageFrame());
auto* imgf = static_cast<nsSVGImageFrame const*>(f);
using Other = typename Tag::CounterPart;
auto const& valueOther = aStyle.StylePosition()->*Other::Getter;
gfx::Size intrinsicImageSize;
if (!imgf->GetIntrinsicImageSize(intrinsicImageSize)) {
// Cannot get intrinsic image size, just return 0.
return 0.f;
}
if (valueOther.IsLengthPercentage()) {
// We are |auto|, but the other side has specifed length. Then
// we need to preserve aspect ratio.
float intrinsicLengthOther = intrinsicImageSize.*Other::SizeGetter;
if (!intrinsicLengthOther) {
// Avoid dividing by 0.
return 0.f;
}
float intrinsicLength = intrinsicImageSize.*Tag::SizeGetter,
lengthOther = ResolvePureLengthPercentage<Other::CtxDirection>(
aElement, valueOther.AsLengthPercentage());
return intrinsicLength * lengthOther / intrinsicLengthOther;
}
// So |width| and |height| are both |auto|, just use intrinsic size.
return intrinsicImageSize.*Tag::SizeGetter;
}
// For other elements, |auto| and |max-content| etc. are treated as 0.
return 0.f;
}

View File

@ -17,6 +17,7 @@
#include "mozilla/dom/SVGImageElementBinding.h"
#include "mozilla/dom/SVGLengthBinding.h"
#include "nsContentUtils.h"
#include "SVGGeometryProperty.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(Image)
@ -54,6 +55,8 @@ NS_IMPL_ISUPPORTS_INHERITED(SVGImageElement, SVGImageElementBase,
//----------------------------------------------------------------------
// Implementation
namespace SVGT = SVGGeometryProperty::Tags;
SVGImageElement::SVGImageElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
: SVGImageElementBase(std::move(aNodeInfo)) {
@ -63,6 +66,22 @@ SVGImageElement::SVGImageElement(
SVGImageElement::~SVGImageElement() { DestroyImageLoadingContent(); }
nsCSSPropertyID SVGImageElement::GetCSSPropertyIdForAttrEnum(
uint8_t aAttrEnum) {
switch (aAttrEnum) {
case ATTR_X:
return eCSSProperty_x;
case ATTR_Y:
return eCSSProperty_y;
case ATTR_WIDTH:
return eCSSProperty_width;
case ATTR_HEIGHT:
return eCSSProperty_height;
default:
MOZ_ASSERT_UNREACHABLE("Unknown attr enum");
return eCSSProperty_UNKNOWN;
}
}
//----------------------------------------------------------------------
// nsINode methods
@ -232,7 +251,10 @@ bool SVGImageElement::GetGeometryBounds(
Rect* aBounds, const StrokeOptions& aStrokeOptions,
const Matrix& aToBoundsSpace, const Matrix* aToNonScalingStrokeSpace) {
Rect rect;
GetAnimatedLengthValues(&rect.x, &rect.y, &rect.width, &rect.height, nullptr);
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height>(
this, &rect.x, &rect.y, &rect.width, &rect.height);
if (rect.IsEmpty()) {
// Rendering of the element disabled
@ -248,7 +270,9 @@ already_AddRefed<Path> SVGImageElement::BuildPath(PathBuilder* aBuilder) {
// hit-testing against it. For that we just pretend to be a rectangle.
float x, y, width, height;
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::X, SVGT::Y, SVGT::Width, SVGT::Height>(
this, &x, &y, &width, &height);
if (width <= 0 || height <= 0) {
return nullptr;
@ -269,10 +293,13 @@ already_AddRefed<Path> SVGImageElement::BuildPath(PathBuilder* aBuilder) {
/* virtual */
bool SVGImageElement::HasValidDimensions() const {
return mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() &&
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() &&
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0;
float width, height;
MOZ_ASSERT(GetPrimaryFrame());
SVGGeometryProperty::ResolveAll<SVGT::Width, SVGT::Height>(this, &width,
&height);
return width > 0 && height > 0;
}
SVGElement::LengthAttributesInfo SVGImageElement::GetLengthInfo() {

View File

@ -95,6 +95,8 @@ class SVGImageElement : public SVGImageElementBase,
already_AddRefed<Promise> Decode(ErrorResult& aRv);
static nsCSSPropertyID GetCSSPropertyIdForAttrEnum(uint8_t aAttrEnum);
protected:
nsresult LoadSVGImage(bool aForce, bool aNotify);

View File

@ -4,7 +4,6 @@
* 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/dom/WebAuthenticationBinding.h"
#include "mozilla/dom/AuthenticatorResponse.h"
namespace mozilla {
@ -43,11 +42,6 @@ AuthenticatorResponse::~AuthenticatorResponse() {
mozilla::DropJSObjects(this);
}
JSObject* AuthenticatorResponse::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return AuthenticatorResponse_Binding::Wrap(aCx, this, aGivenProto);
}
void AuthenticatorResponse::GetClientDataJSON(
JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal) {
if (!mClientDataJSONCachedObj) {

View File

@ -31,9 +31,6 @@ class AuthenticatorResponse : public nsISupports, public nsWrapperCache {
public:
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
void GetFormat(nsString& aRetVal) const;
void GetClientDataJSON(JSContext* aCx, JS::MutableHandle<JSObject*> aRetVal);

View File

@ -8,7 +8,7 @@
#define mozilla_dom_U2FHIDTokenManager_h
#include "mozilla/dom/U2FTokenTransport.h"
#include "u2f-hid-rs/src/u2fhid-capi.h"
#include "authenticator/src/u2fhid-capi.h"
/*
* U2FHIDTokenManager is a Rust implementation of a secure token manager

View File

@ -61,6 +61,7 @@ LOCAL_INCLUDES += [
'/dom/base',
'/dom/crypto',
'/security/manager/ssl',
'/third_party/rust',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':

View File

@ -1 +0,0 @@
type-complexity-threshold = 384

View File

@ -1,13 +0,0 @@
# Generated by Cargo
# will have compiled files and executables
/target/
**/*.rs.bk
# Fuzzing corpuses should be explicitly updated
fuzz/corpus/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock
.DS_Store

View File

@ -1,40 +0,0 @@
sudo: false
language: rust
cache: cargo
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
addons:
apt:
packages:
- build-essential
- libudev-dev
before_install:
- pkg-config --list-all
- pkg-config --libs libudev
- pkg-config --modversion libudev
install:
- rustup install nightly
- rustup component add rustfmt-preview
- rustup component add clippy-preview
script:
- |
if [ "$TRAVIS_RUST_VERSION" == "nightly" ] ; then
export ASAN_OPTIONS="detect_odr_violation=1:leak_check_at_exit=0:detect_leaks=0"
export RUSTFLAGS="-Z sanitizer=address"
fi
- |
if [ "$TRAVIS_RUST_VERSION" == "stable" ] ; then
cargo fmt --all -- --check
cargo clippy --all-targets -- -A renamed_and_removed_lints -A new-ret-no-self -D warnings
fi
- cargo test

View File

@ -1,36 +0,0 @@
[package]
name = "u2fhid"
version = "0.2.4"
authors = ["Kyle Machulis <kyle@nonpolynomial.com>", "J.C. Jones <jc@mozilla.com>", "Tim Taubert <ttaubert@mozilla.com>"]
[target.'cfg(target_os = "linux")'.dependencies]
libudev = "^0.2"
[target.'cfg(target_os = "freebsd")'.dependencies]
devd-rs = "0.2.1"
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.6.2"
[target.'cfg(target_os = "windows")'.dependencies.winapi]
version = "0.3"
features = [
"handleapi",
"hidclass",
"hidpi",
"hidusage",
"setupapi",
]
[dependencies]
rand = "0.6"
log = "0.4"
libc = "^0.2"
boxfnonce = "0.0.3"
runloop = "0.1.0"
bitflags = "1.0"
[dev-dependencies]
sha2 = "^0.7"
base64 = "^0.4"
env_logger = "0.5"

View File

@ -1,2 +0,0 @@
target
artifacts

View File

@ -1,29 +0,0 @@
[package]
name = "u2fhid-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false
[package.metadata]
cargo-fuzz = true
[dependencies]
rand = "0.3"
[dependencies.u2fhid]
path = ".."
[dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "u2f_read"
path = "fuzz_targets/u2f_read.rs"
[[bin]]
name = "u2f_read_write"
path = "fuzz_targets/u2f_read_write.rs"

View File

@ -1,66 +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/. */
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate u2fhid;
use std::{cmp, io};
use u2fhid::{CID_BROADCAST, HID_RPT_SIZE};
use u2fhid::{U2FDevice, sendrecv};
struct TestDevice<'a> {
cid: [u8; 4],
data: &'a [u8]
}
impl<'a> TestDevice<'a> {
pub fn new(data: &'a [u8]) -> TestDevice {
TestDevice {
cid: CID_BROADCAST,
data,
}
}
}
impl<'a> io::Read for TestDevice<'a> {
fn read(&mut self, bytes: &mut [u8]) -> io::Result<usize> {
assert!(bytes.len() == HID_RPT_SIZE);
let max = cmp::min(self.data.len(), HID_RPT_SIZE);
bytes[..max].copy_from_slice(&self.data[..max]);
self.data = &self.data[max..];
Ok(max)
}
}
impl<'a> io::Write for TestDevice<'a> {
fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
assert!(bytes.len() == HID_RPT_SIZE + 1);
Ok(bytes.len())
}
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
}
impl<'a> U2FDevice for TestDevice<'a> {
fn get_cid<'b>(&'b self) -> &'b [u8; 4] {
&self.cid
}
fn set_cid(&mut self, cid: [u8; 4]) {
self.cid = cid;
}
}
fuzz_target!(|data: &[u8]| {
if data.len() > 0 {
let cmd = data[0];
let data = &data[1..];
let mut dev = TestDevice::new(data);
let _ = sendrecv(&mut dev, cmd, data);
}
});

View File

@ -1,68 +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/. */
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate u2fhid;
use std::{cmp, io};
use u2fhid::{CID_BROADCAST, HID_RPT_SIZE};
use u2fhid::{U2FDevice, sendrecv};
struct TestDevice {
cid: [u8; 4],
data: Vec<u8>,
}
impl TestDevice {
pub fn new() -> TestDevice {
TestDevice {
cid: CID_BROADCAST,
data: vec!(),
}
}
}
impl io::Read for TestDevice {
fn read(&mut self, bytes: &mut [u8]) -> io::Result<usize> {
assert!(bytes.len() == HID_RPT_SIZE);
let max = cmp::min(self.data.len(), HID_RPT_SIZE);
bytes[..max].copy_from_slice(&self.data[..max]);
self.data = self.data[max..].to_vec();
Ok(max)
}
}
impl io::Write for TestDevice {
fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
assert!(bytes.len() == HID_RPT_SIZE + 1);
self.data.extend_from_slice(&bytes[1..]);
Ok(bytes.len())
}
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
}
impl U2FDevice for TestDevice {
fn get_cid<'a>(&'a self) -> &'a [u8; 4] {
&self.cid
}
fn set_cid(&mut self, cid: [u8; 4]) {
self.cid = cid;
}
}
fuzz_target!(|data: &[u8]| {
if data.len() > 0 {
let cmd = data[0];
let data = &data[1..];
let mut dev = TestDevice::new();
let res = sendrecv(&mut dev, cmd, data);
assert_eq!(data, &res.unwrap()[..]);
}
});

View File

@ -83,7 +83,7 @@ interface AddonManager : EventTarget {
};
[ChromeOnly,Exposed=Window,HeaderFile="mozilla/AddonManagerWebAPI.h"]
interface AddonManagerPermissions {
static boolean isHostPermitted(DOMString host);
namespace AddonManagerPermissions {
boolean isHostPermitted(DOMString host);
};

View File

@ -12,19 +12,18 @@ callback WebrtcGlobalStatisticsCallback = void (WebrtcGlobalStatisticsReport rep
callback WebrtcGlobalLoggingCallback = void (sequence<DOMString> logMessages);
[ChromeOnly]
interface WebrtcGlobalInformation {
namespace WebrtcGlobalInformation {
[Throws]
static void getAllStats(WebrtcGlobalStatisticsCallback callback,
optional DOMString pcIdFilter);
void getAllStats(WebrtcGlobalStatisticsCallback callback,
optional DOMString pcIdFilter);
static void clearAllStats();
void clearAllStats();
[Throws]
static void getLogging(DOMString pattern,
WebrtcGlobalLoggingCallback callback);
void getLogging(DOMString pattern, WebrtcGlobalLoggingCallback callback);
static void clearLogging();
void clearLogging();
// NSPR WebRTC Trace debug level (0 - 65535)
//
@ -32,10 +31,10 @@ interface WebrtcGlobalInformation {
// - Setting a non-zero debug level turns on gathering of log for file output.
// - Subsequently setting a zero debug level writes that log to disk.
static attribute long debugLevel;
attribute long debugLevel;
// WebRTC AEC debugging enable
static attribute boolean aecDebug;
attribute boolean aecDebug;
static readonly attribute DOMString aecDebugLogDir;
readonly attribute DOMString aecDebugLogDir;
};

View File

@ -268,6 +268,8 @@ class HTMLEditor final : public TextEditor,
}
bool IsObjectResizerEnabled() const { return mIsObjectResizingEnabled; }
Element* GetResizerTarget() const { return mResizedObject; }
/**
* Enable/disable inline table editor, e.g., adding new row or column,
* removing existing row or column.

View File

@ -268,6 +268,7 @@ skip-if = toolkit == 'android'
skip-if = os == 'android' # Bug 1525959
[test_CF_HTML_clipboard.html]
tags = clipboard
skip-if = os != 'mac' # bug 574005
[test_composition_event_created_in_chrome.html]
[test_contenteditable_focus.html]
[test_documentCharacterSet.html]

View File

@ -141,15 +141,7 @@ function runTest() {
}, SimpleTest.finish);
}
var isMac = ("nsILocalFileMac" in SpecialPowers.Ci);
if (isMac) {
SimpleTest.waitForFocus(runTest);
} else {
// This test is not yet supported on non-Mac platforms, see bug 574005.
todo(false, "Test not supported on this platform");
SimpleTest.finish();
}
SimpleTest.waitForFocus(runTest);
</script>
</pre>
</body>

View File

@ -637,7 +637,8 @@ inline size_t Arena::finalize(FreeOp* fop, AllocKind thingKind,
template <typename T>
static inline bool FinalizeTypedArenas(FreeOp* fop, Arena** src,
SortedArenaList& dest,
AllocKind thingKind, SliceBudget& budget) {
AllocKind thingKind,
SliceBudget& budget) {
// When operating in the foreground, take the lock at the top.
Maybe<AutoLockGC> maybeLock;
if (fop->onMainThread()) {
@ -4351,7 +4352,7 @@ static void DiscardJITCodeForGC(JSRuntime* rt) {
gcstats::AutoPhase ap(rt->gc.stats(),
gcstats::PhaseKind::MARK_DISCARD_CODE);
zone->discardJitCode(rt->defaultFreeOp(), Zone::DiscardBaselineCode,
Zone::ReleaseTypes);
Zone::DiscardJitScripts);
}
}

View File

@ -196,7 +196,7 @@ void Zone::sweepWeakMaps() {
void Zone::discardJitCode(FreeOp* fop,
ShouldDiscardBaselineCode discardBaselineCode,
ShouldReleaseTypes releaseTypes) {
ShouldDiscardJitScripts discardJitScripts) {
if (!jitZone()) {
return;
}
@ -205,11 +205,11 @@ void Zone::discardJitCode(FreeOp* fop,
return;
}
if (discardBaselineCode || releaseTypes) {
if (discardBaselineCode || discardJitScripts) {
#ifdef DEBUG
// Assert no JitScripts are marked as active.
for (auto script = cellIter<JSScript>(); !script.done(); script.next()) {
if (JitScript* jitScript = script.unbarrieredGet()->jitScript()) {
if (jit::JitScript* jitScript = script.unbarrieredGet()->jitScript()) {
MOZ_ASSERT(!jitScript->active());
}
}
@ -251,11 +251,11 @@ void Zone::discardJitCode(FreeOp* fop,
// Try to release the script's JitScript. This should happen after
// releasing JIT code because we can't do this when the script still has
// JIT code.
if (releaseTypes) {
if (discardJitScripts) {
script->maybeReleaseJitScript();
}
if (JitScript* jitScript = script->jitScript()) {
if (jit::JitScript* jitScript = script->jitScript()) {
// If we did not release the JitScript, we need to purge optimized IC
// stubs because the optimizedStubSpace will be purged below.
if (discardBaselineCode) {

View File

@ -188,12 +188,15 @@ class Zone : public JS::shadow::Zone,
DiscardBaselineCode
};
enum ShouldReleaseTypes : bool { KeepTypes = false, ReleaseTypes };
enum ShouldDiscardJitScripts : bool {
KeepJitScripts = false,
DiscardJitScripts
};
void discardJitCode(
js::FreeOp* fop,
ShouldDiscardBaselineCode discardBaselineCode = DiscardBaselineCode,
ShouldReleaseTypes releaseTypes = KeepTypes);
ShouldDiscardJitScripts discardJitScripts = KeepJitScripts);
void addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
size_t* typePool, size_t* regexpZone,
@ -750,8 +753,7 @@ class ZoneAllocPolicy {
// Associate malloc memory with a GC thing. This call must be matched by a
// following call to RemoveCellMemory with the same size and use. The total
// amount of malloc memory associated with a zone is used to trigger GC.
inline void AddCellMemory(gc::TenuredCell* cell, size_t nbytes,
MemoryUse use) {
inline void AddCellMemory(gc::TenuredCell* cell, size_t nbytes, MemoryUse use) {
if (nbytes) {
cell->zone()->addCellMemory(cell, nbytes, use);
}

View File

@ -156,17 +156,13 @@ class MOZ_RAII FallbackStubAllocator {
}
};
} // namespace jit
bool JitScript::initICEntries(JSContext* cx, JSScript* script) {
bool JitScript::initICEntriesAndBytecodeTypeMap(JSContext* cx,
JSScript* script) {
MOZ_ASSERT(cx->realm()->jitRealm());
MOZ_ASSERT(jit::IsBaselineEnabled(cx));
MOZ_ASSERT(numICEntries() == script->numICEntries());
// TODO(bug 1551796): move JitScript into jit namespace so we don't need this.
using namespace js::jit;
FallbackStubAllocator alloc(cx, fallbackStubSpace_);
// Index of the next ICEntry to initialize.
@ -216,12 +212,24 @@ bool JitScript::initICEntries(JSContext* cx, JSScript* script) {
}
}
jsbytecode const* pcEnd = script->codeEnd();
// Index of the next bytecode type map entry to initialize.
uint32_t typeMapIndex = 0;
uint32_t* const typeMap = bytecodeTypeMap();
// Add ICEntries and fallback stubs for JOF_IC bytecode ops.
// For JOF_IC ops: initialize ICEntries and fallback stubs.
// For JOF_TYPESET ops: initialize bytecode type map entries.
jsbytecode const* pcEnd = script->codeEnd();
for (jsbytecode* pc = script->code(); pc < pcEnd; pc = GetNextPc(pc)) {
JSOp op = JSOp(*pc);
// Note: if the script is very large there will be more JOF_TYPESET ops
// than bytecode type sets. See JSScript::MaxBytecodeTypeSets.
if ((CodeSpec[op].format & JOF_TYPESET) &&
typeMapIndex < JSScript::MaxBytecodeTypeSets) {
typeMap[typeMapIndex] = script->pcToOffset(pc);
typeMapIndex++;
}
// Assert the frontend stored the correct IC index in jump target ops.
MOZ_ASSERT_IF(BytecodeIsJumpTarget(op), GET_ICINDEX(pc) == icEntryIndex);
@ -499,14 +507,13 @@ bool JitScript::initICEntries(JSContext* cx, JSScript* script) {
}
}
// Assert all ICEntries have been initialized.
// Assert all ICEntries and type map entries have been initialized.
MOZ_ASSERT(icEntryIndex == numICEntries());
MOZ_ASSERT(typeMapIndex == script->numBytecodeTypeSets());
return true;
}
namespace jit {
ICStubConstIterator& ICStubConstIterator::operator++() {
MOZ_ASSERT(currentStub_ != nullptr);
currentStub_ = currentStub_->next();
@ -1286,19 +1293,6 @@ void ICStubCompilerBase::PushStubPayload(MacroAssembler& masm,
masm.adjustFrame(sizeof(intptr_t));
}
} // namespace jit
void JitScript::noteAccessedGetter(uint32_t pcOffset) {
jit::ICEntry& entry = icEntryFromPCOffset(pcOffset);
jit::ICFallbackStub* stub = entry.fallbackStub();
if (stub->isGetProp_Fallback()) {
stub->toGetProp_Fallback()->noteAccessedGetter();
}
}
namespace jit {
// TypeMonitor_Fallback
//
@ -2486,19 +2480,6 @@ bool FallbackICCodeCompiler::emit_SetElem() {
return tailCallVM<Fn, DoSetElemFallback>(masm);
}
} // namespace jit
void JitScript::noteHasDenseAdd(uint32_t pcOffset) {
jit::ICEntry& entry = icEntryFromPCOffset(pcOffset);
jit::ICFallbackStub* stub = entry.fallbackStub();
if (stub->isSetElem_Fallback()) {
stub->toSetElem_Fallback()->noteHasDenseAdd();
}
}
namespace jit {
template <typename T>
void StoreToTypedArray(JSContext* cx, MacroAssembler& masm, Scalar::Type type,
const ValueOperand& value, const T& dest,

View File

@ -517,14 +517,6 @@ void BaselineScript::trace(JSTracer* trc) {
TraceNullableEdge(trc, &templateEnv_, "baseline-template-environment");
}
void JitScript::trace(JSTracer* trc) {
// Mark all IC stub codes hanging off the IC stub entries.
for (size_t i = 0; i < numICEntries(); i++) {
ICEntry& ent = icEntry(i);
ent.trace(trc);
}
}
/* static */
void BaselineScript::writeBarrierPre(Zone* zone, BaselineScript* script) {
if (zone->needsIncrementalBarrier()) {
@ -619,15 +611,6 @@ CompactBufferReader BaselineScript::pcMappingReader(size_t indexEntry) {
return CompactBufferReader(dataStart, dataEnd);
}
struct ICEntries {
JitScript* const jitScript_;
explicit ICEntries(JitScript* jitScript) : jitScript_(jitScript) {}
size_t numEntries() const { return jitScript_->numICEntries(); }
ICEntry& operator[](size_t index) const { return jitScript_->icEntry(index); }
};
struct RetAddrEntries {
BaselineScript* const baseline_;
@ -667,30 +650,6 @@ RetAddrEntry& BaselineScript::retAddrEntryFromReturnOffset(
return retAddrEntry(loc);
}
static bool ComputeBinarySearchMid(ICEntries entries, uint32_t pcOffset,
size_t* loc) {
return BinarySearchIf(
entries, 0, entries.numEntries(),
[pcOffset](const ICEntry& entry) {
uint32_t entryOffset = entry.pcOffset();
if (pcOffset < entryOffset) {
return -1;
}
if (entryOffset < pcOffset) {
return 1;
}
if (entry.isForPrologue()) {
// Prologue ICEntries are used for function argument type checks.
// Ignore these entries and return 1 because these entries appear in
// the ICEntry list before the other ICEntry (if any) at offset 0.
MOZ_ASSERT(entryOffset == 0);
return 1;
}
return 0;
},
loc);
}
static bool ComputeBinarySearchMid(RetAddrEntries entries, uint32_t pcOffset,
size_t* loc) {
return BinarySearchIf(
@ -712,82 +671,6 @@ uint8_t* BaselineScript::returnAddressForEntry(const RetAddrEntry& ent) {
return method()->raw() + ent.returnOffset().offset();
}
ICEntry* JitScript::maybeICEntryFromPCOffset(uint32_t pcOffset) {
// This method ignores prologue IC entries. There can be at most one
// non-prologue IC per bytecode op.
size_t mid;
if (!ComputeBinarySearchMid(ICEntries(this), pcOffset, &mid)) {
return nullptr;
}
MOZ_ASSERT(mid < numICEntries());
ICEntry& entry = icEntry(mid);
MOZ_ASSERT(!entry.isForPrologue());
MOZ_ASSERT(entry.pcOffset() == pcOffset);
return &entry;
}
ICEntry& JitScript::icEntryFromPCOffset(uint32_t pcOffset) {
ICEntry* entry = maybeICEntryFromPCOffset(pcOffset);
MOZ_RELEASE_ASSERT(entry);
return *entry;
}
ICEntry* JitScript::maybeICEntryFromPCOffset(uint32_t pcOffset,
ICEntry* prevLookedUpEntry) {
// Do a linear forward search from the last queried PC offset, or fallback to
// a binary search if the last offset is too far away.
if (prevLookedUpEntry && pcOffset >= prevLookedUpEntry->pcOffset() &&
(pcOffset - prevLookedUpEntry->pcOffset()) <= 10) {
ICEntry* firstEntry = &icEntry(0);
ICEntry* lastEntry = &icEntry(numICEntries() - 1);
ICEntry* curEntry = prevLookedUpEntry;
while (curEntry >= firstEntry && curEntry <= lastEntry) {
if (curEntry->pcOffset() == pcOffset && !curEntry->isForPrologue()) {
return curEntry;
}
curEntry++;
}
return nullptr;
}
return maybeICEntryFromPCOffset(pcOffset);
}
ICEntry& JitScript::icEntryFromPCOffset(uint32_t pcOffset,
ICEntry* prevLookedUpEntry) {
ICEntry* entry = maybeICEntryFromPCOffset(pcOffset, prevLookedUpEntry);
MOZ_RELEASE_ASSERT(entry);
return *entry;
}
ICEntry* JitScript::interpreterICEntryFromPCOffset(uint32_t pcOffset) {
// We have to return the entry to store in BaselineFrame::interpreterICEntry
// when resuming in the Baseline Interpreter at pcOffset. The bytecode op at
// pcOffset does not necessarily have an ICEntry, so we want to return the
// first ICEntry for which the following is true:
//
// !entry.isForPrologue() && entry.pcOffset() >= pcOffset
//
// Fortunately, ComputeBinarySearchMid returns exactly this entry.
size_t mid;
ComputeBinarySearchMid(ICEntries(this), pcOffset, &mid);
if (mid < numICEntries()) {
ICEntry& entry = icEntry(mid);
MOZ_ASSERT(!entry.isForPrologue());
MOZ_ASSERT(entry.pcOffset() >= pcOffset);
return &entry;
}
// Resuming at a pc after the last ICEntry. Just return nullptr:
// BaselineFrame::interpreterICEntry will never be used in this case.
return nullptr;
}
RetAddrEntry& BaselineScript::retAddrEntryFromPCOffset(
uint32_t pcOffset, RetAddrEntry::Kind kind) {
size_t mid;
@ -1197,150 +1080,6 @@ void BaselineInterpreter::toggleCodeCoverageInstrumentation(bool enable) {
toggleCodeCoverageInstrumentationUnchecked(enable);
}
void JitScript::purgeOptimizedStubs(JSScript* script) {
MOZ_ASSERT(script->jitScript() == this);
Zone* zone = script->zone();
if (zone->isGCSweeping() && IsAboutToBeFinalizedDuringSweep(*script)) {
// We're sweeping and the script is dead. Don't purge optimized stubs
// because (1) accessing CacheIRStubInfo pointers in ICStubs is invalid
// because we may have swept them already when we started (incremental)
// sweeping and (2) it's unnecessary because this script will be finalized
// soon anyway.
return;
}
JitSpew(JitSpew_BaselineIC, "Purging optimized stubs");
for (size_t i = 0; i < numICEntries(); i++) {
ICEntry& entry = icEntry(i);
ICStub* lastStub = entry.firstStub();
while (lastStub->next()) {
lastStub = lastStub->next();
}
if (lastStub->isFallback()) {
// Unlink all stubs allocated in the optimized space.
ICStub* stub = entry.firstStub();
ICStub* prev = nullptr;
while (stub->next()) {
if (!stub->allocatedInFallbackSpace()) {
lastStub->toFallbackStub()->unlinkStub(zone, prev, stub);
stub = stub->next();
continue;
}
prev = stub;
stub = stub->next();
}
if (lastStub->isMonitoredFallback()) {
// Monitor stubs can't make calls, so are always in the
// optimized stub space.
ICTypeMonitor_Fallback* lastMonStub =
lastStub->toMonitoredFallbackStub()->maybeFallbackMonitorStub();
if (lastMonStub) {
lastMonStub->resetMonitorStubChain(zone);
}
}
} else if (lastStub->isTypeMonitor_Fallback()) {
lastStub->toTypeMonitor_Fallback()->resetMonitorStubChain(zone);
} else {
MOZ_CRASH("Unknown fallback stub");
}
}
#ifdef DEBUG
// All remaining stubs must be allocated in the fallback space.
for (size_t i = 0; i < numICEntries(); i++) {
ICEntry& entry = icEntry(i);
ICStub* stub = entry.firstStub();
while (stub->next()) {
MOZ_ASSERT(stub->allocatedInFallbackSpace());
stub = stub->next();
}
}
#endif
}
#ifdef JS_STRUCTURED_SPEW
static bool GetStubEnteredCount(ICStub* stub, uint32_t* count) {
switch (stub->kind()) {
case ICStub::CacheIR_Regular:
*count = stub->toCacheIR_Regular()->enteredCount();
return true;
case ICStub::CacheIR_Updated:
*count = stub->toCacheIR_Updated()->enteredCount();
return true;
case ICStub::CacheIR_Monitored:
*count = stub->toCacheIR_Monitored()->enteredCount();
return true;
default:
return false;
}
}
bool HasEnteredCounters(ICEntry& entry) {
ICStub* stub = entry.firstStub();
while (stub && !stub->isFallback()) {
uint32_t count;
if (GetStubEnteredCount(stub, &count)) {
return true;
}
stub = stub->next();
}
return false;
}
void jit::JitSpewBaselineICStats(JSScript* script, const char* dumpReason) {
MOZ_ASSERT(script->hasJitScript());
JSContext* cx = TlsContext.get();
AutoStructuredSpewer spew(cx, SpewChannel::BaselineICStats, script);
if (!spew) {
return;
}
JitScript* jitScript = script->jitScript();
spew->property("reason", dumpReason);
spew->beginListProperty("entries");
for (size_t i = 0; i < jitScript->numICEntries(); i++) {
ICEntry& entry = jitScript->icEntry(i);
if (!HasEnteredCounters(entry)) {
continue;
}
uint32_t pcOffset = entry.pcOffset();
jsbytecode* pc = entry.pc(script);
unsigned column;
unsigned int line = PCToLineNumber(script, pc, &column);
spew->beginObject();
spew->property("op", CodeName[*pc]);
spew->property("pc", pcOffset);
spew->property("line", line);
spew->property("column", column);
spew->beginListProperty("counts");
ICStub* stub = entry.firstStub();
while (stub && !stub->isFallback()) {
uint32_t count;
if (GetStubEnteredCount(stub, &count)) {
spew->value(count);
} else {
spew->value("?");
}
stub = stub->next();
}
spew->endList();
spew->property("fallback_count", entry.fallbackStub()->enteredCount());
spew->endObject();
}
spew->endList();
}
#endif
void jit::FinishDiscardBaselineScript(FreeOp* fop, JSScript* script) {
MOZ_ASSERT(script->hasBaselineScript());
MOZ_ASSERT(!script->jitScript()->active());
@ -1410,51 +1149,6 @@ void jit::ToggleBaselineTraceLoggerEngine(JSRuntime* runtime, bool enable) {
}
#endif
static void MarkActiveJitScripts(JSContext* cx,
const JitActivationIterator& activation) {
for (OnlyJSJitFrameIter iter(activation); !iter.done(); ++iter) {
const JSJitFrameIter& frame = iter.frame();
switch (frame.type()) {
case FrameType::BaselineJS:
frame.script()->jitScript()->setActive();
break;
case FrameType::Exit:
if (frame.exitFrame()->is<LazyLinkExitFrameLayout>()) {
LazyLinkExitFrameLayout* ll =
frame.exitFrame()->as<LazyLinkExitFrameLayout>();
JSScript* script =
ScriptFromCalleeToken(ll->jsFrame()->calleeToken());
script->jitScript()->setActive();
}
break;
case FrameType::Bailout:
case FrameType::IonJS: {
// Keep the JitScript and BaselineScript around, since bailouts from
// the ion jitcode need to re-enter into the Baseline code.
frame.script()->jitScript()->setActive();
for (InlineFrameIterator inlineIter(cx, &frame); inlineIter.more();
++inlineIter) {
inlineIter.script()->jitScript()->setActive();
}
break;
}
default:;
}
}
}
void jit::MarkActiveJitScripts(Zone* zone) {
if (zone->isAtomsZone()) {
return;
}
JSContext* cx = TlsContext.get();
for (JitActivationIterator iter(cx); !iter.done(); ++iter) {
if (iter->compartment()->zone() == zone) {
MarkActiveJitScripts(cx, iter);
}
}
}
void BaselineInterpreter::init(JitCode* code, uint32_t interpretOpOffset,
uint32_t profilerEnterToggleOffset,
uint32_t profilerExitToggleOffset,

View File

@ -638,17 +638,9 @@ MOZ_MUST_USE bool BailoutIonToBaseline(
bool invalidate, BaselineBailoutInfo** bailoutInfo,
const ExceptionBailoutInfo* exceptionInfo);
// Mark JitScripts on the stack as active, so that they are not discarded
// during GC.
void MarkActiveJitScripts(Zone* zone);
MethodStatus BaselineCompile(JSContext* cx, JSScript* script,
bool forceDebugInstrumentation = false);
#ifdef JS_STRUCTURED_SPEW
void JitSpewBaselineICStats(JSScript* script, const char* dumpReason);
#endif
static const unsigned BASELINE_MAX_ARGS_LENGTH = 20000;
// Class storing the generated Baseline Interpreter code for the runtime.

View File

@ -3135,6 +3135,10 @@ void jit::DestroyJitScripts(FreeOp* fop, JSScript* script) {
if (script->hasBaselineScript()) {
jit::BaselineScript::Destroy(fop, script->baselineScript());
}
if (script->hasJitScript()) {
JitScript::Destroy(script->zone(), script->jitScript());
}
}
void jit::TraceJitScripts(JSTracer* trc, JSScript* script) {

Some files were not shown because too many files have changed in this diff Show More