mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 20:30:41 +00:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
463212f69f
@ -14,6 +14,7 @@
|
||||
"testName": true,
|
||||
"testDescr": true,
|
||||
"testStates": true,
|
||||
"testRelation": true,
|
||||
"testAccessibleTree": true,
|
||||
"isAccessible": true,
|
||||
"getAccessibleDOMNodeID": true,
|
||||
|
@ -17,6 +17,8 @@ support-files =
|
||||
[browser_caching_description.js]
|
||||
[browser_caching_name.js]
|
||||
skip-if = e10s
|
||||
[browser_caching_relations.js]
|
||||
[browser_caching_states.js]
|
||||
|
||||
# Events tests
|
||||
[browser_events_caretmove.js]
|
||||
|
86
accessible/tests/browser/browser_caching_relations.js
Normal file
86
accessible/tests/browser/browser_caching_relations.js
Normal file
@ -0,0 +1,86 @@
|
||||
/* 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/. */
|
||||
|
||||
'use strict';
|
||||
|
||||
/* global RELATION_LABELLED_BY, RELATION_LABEL_FOR, RELATION_DESCRIBED_BY,
|
||||
RELATION_DESCRIPTION_FOR, RELATION_CONTROLLER_FOR,
|
||||
RELATION_CONTROLLED_BY, RELATION_FLOWS_TO, RELATION_FLOWS_FROM */
|
||||
|
||||
loadScripts({ name: 'relations.js', dir: MOCHITESTS_DIR });
|
||||
|
||||
/**
|
||||
* A test specification that has the following format:
|
||||
* [
|
||||
* attr relevant aria attribute
|
||||
* hostRelation corresponding host relation type
|
||||
* dependantRelation corresponding dependant relation type
|
||||
* ]
|
||||
*/
|
||||
const attrRelationsSpec = [
|
||||
['aria-labelledby', RELATION_LABELLED_BY, RELATION_LABEL_FOR],
|
||||
['aria-describedby', RELATION_DESCRIBED_BY, RELATION_DESCRIPTION_FOR],
|
||||
['aria-controls', RELATION_CONTROLLER_FOR, RELATION_CONTROLLED_BY],
|
||||
['aria-flowto', RELATION_FLOWS_TO, RELATION_FLOWS_FROM]
|
||||
];
|
||||
|
||||
function* testRelated(browser, accDoc, attr, hostRelation, dependantRelation) {
|
||||
let host = findAccessibleChildByID(accDoc, 'host');
|
||||
let dependant1 = findAccessibleChildByID(accDoc, 'dependant1');
|
||||
let dependant2 = findAccessibleChildByID(accDoc, 'dependant2');
|
||||
|
||||
/**
|
||||
* Test data has the format of:
|
||||
* {
|
||||
* desc {String} description for better logging
|
||||
* attrs {?Array} an optional list of attributes to update
|
||||
* expected {Array} expected relation values for dependant1, dependant2
|
||||
* and host respectively.
|
||||
* }
|
||||
*/
|
||||
const tests = [{
|
||||
desc: 'No attribute',
|
||||
expected: [ null, null, null ]
|
||||
}, {
|
||||
desc: 'Set attribute',
|
||||
attrs: [{ key: attr, value: 'dependant1' }],
|
||||
expected: [ host, null, dependant1 ]
|
||||
}, {
|
||||
desc: 'Change attribute',
|
||||
attrs: [{ key: attr, value: 'dependant2' }],
|
||||
expected: [ null, host, dependant2 ]
|
||||
}, {
|
||||
desc: 'Remove attribute',
|
||||
attrs: [{ key: attr }],
|
||||
expected: [ null, null, null ]
|
||||
}];
|
||||
|
||||
for (let { desc, attrs, expected } of tests) {
|
||||
info(desc);
|
||||
|
||||
if (attrs) {
|
||||
for (let { key, value } of attrs) {
|
||||
yield invokeSetAttribute(browser, 'host', key, value);
|
||||
}
|
||||
}
|
||||
|
||||
testRelation(dependant1, dependantRelation, expected[0]);
|
||||
testRelation(dependant2, dependantRelation, expected[1]);
|
||||
testRelation(host, hostRelation, expected[2]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test caching of relations between accessible objects.
|
||||
*/
|
||||
addAccessibleTask(`
|
||||
<div id="dependant1">label</div>
|
||||
<div id="dependant2">label2</div>
|
||||
<div role="checkbox" id="host"></div>`,
|
||||
function* (browser, accDoc) {
|
||||
for (let spec of attrRelationsSpec) {
|
||||
yield testRelated(browser, accDoc, ...spec);
|
||||
}
|
||||
}
|
||||
);
|
120
accessible/tests/browser/browser_caching_states.js
Normal file
120
accessible/tests/browser/browser_caching_states.js
Normal file
@ -0,0 +1,120 @@
|
||||
/* 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/. */
|
||||
|
||||
'use strict';
|
||||
|
||||
/* global EVENT_STATE_CHANGE, STATE_CHECKED, STATE_BUSY, STATE_REQUIRED,
|
||||
STATE_INVALID, EXT_STATE_ENABLED */
|
||||
|
||||
loadScripts({ name: 'role.js', dir: MOCHITESTS_DIR },
|
||||
{ name: 'states.js', dir: MOCHITESTS_DIR });
|
||||
|
||||
/**
|
||||
* Test data has the format of:
|
||||
* {
|
||||
* desc {String} description for better logging
|
||||
* expected {Array} expected states for a given accessible that have the
|
||||
* following format:
|
||||
* [
|
||||
* expected state,
|
||||
* expected extra state,
|
||||
* absent state,
|
||||
* absent extra state
|
||||
* ]
|
||||
* attrs {?Array} an optional list of attributes to update
|
||||
* }
|
||||
*/
|
||||
|
||||
// State caching tests for attribute changes
|
||||
const attributeTests = [{
|
||||
desc: 'Checkbox with @checked attribute set to true should have checked ' +
|
||||
'state',
|
||||
attrs: [{
|
||||
attr: 'checked',
|
||||
value: 'true'
|
||||
}],
|
||||
expected: [STATE_CHECKED, 0]
|
||||
}, {
|
||||
desc: 'Checkbox with no @checked attribute should not have checked state',
|
||||
attrs: [{
|
||||
attr: 'checked'
|
||||
}],
|
||||
expected: [0, 0, STATE_CHECKED]
|
||||
}];
|
||||
|
||||
// State caching tests for ARIA changes
|
||||
const ariaTests = [{
|
||||
desc: 'File input has busy state when @aria-busy attribute is set to true',
|
||||
attrs: [{
|
||||
attr: 'aria-busy',
|
||||
value: 'true'
|
||||
}],
|
||||
expected: [STATE_BUSY, 0, STATE_REQUIRED | STATE_INVALID]
|
||||
}, {
|
||||
desc: 'File input has required state when @aria-required attribute is set ' +
|
||||
'to true',
|
||||
attrs: [{
|
||||
attr: 'aria-required',
|
||||
value: 'true'
|
||||
}],
|
||||
expected: [STATE_REQUIRED, 0, STATE_INVALID]
|
||||
}, {
|
||||
desc: 'File input has invalid state when @aria-invalid attribute is set to ' +
|
||||
'true',
|
||||
attrs: [{
|
||||
attr: 'aria-invalid',
|
||||
value: 'true'
|
||||
}],
|
||||
expected: [STATE_INVALID, 0]
|
||||
}];
|
||||
|
||||
// Extra state caching tests
|
||||
const extraStateTests = [{
|
||||
desc: 'Input has no extra enabled state when aria and native disabled ' +
|
||||
'attributes are set at once',
|
||||
attrs: [{
|
||||
attr: 'aria-disabled',
|
||||
value: 'true'
|
||||
}, {
|
||||
attr: 'disabled',
|
||||
value: 'true'
|
||||
}],
|
||||
expected: [0, 0, 0, EXT_STATE_ENABLED]
|
||||
}, {
|
||||
desc: 'Input has an extra enabled state when aria and native disabled ' +
|
||||
'attributes are unset at once',
|
||||
attrs: [{
|
||||
attr: 'aria-disabled'
|
||||
}, {
|
||||
attr: 'disabled'
|
||||
}],
|
||||
expected: [0, EXT_STATE_ENABLED]
|
||||
}];
|
||||
|
||||
function* runStateTests(browser, accDoc, id, tests) {
|
||||
let acc = findAccessibleChildByID(accDoc, id);
|
||||
for (let { desc, attrs, expected } of tests) {
|
||||
info(desc);
|
||||
let onUpdate = waitForEvent(EVENT_STATE_CHANGE, id);
|
||||
for (let { attr, value } of attrs) {
|
||||
yield invokeSetAttribute(browser, id, attr, value);
|
||||
}
|
||||
yield onUpdate;
|
||||
testStates(acc, ...expected);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test caching of accessible object states
|
||||
*/
|
||||
addAccessibleTask(`
|
||||
<input id="checkbox" type="checkbox">
|
||||
<input id="file" type="file">
|
||||
<input id="text">`,
|
||||
function* (browser, accDoc) {
|
||||
yield runStateTests(browser, accDoc, 'checkbox', attributeTests);
|
||||
yield runStateTests(browser, accDoc, 'file', ariaTests);
|
||||
yield runStateTests(browser, accDoc, 'text', extraStateTests);
|
||||
}
|
||||
);
|
@ -24,6 +24,18 @@ nsAccessibleRelation::nsAccessibleRelation(uint32_t aType,
|
||||
mTargets->AppendElement(static_cast<nsIAccessible*>(ToXPC(targetAcc)), false);
|
||||
}
|
||||
|
||||
nsAccessibleRelation::nsAccessibleRelation(uint32_t aType,
|
||||
const nsTArray<ProxyAccessible*>* aTargets) :
|
||||
mType(aType)
|
||||
{
|
||||
mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
for (uint32_t idx = 0; idx < aTargets->Length(); ++idx) {
|
||||
mTargets->AppendElement(
|
||||
static_cast<nsIAccessible*>(ToXPC(aTargets->ElementAt(idx))),
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
nsAccessibleRelation::~nsAccessibleRelation()
|
||||
{
|
||||
}
|
||||
|
@ -9,8 +9,10 @@
|
||||
#include "nsIAccessibleRelation.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/a11y/ProxyAccessible.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
@ -25,6 +27,9 @@ class nsAccessibleRelation final : public nsIAccessibleRelation
|
||||
public:
|
||||
nsAccessibleRelation(uint32_t aType, Relation* aRel);
|
||||
|
||||
nsAccessibleRelation(uint32_t aType,
|
||||
const nsTArray<ProxyAccessible*>* aTargets);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLERELATION
|
||||
|
||||
@ -34,7 +39,7 @@ private:
|
||||
|
||||
nsAccessibleRelation(const nsAccessibleRelation&);
|
||||
nsAccessibleRelation& operator = (const nsAccessibleRelation&);
|
||||
|
||||
|
||||
uint32_t mType;
|
||||
nsCOMPtr<nsIMutableArray> mTargets;
|
||||
};
|
||||
|
@ -469,12 +469,21 @@ xpcAccessible::GetRelationByType(uint32_t aType,
|
||||
|
||||
NS_ENSURE_ARG(aType <= static_cast<uint32_t>(RelationType::LAST));
|
||||
|
||||
if (!Intl())
|
||||
if (IntlGeneric().IsNull())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
Relation rel = Intl()->RelationByType(static_cast<RelationType>(aType));
|
||||
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel));
|
||||
return *aRelation ? NS_OK : NS_ERROR_FAILURE;
|
||||
if (IntlGeneric().IsAccessible()) {
|
||||
Relation rel = Intl()->RelationByType(static_cast<RelationType>(aType));
|
||||
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ProxyAccessible* proxy = IntlGeneric().AsProxy();
|
||||
nsTArray<ProxyAccessible*> targets =
|
||||
proxy->RelationByType(static_cast<RelationType>(aType));
|
||||
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &targets));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -2686,7 +2686,7 @@ const TLS_ERROR_REPORT_TELEMETRY_AUTO_UNCHECKED = 3;
|
||||
const TLS_ERROR_REPORT_TELEMETRY_MANUAL_SEND = 4;
|
||||
const TLS_ERROR_REPORT_TELEMETRY_AUTO_SEND = 5;
|
||||
|
||||
const PREF_SSL_IMPACT_ROOTS = ["security.tls.version.min", "security.tls.version.max", "security.ssl3."];
|
||||
const PREF_SSL_IMPACT_ROOTS = ["security.tls.version.", "security.ssl3."];
|
||||
|
||||
const PREF_SSL_IMPACT = PREF_SSL_IMPACT_ROOTS.reduce((prefs, root) => {
|
||||
return prefs.concat(Services.prefs.getChildList(root));
|
||||
|
@ -233,7 +233,7 @@ const MOZILLA_PKIX_ERROR_NOT_YET_VALID_CERTIFICATE = MOZILLA_PKIX_ERROR_BASE + 5
|
||||
|
||||
const PREF_BLOCKLIST_CLOCK_SKEW_SECONDS = "services.blocklist.clock_skew_seconds";
|
||||
|
||||
const PREF_SSL_IMPACT_ROOTS = ["security.tls.version.min", "security.tls.version.max", "security.ssl3."];
|
||||
const PREF_SSL_IMPACT_ROOTS = ["security.tls.version.", "security.ssl3."];
|
||||
|
||||
const PREF_SSL_IMPACT = PREF_SSL_IMPACT_ROOTS.reduce((prefs, root) => {
|
||||
return prefs.concat(Services.prefs.getChildList(root));
|
||||
|
@ -10,6 +10,7 @@ const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}");
|
||||
const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
|
||||
@ -889,16 +890,14 @@ FeedWriter.prototype = {
|
||||
let ssm = Services.scriptSecurityManager;
|
||||
let nullPrincipal = ssm.createNullPrincipal(attrs);
|
||||
|
||||
let resolvedURI = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
newChannel2("about:feeds",
|
||||
null,
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
nullPrincipal,
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER).URI;
|
||||
// this channel is not going to be openend, use a nullPrincipal
|
||||
// and the most restrctive securityFlag.
|
||||
let resolvedURI = NetUtil.newChannel({
|
||||
uri: "about:feeds",
|
||||
loadingPrincipal: nullPrincipal,
|
||||
securityFlags: Ci.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
|
||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER
|
||||
}).URI;
|
||||
|
||||
if (resolvedURI.equals(chan.URI))
|
||||
return chan.originalURI;
|
||||
|
@ -16,9 +16,9 @@
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.8.0 (db2939409 2016-04-11)",
|
||||
"size": 123218320,
|
||||
"digest": "7afcd7b39c4d5277db6b28951602aff4c698102ba45d3d811b353ca7446074beceebf03a2a529e323af19d73db4acbe96ec2bdad44def2e218ed36f55e82cab2",
|
||||
"version": "gecko rust 1.9.0 (commit e4e8b666850a763fdf1c3c2c142856ab51e32779)",
|
||||
"size": 96854912,
|
||||
"digest": "d613d5528e83bb73917372948c05a766912a9dd0ec4e8a5fab69161a515c1545d52e9ed3394716df96a9dcdf1c086b6f970413e97c2df78a11e5f9151573921a",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
@ -16,9 +16,9 @@
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"version": "rustc 1.8.0 (db2939409 2016-04-11)",
|
||||
"size": 123218320,
|
||||
"digest": "7afcd7b39c4d5277db6b28951602aff4c698102ba45d3d811b353ca7446074beceebf03a2a529e323af19d73db4acbe96ec2bdad44def2e218ed36f55e82cab2",
|
||||
"version": "gecko rust 1.9.0 (commit e4e8b666850a763fdf1c3c2c142856ab51e32779)",
|
||||
"size": 96854912,
|
||||
"digest": "d613d5528e83bb73917372948c05a766912a9dd0ec4e8a5fab69161a515c1545d52e9ed3394716df96a9dcdf1c086b6f970413e97c2df78a11e5f9151573921a",
|
||||
"algorithm": "sha512",
|
||||
"filename": "rustc.tar.xz",
|
||||
"unpack": true
|
||||
|
@ -126,11 +126,6 @@ interface nsIScriptSecurityManager : nsISupports
|
||||
in AUTF8String uri,
|
||||
in unsigned long flags);
|
||||
|
||||
/**
|
||||
* Return true if scripts may be executed in the scope of the given global.
|
||||
*/
|
||||
[noscript,notxpcom] boolean scriptAllowed(in JSObjectPtr aGlobal);
|
||||
|
||||
///////////////// Principals ///////////////////////
|
||||
|
||||
/**
|
||||
|
@ -227,20 +227,6 @@ private:
|
||||
bool mMustFreeName;
|
||||
};
|
||||
|
||||
JSContext *
|
||||
nsScriptSecurityManager::GetCurrentJSContext()
|
||||
{
|
||||
// Get JSContext from stack.
|
||||
return nsXPConnect::XPConnect()->GetCurrentJSContext();
|
||||
}
|
||||
|
||||
JSContext *
|
||||
nsScriptSecurityManager::GetSafeJSContext()
|
||||
{
|
||||
// Get JSContext from stack.
|
||||
return nsXPConnect::XPConnect()->GetSafeJSContext();
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsScriptSecurityManager::SecurityCompareURIs(nsIURI* aSourceURI,
|
||||
@ -1112,16 +1098,6 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(nsIPrincipal* aPrincipal,
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
nsScriptSecurityManager::ScriptAllowed(JSObject *aGlobal)
|
||||
{
|
||||
MOZ_ASSERT(aGlobal);
|
||||
MOZ_ASSERT(JS_IsGlobalObject(aGlobal) || js::IsWindowProxy(aGlobal));
|
||||
|
||||
// Check the bits on the compartment private.
|
||||
return xpc::Scriptability::Get(aGlobal).Allowed();
|
||||
}
|
||||
|
||||
///////////////// Principals ///////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -58,10 +58,6 @@ public:
|
||||
static nsSystemPrincipal*
|
||||
SystemPrincipalSingletonConstructor();
|
||||
|
||||
JSContext* GetCurrentJSContext();
|
||||
|
||||
JSContext* GetSafeJSContext();
|
||||
|
||||
/**
|
||||
* Utility method for comparing two URIs. For security purposes, two URIs
|
||||
* are equivalent if their schemes, hosts, and ports (if any) match. This
|
||||
|
@ -78,7 +78,7 @@ struct ParamTraits<SerializedURI>
|
||||
WriteParam(aMsg, aParam.charset);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
nsCString spec, charset;
|
||||
if (ReadParam(aMsg, aIter, &spec) &&
|
||||
@ -105,7 +105,7 @@ struct ParamTraits<ChromePackage>
|
||||
WriteParam(aMsg, aParam.flags);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
nsCString package;
|
||||
SerializedURI contentBaseURI, localeBaseURI, skinBaseURI;
|
||||
@ -147,7 +147,7 @@ struct ParamTraits<SubstitutionMapping>
|
||||
WriteParam(aMsg, aParam.resolvedURI);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
nsCString scheme, path;
|
||||
SerializedURI resolvedURI;
|
||||
@ -183,7 +183,7 @@ struct ParamTraits<OverrideMapping>
|
||||
WriteParam(aMsg, aParam.overrideURI);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
SerializedURI originalURI;
|
||||
SerializedURI overrideURI;
|
||||
|
@ -187,6 +187,12 @@ function ResponsiveUI(aWindow, aTab)
|
||||
this.mm.addMessageListener("ResponsiveMode:OnContentResize",
|
||||
this.bound_onContentResize);
|
||||
|
||||
// We must be ready to handle window or tab close now that we have saved
|
||||
// ourselves in ActiveTabs. Otherwise we risk leaking the window.
|
||||
this.mainWindow.addEventListener("unload", this);
|
||||
this.tab.addEventListener("TabClose", this);
|
||||
this.tabContainer.addEventListener("TabSelect", this);
|
||||
|
||||
ActiveTabs.set(this.tab, this);
|
||||
|
||||
this.inited = this.init();
|
||||
@ -226,10 +232,6 @@ ResponsiveUI.prototype = {
|
||||
// Load Presets
|
||||
this.loadPresets();
|
||||
|
||||
// Events
|
||||
this.tab.addEventListener("TabClose", this);
|
||||
this.tabContainer.addEventListener("TabSelect", this);
|
||||
|
||||
// Setup the UI
|
||||
this.container.setAttribute("responsivemode", "true");
|
||||
this.stack.setAttribute("responsivemode", "true");
|
||||
@ -343,8 +345,9 @@ ResponsiveUI.prototype = {
|
||||
debug("RESET STACK SIZE");
|
||||
this.stack.setAttribute("style", style);
|
||||
|
||||
// Wait for resize message before stopping in the child when testing
|
||||
if (DevToolsUtils.testing) {
|
||||
// Wait for resize message before stopping in the child when testing,
|
||||
// but only if we should expect to still get a message.
|
||||
if (DevToolsUtils.testing && this.tab.linkedBrowser.messageManager) {
|
||||
yield this.waitForMessage("ResponsiveMode:OnContentResize");
|
||||
}
|
||||
|
||||
@ -354,6 +357,7 @@ ResponsiveUI.prototype = {
|
||||
// Remove listeners.
|
||||
this.menulist.removeEventListener("select", this.bound_presetSelected, true);
|
||||
this.menulist.removeEventListener("change", this.bound_handleManualInput, true);
|
||||
this.mainWindow.removeEventListener("unload", this);
|
||||
this.tab.removeEventListener("TabClose", this);
|
||||
this.tabContainer.removeEventListener("TabSelect", this);
|
||||
this.rotatebutton.removeEventListener("command", this.bound_rotate, true);
|
||||
@ -362,6 +366,7 @@ ResponsiveUI.prototype = {
|
||||
this.addbutton.removeEventListener("command", this.bound_addPreset, true);
|
||||
this.removebutton.removeEventListener("command", this.bound_removePreset, true);
|
||||
this.touchbutton.removeEventListener("command", this.bound_touch, true);
|
||||
this.userAgentInput.removeEventListener("blur", this.bound_changeUA, true);
|
||||
|
||||
// Removed elements.
|
||||
this.container.removeChild(this.toolbar);
|
||||
@ -391,9 +396,11 @@ ResponsiveUI.prototype = {
|
||||
|
||||
this._telemetry.toolClosed("responsive");
|
||||
|
||||
let stopped = this.waitForMessage("ResponsiveMode:Stop:Done");
|
||||
this.tab.linkedBrowser.messageManager.sendAsyncMessage("ResponsiveMode:Stop");
|
||||
yield stopped;
|
||||
if (this.tab.linkedBrowser.messageManager) {
|
||||
let stopped = this.waitForMessage("ResponsiveMode:Stop:Done");
|
||||
this.tab.linkedBrowser.messageManager.sendAsyncMessage("ResponsiveMode:Stop");
|
||||
yield stopped;
|
||||
}
|
||||
|
||||
this.inited = null;
|
||||
ResponsiveUIManager.emit("off", { tab: this.tab });
|
||||
@ -426,6 +433,7 @@ ResponsiveUI.prototype = {
|
||||
handleEvent: function (aEvent) {
|
||||
switch (aEvent.type) {
|
||||
case "TabClose":
|
||||
case "unload":
|
||||
this.close();
|
||||
break;
|
||||
case "TabSelect":
|
||||
@ -449,7 +457,10 @@ ResponsiveUI.prototype = {
|
||||
* Uncheck the menu items.
|
||||
*/
|
||||
unCheckMenus: function RUI_unCheckMenus() {
|
||||
this.chromeDoc.getElementById("menu_responsiveUI").setAttribute("checked", "false");
|
||||
let el = this.chromeDoc.getElementById("menu_responsiveUI");
|
||||
if (el) {
|
||||
el.setAttribute("checked", "false");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -17,3 +17,4 @@ skip-if = e10s && debug # Bug 1252201 - Docshell leak on debug e10s
|
||||
[browser_responsiveuiaddcustompreset.js]
|
||||
[browser_responsive_devicewidth.js]
|
||||
[browser_responsiveui_customuseragent.js]
|
||||
[browser_responsiveui_window_close.js]
|
||||
|
@ -0,0 +1,25 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
let newWindowPromise = BrowserTestUtils.waitForNewWindow();
|
||||
window.open("about:blank", "_blank");
|
||||
let newWindow = yield newWindowPromise;
|
||||
|
||||
newWindow.focus();
|
||||
yield once(newWindow.gBrowser, "load", true);
|
||||
|
||||
let tab = newWindow.gBrowser.selectedTab;
|
||||
yield ResponsiveUIManager.runIfNeeded(newWindow, tab);
|
||||
|
||||
// Close the window on a tab with an active responsive design UI and
|
||||
// wait for the UI to gracefully shutdown. This has leaked the window
|
||||
// in the past.
|
||||
ok(ResponsiveUIManager.isActiveForTab(tab),
|
||||
"ResponsiveUI should be active for tab when the window is closed");
|
||||
let offPromise = once(ResponsiveUIManager, "off");
|
||||
yield BrowserTestUtils.closeWindow(newWindow);
|
||||
yield offPromise;
|
||||
});
|
@ -41,13 +41,19 @@ function sanitizeHost(host) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The cookie 'expires' value needs converting into something more readable
|
||||
* The cookie 'expires' value needs converting into something more readable.
|
||||
*
|
||||
* And the unit of expires is sec, the unit that in argument of Date() needs
|
||||
* millisecond.
|
||||
*/
|
||||
function translateExpires(expires) {
|
||||
if (expires == 0) {
|
||||
return l10n.lookup("cookieListOutSession");
|
||||
}
|
||||
return new Date(expires).toLocaleString();
|
||||
|
||||
let expires_msec = expires * 1000;
|
||||
|
||||
return (new Date(expires_msec)).toLocaleString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,7 +76,7 @@ struct ParamTraits<SerializedLoadContext>
|
||||
WriteParam(aMsg, suffix);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
nsAutoCString suffix;
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) ||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "AnimationUtils.h"
|
||||
#include "mozilla/dom/AnimationBinding.h"
|
||||
#include "mozilla/dom/AnimationPlaybackEvent.h"
|
||||
#include "mozilla/dom/DocumentTimeline.h"
|
||||
#include "mozilla/AnimationTarget.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h" // For AsyncEventDispatcher
|
||||
@ -87,7 +88,7 @@ namespace {
|
||||
/* static */ already_AddRefed<Animation>
|
||||
Animation::Constructor(const GlobalObject& aGlobal,
|
||||
KeyframeEffectReadOnly* aEffect,
|
||||
AnimationTimeline* aTimeline,
|
||||
const Optional<AnimationTimeline*>& aTimeline,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
@ -99,7 +100,20 @@ Animation::Constructor(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
animation->SetTimeline(aTimeline);
|
||||
AnimationTimeline* timeline;
|
||||
if (aTimeline.WasPassed()) {
|
||||
timeline = aTimeline.Value();
|
||||
} else {
|
||||
nsIDocument* document =
|
||||
AnimationUtils::GetCurrentRealmDocument(aGlobal.Context());
|
||||
if (!document) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
timeline = document->Timeline();
|
||||
}
|
||||
|
||||
animation->SetTimeline(timeline);
|
||||
animation->SetEffect(aEffect);
|
||||
|
||||
return animation.forget();
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
static already_AddRefed<Animation>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
KeyframeEffectReadOnly* aEffect,
|
||||
AnimationTimeline* aTimeline,
|
||||
const Optional<AnimationTimeline*>& aTimeline,
|
||||
ErrorResult& aRv);
|
||||
void GetId(nsAString& aResult) const { aResult = mId; }
|
||||
void SetId(const nsAString& aId);
|
||||
|
@ -1848,7 +1848,7 @@ ParamTraits<Metadata>::Write(Message* aMsg, const paramType& aParam)
|
||||
}
|
||||
|
||||
bool
|
||||
ParamTraits<Metadata>::Read(const Message* aMsg, void** aIter,
|
||||
ParamTraits<Metadata>::Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult)
|
||||
{
|
||||
for (unsigned i = 0; i < Metadata::kNumEntries; i++) {
|
||||
@ -1887,7 +1887,7 @@ ParamTraits<WriteParams>::Write(Message* aMsg, const paramType& aParam)
|
||||
}
|
||||
|
||||
bool
|
||||
ParamTraits<WriteParams>::Read(const Message* aMsg, void** aIter,
|
||||
ParamTraits<WriteParams>::Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mSize) &&
|
||||
|
@ -169,7 +169,7 @@ struct ParamTraits<mozilla::dom::asmjscache::Metadata>
|
||||
{
|
||||
typedef mozilla::dom::asmjscache::Metadata paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult);
|
||||
static void Log(const paramType& aParam, std::wstring* aLog);
|
||||
};
|
||||
|
||||
@ -178,7 +178,7 @@ struct ParamTraits<mozilla::dom::asmjscache::WriteParams>
|
||||
{
|
||||
typedef mozilla::dom::asmjscache::WriteParams paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult);
|
||||
static void Log(const paramType& aParam, std::wstring* aLog);
|
||||
};
|
||||
|
||||
|
@ -3334,9 +3334,10 @@ Element::Animate(const Nullable<ElementOrCSSPseudoElement>& aTarget,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AnimationTimeline* timeline = referenceElement->OwnerDoc()->Timeline();
|
||||
RefPtr<Animation> animation =
|
||||
Animation::Constructor(global, effect,
|
||||
referenceElement->OwnerDoc()->Timeline(), aError);
|
||||
Optional<AnimationTimeline*>(timeline), aError);
|
||||
if (aError.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -781,9 +781,7 @@ danger::AutoCxPusher::AutoCxPusher(JSContext* cx, bool allowNull)
|
||||
mScx = GetScriptContextFromJSContext(cx);
|
||||
|
||||
XPCJSContextStack *stack = XPCJSRuntime::Get()->GetJSContextStack();
|
||||
if (!stack->Push(cx)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
stack->Push(cx);
|
||||
mStackDepthAfterPush = stack->Count();
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -120,6 +120,8 @@ ContentAreaDropListener.prototype =
|
||||
// also check for nodes in other child or sibling frames by checking
|
||||
// if both have the same top window.
|
||||
if (sourceDocument && eventDocument) {
|
||||
if (sourceDocument.defaultView == null)
|
||||
return true;
|
||||
let sourceRoot = sourceDocument.defaultView.top;
|
||||
if (sourceRoot && sourceRoot == eventDocument.defaultView.top)
|
||||
return false;
|
||||
|
@ -7424,7 +7424,8 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
||||
size_t length;
|
||||
int32_t stride;
|
||||
mozilla::UniquePtr<char[]> surfaceData =
|
||||
nsContentUtils::GetSurfaceData(dataSurface, &length, &stride);
|
||||
nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
|
||||
&stride);
|
||||
|
||||
IPCDataTransferItem* item = aIPCDataTransfer->items().AppendElement();
|
||||
item->flavor() = flavorStr;
|
||||
@ -7528,8 +7529,9 @@ nsContentUtils::TransferableToIPCTransferable(nsITransferable* aTransferable,
|
||||
}
|
||||
|
||||
mozilla::UniquePtr<char[]>
|
||||
nsContentUtils::GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride)
|
||||
nsContentUtils::GetSurfaceData(
|
||||
NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||
size_t* aLength, int32_t* aStride)
|
||||
{
|
||||
mozilla::gfx::DataSourceSurface::MappedSurface map;
|
||||
if (NS_WARN_IF(!aSurface->Map(mozilla::gfx::DataSourceSurface::MapType::READ, &map))) {
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
@ -2432,8 +2433,9 @@ public:
|
||||
* Get the pixel data from the given source surface and return it as a buffer.
|
||||
* The length and stride will be assigned from the surface.
|
||||
*/
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(mozilla::gfx::DataSourceSurface* aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
static mozilla::UniquePtr<char[]> GetSurfaceData(
|
||||
mozilla::NotNull<mozilla::gfx::DataSourceSurface*> aSurface,
|
||||
size_t* aLength, int32_t* aStride);
|
||||
|
||||
// Helpers shared by the implementations of nsContentUtils methods and
|
||||
// nsIDOMWindowUtils methods.
|
||||
|
@ -30,8 +30,6 @@ GetScriptContextFromJSContext(JSContext *cx)
|
||||
return scx;
|
||||
}
|
||||
|
||||
JSObject* GetDefaultScopeFromJSContext(JSContext *cx);
|
||||
|
||||
// A factory function for turning a JS::Value argv into an nsIArray
|
||||
// but also supports an effecient way of extracting the original argv.
|
||||
// The resulting object will take a copy of the array, and ensure each
|
||||
|
@ -138,6 +138,7 @@
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
@ -8472,9 +8473,6 @@ nsDocument::IsScriptEnabled()
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
|
||||
NS_ENSURE_TRUE(sm, false);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(GetInnerWindow());
|
||||
if (!globalObject && mMasterDocument) {
|
||||
globalObject = do_QueryInterface(mMasterDocument->GetInnerWindow());
|
||||
@ -8483,7 +8481,7 @@ nsDocument::IsScriptEnabled()
|
||||
return false;
|
||||
}
|
||||
|
||||
return sm->ScriptAllowed(globalObject->GetGlobalJSObject());
|
||||
return xpc::Scriptability::Get(globalObject->GetGlobalJSObject()).Allowed();
|
||||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
|
@ -8111,7 +8111,6 @@ nsGlobalWindow::Open(const nsAString& aUrl, const nsAString& aName,
|
||||
false, // aDoJSFixups
|
||||
true, // aNavigate
|
||||
nullptr, nullptr, // No args
|
||||
nullptr, // aJSCallerContext
|
||||
_retval);
|
||||
}
|
||||
|
||||
@ -8127,7 +8126,6 @@ nsGlobalWindow::OpenJS(const nsAString& aUrl, const nsAString& aName,
|
||||
true, // aDoJSFixups
|
||||
true, // aNavigate
|
||||
nullptr, nullptr, // No args
|
||||
nsContentUtils::GetCurrentJSContext(), // aJSCallerContext
|
||||
_retval);
|
||||
}
|
||||
|
||||
@ -8147,7 +8145,6 @@ nsGlobalWindow::OpenDialog(const nsAString& aUrl, const nsAString& aName,
|
||||
false, // aDoJSFixups
|
||||
true, // aNavigate
|
||||
nullptr, aExtraArgument, // Arguments
|
||||
nullptr, // aJSCallerContext
|
||||
_retval);
|
||||
}
|
||||
|
||||
@ -8166,7 +8163,6 @@ nsGlobalWindow::OpenNoNavigate(const nsAString& aUrl,
|
||||
false, // aDoJSFixups
|
||||
false, // aNavigate
|
||||
nullptr, nullptr, // No args
|
||||
nullptr, // aJSCallerContext
|
||||
_retval);
|
||||
|
||||
}
|
||||
@ -8195,7 +8191,6 @@ nsGlobalWindow::OpenDialogOuter(JSContext* aCx, const nsAString& aUrl,
|
||||
false, // aDoJSFixups
|
||||
true, // aNavigate
|
||||
argvArray, nullptr, // Arguments
|
||||
aCx, // aJSCallerContext
|
||||
getter_AddRefs(dialog));
|
||||
return dialog.forget();
|
||||
}
|
||||
@ -8633,13 +8628,14 @@ nsGlobalWindow::FinalClose()
|
||||
// broken addons. The chrome tests in toolkit/mozapps/downloads are a good
|
||||
// testing ground.
|
||||
//
|
||||
// In particular, if |win|'s JSContext is at the top of the stack, we must
|
||||
// In particular, if some inner of |win| is the entry global, we must
|
||||
// complete _two_ round-trips to the event loop before the call to
|
||||
// ReallyCloseWindow. This allows setTimeout handlers that are set after
|
||||
// FinalClose() is called to run before the window is torn down.
|
||||
bool indirect = GetContextInternal() && // Occasionally null. See bug 877390.
|
||||
(nsContentUtils::GetCurrentJSContext() ==
|
||||
GetContextInternal()->GetNativeContext());
|
||||
nsCOMPtr<nsPIDOMWindowInner> entryWindow =
|
||||
do_QueryInterface(GetEntryGlobal());
|
||||
bool indirect =
|
||||
entryWindow && entryWindow->GetOuterWindow() == this->AsOuter();
|
||||
if (NS_FAILED(nsCloseEvent::PostCloseEvent(this, indirect))) {
|
||||
ReallyCloseWindow();
|
||||
} else {
|
||||
@ -9275,7 +9271,6 @@ nsGlobalWindow::ShowModalDialogOuter(const nsAString& aUrl, nsIVariant* aArgumen
|
||||
true, // aDoJSFixups
|
||||
true, // aNavigate
|
||||
nullptr, argHolder, // args
|
||||
nullptr, // aJSCallerContext
|
||||
getter_AddRefs(dlgWin));
|
||||
nsContentUtils::SetMicroTaskLevel(oldMicroTaskLevel);
|
||||
LeaveModalState();
|
||||
@ -11744,7 +11739,6 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
bool aDoJSFixups, bool aNavigate,
|
||||
nsIArray *argv,
|
||||
nsISupports *aExtraArgument,
|
||||
JSContext *aJSCallerContext,
|
||||
nsPIDOMWindowOuter **aReturn)
|
||||
{
|
||||
MOZ_ASSERT(IsOuterWindow());
|
||||
@ -11758,8 +11752,6 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
"Can't pass in arguments both ways");
|
||||
NS_PRECONDITION(!aCalledNoScript || (!argv && argc == 0),
|
||||
"Can't pass JS args when called via the noscript methods");
|
||||
NS_PRECONDITION(!aJSCallerContext || !aCalledNoScript,
|
||||
"Shouldn't have caller context when called noscript");
|
||||
|
||||
mozilla::Maybe<AutoUnblockScriptClosing> closeUnblocker;
|
||||
|
||||
@ -11820,13 +11812,18 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
if (checkForPopup) {
|
||||
abuseLevel = RevisePopupAbuseLevel(abuseLevel);
|
||||
if (abuseLevel >= openAbused) {
|
||||
if (aJSCallerContext) {
|
||||
if (!aCalledNoScript) {
|
||||
// If script in some other window is doing a window.open on us and
|
||||
// it's being blocked, then it's OK to close us afterwards, probably.
|
||||
// But if we're doing a window.open on ourselves and block the popup,
|
||||
// prevent this window from closing until after this script terminates
|
||||
// so that whatever popup blocker UI the app has will be visible.
|
||||
if (mContext == GetScriptContextFromJSContext(aJSCallerContext)) {
|
||||
nsCOMPtr<nsPIDOMWindowInner> entryWindow =
|
||||
do_QueryInterface(GetEntryGlobal());
|
||||
// Note that entryWindow can be null here if some JS component was the
|
||||
// place where script was entered for this JS execution.
|
||||
if (entryWindow &&
|
||||
entryWindow->GetOuterWindow() == this->AsOuter()) {
|
||||
mBlockScriptedClosingFlag = true;
|
||||
closeUnblocker.emplace(this);
|
||||
}
|
||||
|
@ -1431,9 +1431,6 @@ private:
|
||||
* @param aExtraArgument Another way to pass arguments in. This is mutually
|
||||
* exclusive with the argv/argc approach.
|
||||
*
|
||||
* @param aJSCallerContext The calling script's context. This must be null
|
||||
* when aCalledNoScript is true.
|
||||
*
|
||||
* @param aReturn [out] The window that was opened, if any.
|
||||
*
|
||||
* Outer windows only.
|
||||
@ -1448,7 +1445,6 @@ private:
|
||||
bool aNavigate,
|
||||
nsIArray *argv,
|
||||
nsISupports *aExtraArgument,
|
||||
JSContext *aJSCallerContext,
|
||||
nsPIDOMWindowOuter **aReturn);
|
||||
|
||||
public:
|
||||
|
@ -174,8 +174,7 @@ nsJSUtils::EvaluateString(JSContext* aCx,
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(ssm->ScriptAllowed(aEvaluationGlobal), NS_OK);
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
|
||||
|
||||
bool ok = true;
|
||||
// Scope the JSAutoCompartment so that we can later wrap the return value
|
||||
@ -294,8 +293,7 @@ nsJSUtils::CompileModule(JSContext* aCx,
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(ssm->ScriptAllowed(aEvaluationGlobal), NS_OK);
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
|
||||
|
||||
if (!JS::CompileModule(aCx, aCompileOptions, aSrcBuf, aModule)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -316,9 +314,7 @@ nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*>
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
JSObject* global = JS_GetGlobalForObject(aCx, aModule);
|
||||
NS_ENSURE_TRUE(ssm->ScriptAllowed(global), NS_OK);
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
|
||||
|
||||
if (!JS::ModuleDeclarationInstantiation(aCx, aModule)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -339,9 +335,7 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
||||
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
JSObject* global = JS_GetGlobalForObject(aCx, aModule);
|
||||
NS_ENSURE_TRUE(ssm->ScriptAllowed(global), NS_OK);
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
|
||||
|
||||
if (!JS::ModuleEvaluation(aCx, aModule)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -381,15 +375,6 @@ nsJSUtils::ResetTimeZone()
|
||||
// nsDOMJSUtils.h
|
||||
//
|
||||
|
||||
JSObject* GetDefaultScopeFromJSContext(JSContext *cx)
|
||||
{
|
||||
// DOM JSContexts don't store their default compartment object on
|
||||
// the cx, so in those cases we need to fetch it via the scx
|
||||
// instead.
|
||||
nsIScriptContext *scx = GetScriptContextFromJSContext(cx);
|
||||
return scx ? scx->GetWindowProxy() : nullptr;
|
||||
}
|
||||
|
||||
bool nsAutoJSString::init(const JS::Value &v)
|
||||
{
|
||||
JSContext* cx = nsContentUtils::RootingCxForThread();
|
||||
|
@ -2002,7 +2002,7 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest)
|
||||
}
|
||||
|
||||
if (aRequest->IsModuleRequest()) {
|
||||
rv = EnsureModuleResolveHook(context->GetNativeContext());
|
||||
rv = EnsureModuleResolveHook(aes.cx());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsModuleLoadRequest* request = aRequest->AsModuleRequest();
|
||||
|
@ -173,7 +173,7 @@ ErrorResult::SerializeMessage(IPC::Message* aMsg) const
|
||||
}
|
||||
|
||||
bool
|
||||
ErrorResult::DeserializeMessage(const IPC::Message* aMsg, void** aIter)
|
||||
ErrorResult::DeserializeMessage(const IPC::Message* aMsg, PickleIterator* aIter)
|
||||
{
|
||||
using namespace IPC;
|
||||
nsAutoPtr<Message> readMessage(new Message());
|
||||
@ -295,7 +295,7 @@ ErrorResult::SerializeDOMExceptionInfo(IPC::Message* aMsg) const
|
||||
}
|
||||
|
||||
bool
|
||||
ErrorResult::DeserializeDOMExceptionInfo(const IPC::Message* aMsg, void** aIter)
|
||||
ErrorResult::DeserializeDOMExceptionInfo(const IPC::Message* aMsg, PickleIterator* aIter)
|
||||
{
|
||||
using namespace IPC;
|
||||
nsCString message;
|
||||
@ -2182,7 +2182,7 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
|
||||
if (jsipc::IsWrappedCPOW(instance)) {
|
||||
bool boolp = false;
|
||||
if (!jsipc::DOMInstanceOf(cx, js::CheckedUnwrap(instance), clasp->mPrototypeID,
|
||||
if (!jsipc::DOMInstanceOf(cx, js::UncheckedUnwrap(instance), clasp->mPrototypeID,
|
||||
clasp->mDepth, &boolp)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "xpcprivate.h"
|
||||
#include "WorkerPrivate.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
@ -177,8 +176,7 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||
// Check that it's ok to run this callback at all.
|
||||
// Make sure to use realCallback to get the global of the callback object,
|
||||
// not the wrapper.
|
||||
bool allowed = nsContentUtils::GetSecurityManager()->
|
||||
ScriptAllowed(js::GetGlobalForObjectCrossCompartment(realCallback));
|
||||
bool allowed = xpc::Scriptability::Get(realCallback).Allowed();
|
||||
|
||||
if (!allowed) {
|
||||
aRv.ThrowDOMException(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
|
||||
|
@ -50,7 +50,7 @@ struct ParamTraits<mozilla::ErrorResult>
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
paramType readValue;
|
||||
if (!ReadParam(aMsg, aIter, &readValue.mResult)) {
|
||||
|
@ -36,6 +36,7 @@ namespace IPC {
|
||||
class Message;
|
||||
template <typename> struct ParamTraits;
|
||||
} // namespace IPC
|
||||
class PickleIterator;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -307,10 +308,10 @@ private:
|
||||
|
||||
friend struct IPC::ParamTraits<ErrorResult>;
|
||||
void SerializeMessage(IPC::Message* aMsg) const;
|
||||
bool DeserializeMessage(const IPC::Message* aMsg, void** aIter);
|
||||
bool DeserializeMessage(const IPC::Message* aMsg, PickleIterator* aIter);
|
||||
|
||||
void SerializeDOMExceptionInfo(IPC::Message* aMsg) const;
|
||||
bool DeserializeDOMExceptionInfo(const IPC::Message* aMsg, void** aIter);
|
||||
bool DeserializeDOMExceptionInfo(const IPC::Message* aMsg, PickleIterator* aIter);
|
||||
|
||||
// Helper method that creates a new Message for this ErrorResult,
|
||||
// and returns the arguments array from that Message.
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "mozilla/dom/BluetoothMapParametersBinding.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "BluetoothUuidHelper.h"
|
||||
|
||||
#include "mozilla/dom/BluetoothPbapParametersBinding.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include "BluetoothInterface.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "nsClassHashtable.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include "mozilla/Compiler.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsPrintfCString.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define mozilla_dom_bluetooth_ObexBase_h
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
|
@ -24,7 +24,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothAddress>
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
for (size_t i = 0; i < MOZ_ARRAY_LENGTH(aResult->mAddr); ++i) {
|
||||
if (!ReadParam(aMsg, aIter, aResult->mAddr + i)) {
|
||||
@ -61,7 +61,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothPinCode>
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mLength)) {
|
||||
return false;
|
||||
@ -97,7 +97,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothRemoteName>
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mLength)) {
|
||||
return false;
|
||||
@ -158,7 +158,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothUuid>
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mUuid[i]))) {
|
||||
@ -181,7 +181,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattId>
|
||||
WriteParam(aMsg, aParam.mInstanceId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mUuid)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mInstanceId))) {
|
||||
@ -203,7 +203,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattServiceId>
|
||||
WriteParam(aMsg, aParam.mIsPrimary);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mIsPrimary))) {
|
||||
@ -226,7 +226,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattCharAttribute>
|
||||
WriteParam(aMsg, aParam.mWriteType);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mProperties)) ||
|
||||
@ -248,7 +248,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothAttributeHandle>
|
||||
WriteParam(aMsg, aParam.mHandle);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mHandle))) {
|
||||
return false;
|
||||
@ -279,7 +279,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattResponse>
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mHandle)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mOffset)) ||
|
||||
@ -312,7 +312,7 @@ struct ParamTraits<mozilla::dom::bluetooth::ControlPlayStatus>
|
||||
WriteParam(aMsg, static_cast<uint8_t>(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
uint8_t value;
|
||||
if (!ReadParam(aMsg, aIter, &value)) {
|
||||
@ -352,7 +352,7 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattAdvertisingData>
|
||||
WriteParam(aMsg, aParam.mServiceUuids);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mAppearance)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mIncludeDevName)) ||
|
||||
|
@ -82,7 +82,7 @@
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Helpers.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ Event::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
Event::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
Event::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
|
||||
{
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &type), false);
|
||||
|
@ -140,7 +140,7 @@ NotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
NotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
NotifyPaintEvent::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
return Event::DuplicatePrivateData();
|
||||
}
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) override;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
|
||||
|
||||
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ ScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
ScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
ScrollAreaEvent::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
return Event::DuplicatePrivateData();
|
||||
}
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) override;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
|
||||
|
||||
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ UIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
UIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
UIEvent::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), false);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
|
||||
NS_IMETHOD DuplicatePrivateData() override;
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) override;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
|
||||
|
||||
|
||||
static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
|
||||
@ -139,7 +139,7 @@ protected:
|
||||
UIEvent::Serialize(aMsg, aSerializeInterfaceType); \
|
||||
} \
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \
|
||||
void** aIter) override \
|
||||
PickleIterator* aIter) override \
|
||||
{ \
|
||||
return UIEvent::Deserialize(aMsg, aIter); \
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ struct ParamTraits<nsIDOMGeoPositionCoords*>
|
||||
}
|
||||
|
||||
// Function to de-serialize a geoposition
|
||||
static bool Read(const Message* aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// Check if it is the null pointer we have transfered
|
||||
bool isNull;
|
||||
@ -119,7 +119,7 @@ struct ParamTraits<nsIDOMGeoPosition*>
|
||||
}
|
||||
|
||||
// Function to de-serialize a geoposition
|
||||
static bool Read(const Message* aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// Check if it is the null pointer we have transfered
|
||||
bool isNull;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/AppProcessChecker.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "js/Date.h"
|
||||
#include "js/StructuredClone.h"
|
||||
#include "KeyPath.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "js/Date.h"
|
||||
#include "js/Value.h"
|
||||
#include "jsfriendapi.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozIStorageStatement.h"
|
||||
#include "mozIStorageValueArray.h"
|
||||
|
@ -26,7 +26,7 @@ struct ParamTraits<mozilla::dom::indexedDB::Key>
|
||||
WriteParam(aMsg, aParam.mBuffer);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mBuffer);
|
||||
}
|
||||
@ -55,7 +55,7 @@ struct ParamTraits<mozilla::dom::indexedDB::KeyPath>
|
||||
WriteParam(aMsg, aParam.mStrings);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStrings);
|
||||
|
@ -11,6 +11,7 @@ interface nsIDOMEventTarget;
|
||||
[ptr] native DOMEventPtr(mozilla::dom::Event);
|
||||
[ptr] native IPCMessagePtr(IPC::Message);
|
||||
[ptr] native ConstIPCMessagePtr(const IPC::Message);
|
||||
[ptr] native PickleIterator(PickleIterator);
|
||||
[ptr] native EventTargetPtr(mozilla::dom::EventTarget);
|
||||
%{C++
|
||||
#ifdef ERROR
|
||||
@ -23,6 +24,7 @@ class nsInvalidateRequestList;
|
||||
namespace IPC {
|
||||
class Message;
|
||||
}
|
||||
class PickleIterator;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Event;
|
||||
@ -211,7 +213,7 @@ interface nsIDOMEvent : nsISupports
|
||||
[noscript,notxpcom] void SetTrusted(in boolean aTrusted);
|
||||
[notxpcom] void Serialize(in IPCMessagePtr aMsg,
|
||||
in boolean aSerializeInterfaceType);
|
||||
[notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, out voidPtr aIter);
|
||||
[notxpcom] boolean Deserialize(in ConstIPCMessagePtr aMsg, in PickleIterator aIter);
|
||||
[noscript,notxpcom] void SetOwner(in EventTargetPtr aOwner);
|
||||
[notxpcom] DOMEventPtr InternalDOMEvent();
|
||||
[noscript] void stopCrossProcessForwarding();
|
||||
|
@ -643,6 +643,8 @@ ContentChild::Init(MessageLoop* aIOLoop,
|
||||
int argc = 3;
|
||||
char option_name[] = "--display";
|
||||
char* argv[] = {
|
||||
// argv0 is unused because g_set_prgname() was called in
|
||||
// XRE_InitChildProcess().
|
||||
nullptr,
|
||||
option_name,
|
||||
display_name,
|
||||
|
@ -62,7 +62,7 @@ struct ParamTraits<mozilla::dom::IdType<T>>
|
||||
WriteParam(aMsg, aParam.mId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mId);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ ParamTraits<Principal>::Write(Message* aMsg, const paramType& aParam) {
|
||||
}
|
||||
|
||||
bool
|
||||
ParamTraits<Principal>::Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
ParamTraits<Principal>::Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
bool isNull;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) {
|
||||
|
@ -39,7 +39,7 @@ struct ParamTraits<Principal>
|
||||
{
|
||||
typedef Principal paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
@ -98,14 +98,13 @@ StructuredCloneData::WriteIPCParams(IPC::Message* aMsg) const
|
||||
WriteParam(aMsg, DataLength());
|
||||
|
||||
if (DataLength()) {
|
||||
// Structured clone data must be 64-bit aligned.
|
||||
aMsg->WriteBytes(Data(), DataLength(), sizeof(uint64_t));
|
||||
aMsg->WriteBytes(Data(), DataLength());
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
StructuredCloneData::ReadIPCParams(const IPC::Message* aMsg,
|
||||
void** aIter)
|
||||
PickleIterator* aIter)
|
||||
{
|
||||
MOZ_ASSERT(!Data());
|
||||
|
||||
@ -118,18 +117,14 @@ StructuredCloneData::ReadIPCParams(const IPC::Message* aMsg,
|
||||
return true;
|
||||
}
|
||||
|
||||
uint64_t* dataBuffer = nullptr;
|
||||
const char** buffer =
|
||||
const_cast<const char**>(reinterpret_cast<char**>(&dataBuffer));
|
||||
// Structured clone data must be 64-bit aligned.
|
||||
if (!aMsg->ReadBytes(aIter, buffer, dataLength, sizeof(uint64_t))) {
|
||||
mSharedData = SharedJSAllocatedData::AllocateForExternalData(dataLength);
|
||||
NS_ENSURE_TRUE(mSharedData, false);
|
||||
|
||||
if (!aMsg->ReadBytesInto(aIter, mSharedData->Data(), dataLength)) {
|
||||
mSharedData = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
mSharedData = SharedJSAllocatedData::CreateFromExternalData(dataBuffer,
|
||||
dataLength);
|
||||
NS_ENSURE_TRUE(mSharedData, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
namespace IPC {
|
||||
class Message;
|
||||
}
|
||||
class PickleIterator;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -30,19 +31,27 @@ public:
|
||||
}
|
||||
|
||||
static already_AddRefed<SharedJSAllocatedData>
|
||||
CreateFromExternalData(const void* aData, size_t aDataLength)
|
||||
AllocateForExternalData(size_t aDataLength)
|
||||
{
|
||||
uint64_t* data = Allocate64bitSafely(aDataLength);
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
memcpy(data, aData, aDataLength);
|
||||
RefPtr<SharedJSAllocatedData> sharedData =
|
||||
new SharedJSAllocatedData(data, aDataLength);
|
||||
return sharedData.forget();
|
||||
}
|
||||
|
||||
static already_AddRefed<SharedJSAllocatedData>
|
||||
CreateFromExternalData(const void* aData, size_t aDataLength)
|
||||
{
|
||||
RefPtr<SharedJSAllocatedData> sharedData =
|
||||
AllocateForExternalData(aDataLength);
|
||||
memcpy(sharedData->Data(), aData, aDataLength);
|
||||
return sharedData.forget();
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(SharedJSAllocatedData)
|
||||
|
||||
uint64_t* Data() const { return mData; }
|
||||
@ -137,7 +146,7 @@ public:
|
||||
|
||||
// For IPC serialization
|
||||
void WriteIPCParams(IPC::Message* aMessage) const;
|
||||
bool ReadIPCParams(const IPC::Message* aMessage, void** aIter);
|
||||
bool ReadIPCParams(const IPC::Message* aMessage, PickleIterator* aIter);
|
||||
|
||||
private:
|
||||
uint64_t* MOZ_NON_OWNING_REF mExternalData;
|
||||
|
@ -13,7 +13,7 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
bool
|
||||
ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
RemoteDOMEvent* aResult)
|
||||
{
|
||||
aResult->mEvent = nullptr;
|
||||
|
@ -24,7 +24,7 @@ struct RemoteDOMEvent
|
||||
nsCOMPtr<nsIDOMEvent> mEvent;
|
||||
};
|
||||
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::dom::RemoteDOMEvent* aResult);
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
@ -49,7 +49,7 @@ struct ParamTraits<mozilla::dom::RemoteDOMEvent>
|
||||
aParam.mEvent->Serialize(aMsg, true);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return mozilla::dom::ReadRemoteEvent(aMsg, aIter, aResult);
|
||||
}
|
||||
@ -75,7 +75,7 @@ struct ParamTraits<mozilla::dom::AudioChannel>
|
||||
WriteParam(aMsg, (uint32_t)aValue);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
uint32_t value;
|
||||
if(!ReadParam(aMsg, aIter, &value) ||
|
||||
|
@ -381,7 +381,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ParseNamedSpaceValue(aString, aCSSValue, aFlags)) {
|
||||
if (ParseNamedSpaceValue(str, aCSSValue, aFlags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ BenchmarkPlayback::BenchmarkPlayback(Benchmark* aMainThreadState,
|
||||
MediaDataDemuxer* aDemuxer)
|
||||
: QueueObject(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)))
|
||||
, mMainThreadState(aMainThreadState)
|
||||
, mDecoderTaskQueue(new FlushableTaskQueue(GetMediaThreadPool(
|
||||
, mDecoderTaskQueue(new TaskQueue(GetMediaThreadPool(
|
||||
MediaThreadType::PLATFORM_DECODER)))
|
||||
, mDemuxer(aDemuxer)
|
||||
, mSampleIndex(0)
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class FlushableTaskQueue;
|
||||
class TaskQueue;
|
||||
class Benchmark;
|
||||
|
||||
class BenchmarkPlayback : public QueueObject, private MediaDataDecoderCallback
|
||||
@ -39,7 +39,7 @@ class BenchmarkPlayback : public QueueObject, private MediaDataDecoderCallback
|
||||
|
||||
Atomic<Benchmark*> mMainThreadState;
|
||||
|
||||
RefPtr<FlushableTaskQueue> mDecoderTaskQueue;
|
||||
RefPtr<TaskQueue> mDecoderTaskQueue;
|
||||
RefPtr<MediaDataDecoder> mDecoder;
|
||||
|
||||
// Object only accessed on Thread()
|
||||
|
@ -4,6 +4,7 @@
|
||||
* 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/SharedThreadPool.h"
|
||||
#include "FileBlockCache.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "prio.h"
|
||||
|
@ -1,57 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#include "FlushableTaskQueue.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
void
|
||||
FlushableTaskQueue::Flush()
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
AutoSetFlushing autoFlush(this);
|
||||
FlushLocked();
|
||||
AwaitIdleLocked();
|
||||
}
|
||||
|
||||
nsresult
|
||||
FlushableTaskQueue::FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> r = aRunnable;
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
AutoSetFlushing autoFlush(this);
|
||||
FlushLocked();
|
||||
nsresult rv = DispatchLocked(/* passed by ref */r, IgnoreFlushing, AssertDispatchSuccess);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
AwaitIdleLocked();
|
||||
}
|
||||
// If the ownership of |r| is not transferred in DispatchLocked() due to
|
||||
// dispatch failure, it will be deleted here outside the lock. We do so
|
||||
// since the destructor of the runnable might access TaskQueue and result
|
||||
// in deadlocks.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
FlushableTaskQueue::FlushLocked()
|
||||
{
|
||||
// Make sure there are no tasks for this queue waiting in the caller's tail
|
||||
// dispatcher.
|
||||
MOZ_ASSERT_IF(AbstractThread::GetCurrent(),
|
||||
!AbstractThread::GetCurrent()->TailDispatcher().HasTasksFor(this));
|
||||
|
||||
mQueueMonitor.AssertCurrentThreadOwns();
|
||||
MOZ_ASSERT(mIsFlushing);
|
||||
|
||||
// Clear the tasks. If this strikes you as awful, stop using a
|
||||
// FlushableTaskQueue.
|
||||
while (!mTasks.empty()) {
|
||||
mTasks.pop();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
@ -1,53 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef FlushableTaskQueue_h_
|
||||
#define FlushableTaskQueue_h_
|
||||
|
||||
#include "mozilla/TaskQueue.h"
|
||||
|
||||
//
|
||||
// WARNING: THIS CLASS IS DEPRECATED AND GOING AWAY. DO NOT USE IT!
|
||||
//
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class FlushableTaskQueue : public TaskQueue
|
||||
{
|
||||
public:
|
||||
explicit FlushableTaskQueue(already_AddRefed<SharedThreadPool> aPool) : TaskQueue(Move(aPool)) {}
|
||||
nsresult FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable);
|
||||
void Flush();
|
||||
|
||||
bool IsDispatchReliable() override { return false; }
|
||||
|
||||
private:
|
||||
|
||||
class MOZ_STACK_CLASS AutoSetFlushing
|
||||
{
|
||||
public:
|
||||
explicit AutoSetFlushing(FlushableTaskQueue* aTaskQueue) : mTaskQueue(aTaskQueue)
|
||||
{
|
||||
mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns();
|
||||
mTaskQueue->mIsFlushing = true;
|
||||
}
|
||||
~AutoSetFlushing()
|
||||
{
|
||||
mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns();
|
||||
mTaskQueue->mIsFlushing = false;
|
||||
}
|
||||
|
||||
private:
|
||||
FlushableTaskQueue* mTaskQueue;
|
||||
};
|
||||
|
||||
void FlushLocked();
|
||||
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // FlushableTaskQueue_h_
|
@ -10,7 +10,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "TimeUnits.h"
|
||||
#include "prenv.h"
|
||||
|
@ -172,9 +172,9 @@ MediaFormatReader::Init()
|
||||
InitLayersBackendType();
|
||||
|
||||
mAudio.mTaskQueue =
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
mVideo.mTaskQueue =
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1104,6 +1104,11 @@ MediaFormatReader::Update(TrackType aTrack)
|
||||
return;
|
||||
}
|
||||
|
||||
if (aTrack == TrackType::kVideoTrack && mSkipRequest.Exists()) {
|
||||
LOGV("Skipping in progress, nothing more to do");
|
||||
return;
|
||||
}
|
||||
|
||||
if (UpdateReceivedNewData(aTrack)) {
|
||||
LOGV("Nothing more to do");
|
||||
return;
|
||||
@ -1417,6 +1422,27 @@ MediaFormatReader::Reset(TrackType aTrack)
|
||||
LOG("Reset(%s) END", TrackTypeToStr(aTrack));
|
||||
}
|
||||
|
||||
void
|
||||
MediaFormatReader::DropDecodedSamples(TrackType aTrack)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
auto& decoder = GetDecoderData(aTrack);
|
||||
size_t lengthDecodedQueue = decoder.mOutput.Length();
|
||||
if (lengthDecodedQueue && decoder.mTimeThreshold.isSome()) {
|
||||
TimeUnit time =
|
||||
TimeUnit::FromMicroseconds(decoder.mOutput.LastElement()->mTime);
|
||||
if (time >= decoder.mTimeThreshold.ref().Time()) {
|
||||
// We would have reached our internal seek target.
|
||||
decoder.mTimeThreshold.reset();
|
||||
}
|
||||
}
|
||||
decoder.mOutput.Clear();
|
||||
decoder.mSizeOfQueue -= lengthDecodedQueue;
|
||||
if (aTrack == TrackInfo::kVideoTrack && mDecoder) {
|
||||
mDecoder->NotifyDecodedFrames(0, 0, lengthDecodedQueue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaFormatReader::SkipVideoDemuxToNextKeyFrame(media::TimeUnit aTimeThreshold)
|
||||
{
|
||||
@ -1424,6 +1450,15 @@ MediaFormatReader::SkipVideoDemuxToNextKeyFrame(media::TimeUnit aTimeThreshold)
|
||||
MOZ_ASSERT(mVideo.HasPromise());
|
||||
LOG("Skipping up to %lld", aTimeThreshold.ToMicroseconds());
|
||||
|
||||
// We've reached SkipVideoDemuxToNextKeyFrame when our decoding is late.
|
||||
// As such we can drop all already decoded samples and discard all pending
|
||||
// samples.
|
||||
// TODO: Ideally we should set mOutputRequested to false so that all pending
|
||||
// frames are dropped too. However, we can't do such thing as the code assumes
|
||||
// that the decoder just got flushed. Once bug 1257107 land, we could set the
|
||||
// decoder threshold to the value of currentTime.
|
||||
DropDecodedSamples(TrackInfo::kVideoTrack);
|
||||
|
||||
mSkipRequest.Begin(mVideo.mTrackDemuxer->SkipToNextRandomAccessPoint(aTimeThreshold)
|
||||
->Then(OwnerThread(), __func__, this,
|
||||
&MediaFormatReader::OnVideoSkipCompleted,
|
||||
@ -1435,11 +1470,11 @@ void
|
||||
MediaFormatReader::VideoSkipReset(uint32_t aSkipped)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
// I think it's still possible for an output to have been sent from the decoder
|
||||
// and is currently sitting in our event queue waiting to be processed. The following
|
||||
// flush won't clear it, and when we return to the event loop it'll be added to our
|
||||
// output queue and be used.
|
||||
// This code will count that as dropped, which was the intent, but not quite true.
|
||||
|
||||
// Some frames may have been output by the decoder since we initiated the
|
||||
// videoskip process and we know they would be late.
|
||||
DropDecodedSamples(TrackInfo::kVideoTrack);
|
||||
// Report the pending frames as dropped.
|
||||
if (mDecoder) {
|
||||
mDecoder->NotifyDecodedFrames(0, 0, SizeOfVideoQueueInFrames());
|
||||
}
|
||||
@ -1478,6 +1513,9 @@ MediaFormatReader::OnVideoSkipFailed(MediaTrackDemuxer::SkipFailureHolder aFailu
|
||||
switch (aFailure.mFailure) {
|
||||
case DemuxerFailureReason::END_OF_STREAM: MOZ_FALLTHROUGH;
|
||||
case DemuxerFailureReason::WAITING_FOR_DATA:
|
||||
// Some frames may have been output by the decoder since we initiated the
|
||||
// videoskip process and we know they would be late.
|
||||
DropDecodedSamples(TrackInfo::kVideoTrack);
|
||||
// We can't complete the skip operation, will just service a video frame
|
||||
// normally.
|
||||
NotifyDecodingRequested(TrackInfo::kVideoTrack);
|
||||
|
@ -179,6 +179,7 @@ private:
|
||||
void Error(TrackType aTrack);
|
||||
void Reset(TrackType aTrack);
|
||||
void DrainComplete(TrackType aTrack);
|
||||
void DropDecodedSamples(TrackType aTrack);
|
||||
|
||||
bool ShouldSkip(bool aSkipToNextKeyframe, media::TimeUnit aTimeThreshold);
|
||||
|
||||
@ -254,7 +255,7 @@ private:
|
||||
RefPtr<MediaTrackDemuxer> mTrackDemuxer;
|
||||
// TaskQueue on which decoder can choose to decode.
|
||||
// Only non-null up until the decoder is created.
|
||||
RefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
RefPtr<TaskQueue> mTaskQueue;
|
||||
// Callback that receives output and error notifications from the decoder.
|
||||
nsAutoPtr<DecoderCallback> mCallback;
|
||||
|
||||
|
@ -312,14 +312,6 @@ CreateMediaDecodeTaskQueue()
|
||||
return queue.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<FlushableTaskQueue>
|
||||
CreateFlushableMediaDecodeTaskQueue()
|
||||
{
|
||||
RefPtr<FlushableTaskQueue> queue = new FlushableTaskQueue(
|
||||
GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
return queue.forget();
|
||||
}
|
||||
|
||||
void
|
||||
SimpleTimer::Cancel() {
|
||||
if (mTimer) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef VideoUtils_h
|
||||
#define VideoUtils_h
|
||||
|
||||
#include "FlushableTaskQueue.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/MozPromise.h"
|
||||
@ -268,9 +267,6 @@ GenerateRandomPathName(nsCString& aOutSalt, uint32_t aLength);
|
||||
already_AddRefed<TaskQueue>
|
||||
CreateMediaDecodeTaskQueue();
|
||||
|
||||
already_AddRefed<FlushableTaskQueue>
|
||||
CreateFlushableMediaDecodeTaskQueue();
|
||||
|
||||
// Iteratively invokes aWork until aCondition returns true, or aWork returns false.
|
||||
// Use this rather than a while loop to avoid bogarting the task queue.
|
||||
template<class Work, class Condition>
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef ISOCOMPOSITOR_H_
|
||||
#define ISOCOMPOSITOR_H_
|
||||
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "ISOTrackMetadata.h"
|
||||
#include "EncodedFrameContainer.h"
|
||||
|
@ -218,7 +218,7 @@ static const uint8_t sTestH264ExtraData[] = {
|
||||
static already_AddRefed<MediaDataDecoder>
|
||||
CreateTestH264Decoder(layers::LayersBackend aBackend,
|
||||
VideoInfo& aConfig,
|
||||
FlushableTaskQueue* aTaskQueue)
|
||||
TaskQueue* aTaskQueue)
|
||||
{
|
||||
aConfig.mMimeType = "video/avc";
|
||||
aConfig.mId = 1;
|
||||
@ -251,8 +251,8 @@ MP4Decoder::IsVideoAccelerated(layers::LayersBackend aBackend, nsIGlobalObject*
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<FlushableTaskQueue> taskQueue =
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
RefPtr<TaskQueue> taskQueue =
|
||||
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
VideoInfo config;
|
||||
RefPtr<MediaDataDecoder> decoder(CreateTestH264Decoder(aBackend, config, taskQueue));
|
||||
if (!decoder) {
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "GMPParent.h"
|
||||
#include "gmp-storage.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "prio.h"
|
||||
#include "mozIGeckoMediaPluginService.h"
|
||||
|
@ -132,7 +132,7 @@ struct ParamTraits<GMPSimulcastStream>
|
||||
WriteParam(aMsg, aParam.mQPMax);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (ReadParam(aMsg, aIter, &(aResult->mWidth)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mHeight)) &&
|
||||
@ -181,7 +181,7 @@ struct ParamTraits<GMPVideoCodec>
|
||||
WriteParam(aMsg, aParam.mMode);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// NOTE: make sure this matches any versions supported
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mGMPApiVersion)) ||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "ContainerParser.h"
|
||||
|
||||
#include "WebMBufferedParser.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mp4_demuxer/MoofParser.h"
|
||||
#include "mozilla/Logging.h"
|
||||
|
@ -103,7 +103,6 @@ EXPORTS += [
|
||||
'DOMMediaStream.h',
|
||||
'EncodedBufferCache.h',
|
||||
'FileBlockCache.h',
|
||||
'FlushableTaskQueue.h',
|
||||
'FrameStatistics.h',
|
||||
'Intervals.h',
|
||||
'Latency.h',
|
||||
@ -215,7 +214,6 @@ UNIFIED_SOURCES += [
|
||||
'DOMMediaStream.cpp',
|
||||
'EncodedBufferCache.cpp',
|
||||
'FileBlockCache.cpp',
|
||||
'FlushableTaskQueue.cpp',
|
||||
'GetUserMediaRequest.cpp',
|
||||
'GraphDriver.cpp',
|
||||
'Latency.cpp',
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nsDebug.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "OpusParser.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "TimeUnits.h"
|
||||
#include "VorbisUtils.h"
|
||||
#include "VorbisDecoder.h" // For VorbisLayout
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "GMPVideoDecoder.h"
|
||||
#include "GMPVideoHost.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "prsystem.h"
|
||||
#include "MediaData.h"
|
||||
#include "GMPDecoderModule.h"
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "TimeUnits.h"
|
||||
#include "prenv.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <stdint.h>
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "EbmlComposer.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "libmkv/EbmlIDs.h"
|
||||
#include "libmkv/EbmlWriter.h"
|
||||
#include "libmkv/WebMElement.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "WebMBufferedParser.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/SharedThreadPool.h"
|
||||
#include "MediaDataDemuxer.h"
|
||||
#include "nsAutoRef.h"
|
||||
|
@ -31,7 +31,7 @@ struct ParamTraits<mozilla::dom::Optional<T>>
|
||||
WriteParam(aMsg, false);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
bool was_passed = false;
|
||||
|
||||
@ -61,7 +61,7 @@ struct ParamTraits<mozilla::dom::Sequence<T>>
|
||||
WriteParam(aMsg, static_cast<const FallibleTArray<T>&>(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, dynamic_cast<FallibleTArray<T>*>(aResult));
|
||||
}
|
||||
@ -114,7 +114,7 @@ struct ParamTraits<mozilla::dom::RTCStatsReportInternal>
|
||||
WriteParam(aMsg, aParam.mTransportStats);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mClosed)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mCodecStats)) ||
|
||||
@ -147,7 +147,7 @@ static void WriteRTCStats(Message* aMsg, const RTCStats& aParam)
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
}
|
||||
|
||||
static bool ReadRTCStats(const Message* aMsg, void** aIter, RTCStats* aResult)
|
||||
static bool ReadRTCStats(const Message* aMsg, PickleIterator* aIter, RTCStats* aResult)
|
||||
{
|
||||
// RTCStats base class
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mId)) ||
|
||||
@ -174,7 +174,7 @@ struct ParamTraits<mozilla::dom::RTCCodecStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mChannels)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mClockRate)) ||
|
||||
@ -207,7 +207,7 @@ struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mComponentId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLocalCandidateId)) ||
|
||||
@ -242,7 +242,7 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mCandidateId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mCandidateType)) ||
|
||||
@ -274,7 +274,7 @@ struct ParamTraits<mozilla::dom::RTCIceComponentStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mActiveConnection)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
|
||||
@ -307,7 +307,7 @@ static void WriteRTCRTPStreamStats(
|
||||
}
|
||||
|
||||
static bool ReadRTCRTPStreamStats(
|
||||
const Message* aMsg, void** aIter,
|
||||
const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::dom::RTCRTPStreamStats* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mBitrateMean)) ||
|
||||
@ -346,7 +346,7 @@ struct ParamTraits<mozilla::dom::RTCInboundRTPStreamStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mDiscardedPackets)) ||
|
||||
@ -380,7 +380,7 @@ struct ParamTraits<mozilla::dom::RTCOutboundRTPStreamStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mDroppedFrames)) ||
|
||||
@ -407,7 +407,7 @@ struct ParamTraits<mozilla::dom::RTCMediaStreamStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mStreamIdentifier)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mTrackIds)) ||
|
||||
@ -431,7 +431,7 @@ struct ParamTraits<mozilla::dom::RTCTransportStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
|
||||
@ -467,7 +467,7 @@ struct ParamTraits<mozilla::dom::RTCMediaStreamTrackStats>
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mAudioLevel)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mEchoReturnLoss)) ||
|
||||
|
@ -97,7 +97,7 @@ struct ParamTraits<nsIMobileCallForwardingOptions*>
|
||||
}
|
||||
|
||||
// Function to de-serialize a MobileCallForwardingOptions.
|
||||
static bool Read(const Message *aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// Check if is the null pointer we have transfered.
|
||||
bool isNull;
|
||||
@ -176,7 +176,7 @@ struct ParamTraits<nsIMobileNetworkInfo*>
|
||||
}
|
||||
|
||||
// Function to de-serialize a MobileNetworkInfo.
|
||||
static bool Read(const Message *aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// Check if is the null pointer we have transfered.
|
||||
bool isNull;
|
||||
@ -263,7 +263,7 @@ struct ParamTraits<nsIMobileCellInfo*>
|
||||
}
|
||||
|
||||
// Function to de-serialize a MobileCellInfo.
|
||||
static bool Read(const Message *aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// Check if is the null pointer we have transfered.
|
||||
bool isNull;
|
||||
@ -378,7 +378,7 @@ struct ParamTraits<nsIMobileConnectionInfo*>
|
||||
}
|
||||
|
||||
// Function to de-serialize a MobileConectionInfo.
|
||||
static bool Read(const Message* aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
// Check if is the null pointer we have transfered.
|
||||
bool isNull;
|
||||
@ -541,7 +541,7 @@ struct ParamTraits<MozCallForwardingOptions>
|
||||
}
|
||||
|
||||
// Function to de-serialize a MozCallForwardingOptions.
|
||||
static bool Read(const Message *aMsg, void **aIter, paramType* aResult)
|
||||
static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
|
||||
{
|
||||
bool wasPassed = false;
|
||||
bool isNull = false;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "mozilla/dom/NfcOptionsBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/RootedDictionary.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/ipc/ListenSocket.h"
|
||||
#include "mozilla/ipc/ListenSocketConsumer.h"
|
||||
|
@ -472,18 +472,6 @@ GetGlobalObject(NPP npp)
|
||||
return doc->GetScopeObject();
|
||||
}
|
||||
|
||||
JSContext *
|
||||
GetJSContext(NPP npp)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(GetGlobalObject(npp));
|
||||
NS_ENSURE_TRUE(sgo, nullptr);
|
||||
|
||||
nsIScriptContext *scx = sgo->GetContext();
|
||||
NS_ENSURE_TRUE(scx, nullptr);
|
||||
|
||||
return scx->GetNativeContext();
|
||||
}
|
||||
|
||||
} // namespace parent
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
@ -610,7 +598,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
|
||||
obj = val.toObjectOrNull();
|
||||
}
|
||||
|
||||
NPObject *npobj = nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
|
||||
NPObject* npobj = nsJSObjWrapper::GetNewOrUsed(npp, obj);
|
||||
if (!npobj) {
|
||||
return false;
|
||||
}
|
||||
@ -1103,7 +1091,7 @@ nsJSObjWrapper::NP_Construct(NPObject *npobj, const NPVariant *args,
|
||||
|
||||
// static
|
||||
NPObject *
|
||||
nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
|
||||
nsJSObjWrapper::GetNewOrUsed(NPP npp, JS::Handle<JSObject*> obj)
|
||||
{
|
||||
if (!npp) {
|
||||
NS_ERROR("Null NPP passed to nsJSObjWrapper::GetNewOrUsed()!");
|
||||
@ -1122,16 +1110,6 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
|
||||
}
|
||||
}
|
||||
|
||||
if (!cx) {
|
||||
cx = GetJSContext(npp);
|
||||
|
||||
if (!cx) {
|
||||
NS_ERROR("Unable to find a JSContext in nsJSObjWrapper::GetNewOrUsed()!");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// No need to enter the right compartment here as we only get the
|
||||
// class and private from the JSObject, neither of which cares about
|
||||
// compartments.
|
||||
|
@ -58,8 +58,7 @@ public:
|
||||
const NPP mNpp;
|
||||
bool mDestroyPending;
|
||||
|
||||
static NPObject *GetNewOrUsed(NPP npp, JSContext *cx,
|
||||
JS::Handle<JSObject*> obj);
|
||||
static NPObject* GetNewOrUsed(NPP npp, JS::Handle<JSObject*> obj);
|
||||
static bool HasOwnProperty(NPObject* npobj, NPIdentifier npid);
|
||||
|
||||
void trace(JSTracer* trc) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user