Merge inbound to m-c a=merge

MozReview-Commit-ID: B0yZpi7wa4I
This commit is contained in:
Wes Kocher 2016-03-01 15:19:25 -08:00
commit dc9b75f120
701 changed files with 13165 additions and 2438 deletions

View File

@ -45,14 +45,16 @@ static ModuleRep sModuleMap[] = {
{ "events", logging::eEvents },
{ "platforms", logging::ePlatforms },
{ "stack", logging::eStack },
{ "text", logging::eText },
{ "tree", logging::eTree },
{ "DOMEvents", logging::eDOMEvents },
{ "focus", logging::eFocus },
{ "selection", logging::eSelection },
{ "notifications", logging::eNotifications }
{ "notifications", logging::eNotifications },
{ "stack", logging::eStack },
{ "verbose", logging::eVerbose }
};
static void
@ -606,6 +608,61 @@ logging::SelChange(nsISelection* aSelection, DocAccessible* aDocument,
Stack();
}
void
logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...)
{
if (IsEnabledAll(logging::eTree | aExtraFlags)) {
MsgBegin("TREE", aMsg);
va_list vl;
va_start(vl, aExtraFlags);
const char* descr = nullptr;
while ((descr = va_arg(vl, const char*))) {
AccessibleInfo(descr, va_arg(vl, Accessible*));
}
va_end(vl);
MsgEnd();
if (aExtraFlags & eStack) {
Stack();
}
}
}
void
logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags,
const char* aMsg1, Accessible* aAcc,
const char* aMsg2, nsINode* aNode)
{
if (IsEnabledAll(logging::eTree | logging::eVerbose)) {
MsgBegin("TREE", aMsg);
AccessibleInfo(aMsg1, aAcc);
Accessible* acc = aAcc->Document()->GetAccessible(aNode);
if (acc) {
AccessibleInfo(aMsg2, acc);
}
else {
Node(aMsg2, aNode);
}
MsgEnd();
}
}
void
logging::TreeInfo(const char* aMsg, uint32_t aExtraFlags, Accessible* aParent)
{
if (IsEnabledAll(logging::eTree | aExtraFlags)) {
MsgBegin("TREE", aMsg);
AccessibleInfo("container", aParent);
for (uint32_t idx = 0; idx < aParent->ChildCount(); idx++) {
AccessibleInfo("child", aParent->GetChildAt(idx));
}
MsgEnd();
}
}
void
logging::MsgBegin(const char* aTitle, const char* aMsgText, ...)
{
@ -736,6 +793,62 @@ logging::Document(DocAccessible* aDocument)
printf("\n");
}
void
logging::AccessibleInfo(const char* aDescr, Accessible* aAccessible)
{
printf(" %s: %p; ", aDescr, static_cast<void*>(aAccessible));
if (!aAccessible) {
printf("\n");
return;
}
if (aAccessible->IsDefunct()) {
printf("defunct\n");
return;
}
if (!aAccessible->Document() || aAccessible->Document()->IsDefunct()) {
printf("document is shutting down, no info\n");
return;
}
nsAutoString role;
GetAccService()->GetStringRole(aAccessible->Role(), role);
printf("role: %s", NS_ConvertUTF16toUTF8(role).get());
nsAutoString name;
aAccessible->Name(name);
if (!name.IsEmpty()) {
printf(", name: '%s'", NS_ConvertUTF16toUTF8(name).get());
}
printf(", idx: %d", aAccessible->IndexInParent());
nsINode* node = aAccessible->GetNode();
if (!node) {
printf(", node: null\n");
}
else if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
printf(", document node: %p\n", static_cast<void*>(node));
}
else if (node->IsNodeOfType(nsINode::eTEXT)) {
printf(", text node: %p\n", static_cast<void*>(node));
}
else if (node->IsElement()) {
dom::Element* el = node->AsElement();
nsAutoCString tag;
el->NodeInfo()->NameAtom()->ToUTF8String(tag);
nsIAtom* idAtom = el->GetID();
nsAutoCString id;
if (idAtom) {
idAtom->ToUTF8String(id);
}
printf(", element node: %p, %s@id='%s'\n",
static_cast<void*>(el), tag.get(), id.get());
}
}
void
logging::AccessibleNNode(const char* aDescr, Accessible* aAccessible)
{
@ -814,6 +927,12 @@ logging::IsEnabled(uint32_t aModules)
return sModules & aModules;
}
bool
logging::IsEnabledAll(uint32_t aModules)
{
return (sModules & aModules) == aModules;
}
bool
logging::IsEnabled(const nsAString& aModuleStr)
{

View File

@ -35,14 +35,17 @@ enum EModules {
eEvents = 1 << 3,
ePlatforms = 1 << 4,
eStack = 1 << 5,
eText = 1 << 6,
eTree = 1 << 7,
eText = 1 << 5,
eTree = 1 << 6,
eDOMEvents = 1 << 8,
eFocus = 1 << 9,
eSelection = 1 << 10,
eNotifications = eDOMEvents | eSelection | eFocus
eDOMEvents = 1 << 7,
eFocus = 1 << 8,
eSelection = 1 << 9,
eNotifications = eDOMEvents | eSelection | eFocus,
// extras
eStack = 1 << 10,
eVerbose = 1 << 11
};
/**
@ -50,6 +53,11 @@ enum EModules {
*/
bool IsEnabled(uint32_t aModules);
/**
* Return true if all of the given modules are logged.
*/
bool IsEnabledAll(uint32_t aModules);
/**
* Return true if the given module is logged.
*/
@ -121,6 +129,15 @@ void FocusDispatched(Accessible* aTarget);
void SelChange(nsISelection* aSelection, DocAccessible* aDocument,
int16_t aReason);
/**
* Log the given accessible elements info.
*/
void TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...);
void TreeInfo(const char* aMsg, uint32_t aExtraFlags,
const char* aMsg1, Accessible* aAcc,
const char* aMsg2, nsINode* aNode);
void TreeInfo(const char* aMsg, uint32_t aExtraFlags, Accessible* aParent);
/**
* Log the message ('title: text' format) on new line. Print the start and end
* boundaries of the message body designated by '{' and '}' (2 spaces indent for
@ -164,6 +181,7 @@ void Document(DocAccessible* aDocument);
/**
* Log the accessible and its DOM node as a message entry.
*/
void AccessibleInfo(const char* aDescr, Accessible* aAccessible);
void AccessibleNNode(const char* aDescr, Accessible* aAccessible);
void AccessibleNNode(const char* aDescr, nsINode* aNode);
@ -189,7 +207,8 @@ void Enable(const nsAFlatCString& aModules);
*/
void CheckEnv();
} // namespace logs
} // namespace logging
} // namespace a11y
} // namespace mozilla

View File

@ -590,6 +590,7 @@ public:
HyperTextAccessible* AsHyperText();
bool IsHTMLBr() const { return mType == eHTMLBRType; }
bool IsHTMLCaption() const { return mType == eHTMLCaptionType; }
bool IsHTMLCombobox() const { return mType == eHTMLComboboxType; }
bool IsHTMLFileInput() const { return mType == eHTMLFileInputType; }

View File

@ -393,24 +393,14 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableAccessible, Accessible)
////////////////////////////////////////////////////////////////////////////////
// HTMLTableAccessible: Accessible
void
HTMLTableAccessible::CacheChildren()
bool
HTMLTableAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
{
// Move caption accessible so that it's the first child. Check for the first
// caption only, because nsAccessibilityService ensures we don't create
// accessibles for the other captions, since only the first is actually
// visible.
TreeWalker walker(this, mContent);
Accessible* child = nullptr;
while ((child = walker.Next())) {
if (child->Role() == roles::CAPTION) {
InsertChildAt(0, child);
while ((child = walker.Next()) && AppendChild(child));
break;
}
AppendChild(child);
}
return Accessible::InsertChildAt(aChild->IsHTMLCaption() ? 0 : aIndex, aChild);
}
role

View File

@ -157,12 +157,13 @@ public:
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
virtual Relation RelationByType(RelationType aRelationType) override;
bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
protected:
virtual ~HTMLTableAccessible() {}
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) override;
virtual void CacheChildren() override;
// HTMLTableAccessible
@ -209,7 +210,7 @@ class HTMLCaptionAccessible : public HyperTextAccessibleWrap
{
public:
HTMLCaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
HyperTextAccessibleWrap(aContent, aDoc) { }
HyperTextAccessibleWrap(aContent, aDoc) { mType = eHTMLCaptionType; }
// Accessible
virtual a11y::role NativeRole() override;

View File

@ -29,6 +29,7 @@ skip-if = buildapp == "mulet"
[test_recreation.html]
[test_select.html]
[test_shutdown.xul]
[test_table.html]
[test_textleaf.html]
[test_visibility.html]
[test_whitespace.html]

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<title>Table update tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../role.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript">
function appendCaption(aTableID)
{
this.invoke = function appendCaption_invoke()
{
// append a caption, it should appear as a first element in the
// accessible tree.
var caption = document.createElement("caption");
caption.textContent = "table caption";
getNode(aTableID).appendChild(caption);
}
this.eventSeq = [
new invokerChecker(EVENT_REORDER, aTableID)
];
this.finalCheck = function appendCaption_finalCheck()
{
var tree =
{ TABLE: [
{ CAPTION: [
{ TEXT_LEAF: [] }
] },
{ ROW: [
{ CELL: [ {TEXT_LEAF: [] }]},
{ CELL: [ {TEXT_LEAF: [] }]}
] }
] };
testAccessibleTree(aTableID, tree);
}
this.getID = function appendCaption_getID()
{
return "append caption";
}
}
function doTest()
{
gQueue = new eventQueue();
gQueue.push(new appendCaption("table"));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table">
<tr>
<td>cell1</td>
<td>cell2</td>
</tr>
</table>
</body>
</html>

View File

@ -650,7 +650,6 @@ var settingsToObserve = {
'dom.mozApps.signed_apps_installable_from': 'https://marketplace.firefox.com',
'dom.presentation.discovery.enabled': false,
'dom.presentation.discoverable': false,
'dom.serviceWorkers.interception.enabled': true,
'dom.serviceWorkers.testing.enabled': false,
'gfx.layerscope.enabled': false,
'layers.draw-borders': false,

View File

@ -210,7 +210,6 @@ function setup() {
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.serviceWorkers.interception.enabled", true]
]}, () => {
SpecialPowers.pushPermissions([
{ "type": "webapps-manage", "allow": 1, "context": document },

View File

@ -792,18 +792,6 @@
@RESPATH@/res/table-remove-row-active.gif
@RESPATH@/res/table-remove-row-hover.gif
@RESPATH@/res/table-remove-row.gif
@RESPATH@/res/accessiblecaret.png
@RESPATH@/res/accessiblecaret@1.5x.png
@RESPATH@/res/accessiblecaret@2.25x.png
@RESPATH@/res/accessiblecaret@2x.png
@RESPATH@/res/accessiblecaret_tilt_left.png
@RESPATH@/res/accessiblecaret_tilt_left@1.5x.png
@RESPATH@/res/accessiblecaret_tilt_left@2.25x.png
@RESPATH@/res/accessiblecaret_tilt_left@2x.png
@RESPATH@/res/accessiblecaret_tilt_right.png
@RESPATH@/res/accessiblecaret_tilt_right@1.5x.png
@RESPATH@/res/accessiblecaret_tilt_right@2.25x.png
@RESPATH@/res/accessiblecaret_tilt_right@2x.png
@RESPATH@/res/grabber.gif
#ifdef XP_MACOSX
@RESPATH@/res/cursors/*

View File

@ -1635,7 +1635,6 @@ pref("reader.errors.includeURLs", true);
pref("view_source.tab", true);
pref("dom.serviceWorkers.enabled", true);
pref("dom.serviceWorkers.interception.enabled", true);
pref("dom.serviceWorkers.openWindow.enabled", true);
pref("dom.webnotifications.serviceworker.enabled", true);

View File

@ -108,7 +108,8 @@ var SessionStorageInternal = {
let principal;
try {
let attrs = ChromeUtils.createOriginAttributesWithUserContextId(origin, aDocShell.userContextId);
let attrs = ChromeUtils.createDefaultOriginAttributes();
attrs.userContextId = aDocShell.userContextId;
let originURI = Services.io.newURI(origin, null, null);
principal = Services.scriptSecurityManager.createCodebasePrincipal(originURI, attrs);
} catch (e) {

View File

@ -735,18 +735,6 @@
@RESPATH@/res/table-remove-row-active.gif
@RESPATH@/res/table-remove-row-hover.gif
@RESPATH@/res/table-remove-row.gif
@RESPATH@/res/accessiblecaret.png
@RESPATH@/res/accessiblecaret@1.5x.png
@RESPATH@/res/accessiblecaret@2.25x.png
@RESPATH@/res/accessiblecaret@2x.png
@RESPATH@/res/accessiblecaret_tilt_left.png
@RESPATH@/res/accessiblecaret_tilt_left@1.5x.png
@RESPATH@/res/accessiblecaret_tilt_left@2.25x.png
@RESPATH@/res/accessiblecaret_tilt_left@2x.png
@RESPATH@/res/accessiblecaret_tilt_right.png
@RESPATH@/res/accessiblecaret_tilt_right@1.5x.png
@RESPATH@/res/accessiblecaret_tilt_right@2.25x.png
@RESPATH@/res/accessiblecaret_tilt_right@2x.png
@RESPATH@/res/grabber.gif
#ifdef XP_MACOSX
@RESPATH@/res/cursors/*

View File

@ -33,9 +33,28 @@ function checkOriginAttributes(prin, attrs, suffix) {
} else {
checkThrows(() => ssm.createCodebasePrincipalFromOrigin(prin.origin));
}
}
do_check_eq(ChromeUtils.createOriginAttributesWithUserContextId("http://example.org", 2).userContextId, 2);
do_check_eq(ChromeUtils.createOriginAttributesWithUserContextId("https://www.example.com:123^userContextId=4", 2).userContextId, 2);
// utility function useful for debugging
function printAttrs(name, attrs) {
do_print(name + " {\n" +
"\tappId: " + attrs.appId + ",\n" +
"\tuserContextId: " + attrs.userContextId + ",\n" +
"\tinBrowser: " + attrs.inBrowser + ",\n" +
"\taddonId: '" + attrs.addonId + "',\n" +
"\tsignedPkg: '" + attrs.signedPkg + "'\n}");
}
function checkValues(attrs, values) {
values = values || {};
//printAttrs("attrs", attrs);
//printAttrs("values", values);
do_check_eq(attrs.appId, values.appId || 0);
do_check_eq(attrs.userContextId, values.userContextId || 0);
do_check_eq(attrs.inBrowser, values.inBrowser || false);
do_check_eq(attrs.addonId, values.addonId || '');
do_check_eq(attrs.signedPkg, values.signedPkg || '');
}
function run_test() {
@ -177,4 +196,83 @@ function run_test() {
checkKind(ssm.createCodebasePrincipal(makeURI('http://www.example.com'), {}), 'codebasePrincipal');
checkKind(ssm.createExpandedPrincipal([ssm.createCodebasePrincipal(makeURI('http://www.example.com'), {})]), 'expandedPrincipal');
checkKind(ssm.getSystemPrincipal(), 'systemPrincipal');
//
// Test Origin Attribute Manipulation
//
// check that we can create an empty origin attributes dict with default
// members and values.
emptyAttrs = ChromeUtils.createDefaultOriginAttributes();
checkValues(emptyAttrs);
var uri = "http://example.org";
var tests = [
[ "", {} ],
[ "^appId=5", {appId: 5} ],
[ "^userContextId=3", {userContextId: 3} ],
[ "^addonId=fooBar", {addonId: "fooBar"} ],
[ "^inBrowser=1", {inBrowser: true} ],
[ "^signedPkg=bazQux", {signedPkg: "bazQux"} ],
[ "^appId=3&inBrowser=1&userContextId=6",
{appId: 3, userContextId: 6, inBrowser: true} ] ];
// check that we can create an origin attributes from an origin properly
tests.forEach(function(t) {
let attrs = ChromeUtils.createOriginAttributesFromOrigin(uri + t[0]);
checkValues(attrs, t[1]);
do_check_eq(ChromeUtils.originAttributesToSuffix(attrs), t[0]);
});
// check that we can create an origin attributes from a dict properly
tests.forEach(function(t) {
let attrs = ChromeUtils.createOriginAttributesFromDict(t[1]);
checkValues(attrs, t[1]);
do_check_eq(ChromeUtils.originAttributesToSuffix(attrs), t[0]);
});
// each row in the set_tests array has these values:
// [0] - the suffix used to create an origin attribute from
// [1] - the expected result of creating an origin attribute from [0]
// [2] - the pattern to set on the origin attributes
// [3] - the expected result of setting [2] values on [1]
// [4] - the expected result of creating a suffix from [3]
var set_tests = [
[ "", {}, {appId: 5}, {appId: 5}, "^appId=5" ],
[ "^appId=5", {appId: 5}, {appId: 3}, {appId: 3}, "^appId=3" ],
[ "^appId=5", {appId: 5}, {userContextId: 3}, {appId: 5, userContextId: 3}, "^appId=5&userContextId=3" ],
[ "^appId=5", {appId: 5}, {appId: 3, userContextId: 7}, {appId: 3, userContextId: 7}, "^appId=3&userContextId=7" ] ];
// check that we can set origin attributes values properly
set_tests.forEach(function(t) {
let orig = ChromeUtils.createOriginAttributesFromOrigin(uri + t[0]);
checkValues(orig, t[1]);
let mod = orig;
for (var key in t[2]) {
mod[key] = t[2][key];
}
checkValues(mod, t[3]);
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[4]);
});
// each row in the dflt_tests array has these values:
// [0] - the suffix used to create an origin attribute from
// [1] - the expected result of creating an origin attributes from [0]
// [2] - the expected result after setting userContextId to the default
// [3] - the expected result of creating a suffix from [2]
var dflt_tests = [
[ "", {}, {}, "" ],
[ "^userContextId=3", {userContextId: 3}, {}, "" ],
[ "^appId=5", {appId: 5}, {appId: 5}, "^appId=5" ],
[ "^appId=5&userContextId=3", {appId: 5, userContextId: 3}, {appId: 5}, "^appId=5" ] ];
// check that we can set the userContextId to default properly
dflt_tests.forEach(function(t) {
let orig = ChromeUtils.createOriginAttributesFromOrigin(uri + t[0]);
checkValues(orig, t[1]);
let mod = orig;
mod['userContextId'] = 0;
checkValues(mod, t[2]);
do_check_eq(ChromeUtils.originAttributesToSuffix(mod), t[3]);
});
}

View File

@ -1158,18 +1158,6 @@ ifneq (,$(DIST_SUBDIR)$(XPI_NAME))
PREF_DIR = defaults/preferences
endif
################################################################################
# Copy each element of AUTOCFG_JS_EXPORTS to $(FINAL_TARGET)/defaults/autoconfig
ifneq ($(AUTOCFG_JS_EXPORTS),)
ifndef NO_DIST_INSTALL
AUTOCFG_JS_EXPORTS_FILES := $(AUTOCFG_JS_EXPORTS)
AUTOCFG_JS_EXPORTS_DEST := $(FINAL_TARGET)/defaults/autoconfig
AUTOCFG_JS_EXPORTS_TARGET := export
INSTALL_TARGETS += AUTOCFG_JS_EXPORTS
endif
endif
################################################################################
# SDK

View File

@ -16,6 +16,7 @@ const TAB_URL = HTTP_ROOT + "service-workers/empty-sw.html";
add_task(function* () {
yield new Promise(done => {
let options = {"set": [
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
]};
SpecialPowers.pushPrefEnv(options, done);

View File

@ -32,6 +32,7 @@ marker.label.cycleCollection=Cycle Collection
marker.label.cycleCollection.forgetSkippable=CC Graph Reduction
marker.label.timestamp=Timestamp
marker.label.worker=Worker
marker.label.messagePort=MessagePort
marker.label.unknown=Unknown
# LOCALIZATION NOTE (marker.label.javascript.*):
@ -82,6 +83,9 @@ marker.worker.serializeDataOffMainThread=Serialize data in Worker
marker.worker.serializeDataOnMainThread=Serialize data on the main thread
marker.worker.deserializeDataOffMainThread=Deserialize data in Worker
marker.worker.deserializeDataOnMainThread=Deserialize data on the main thread
# The type of operation performed by a MessagePort
marker.messagePort.serializeData=Serialize data
marker.messagePort.deserializeData=Deserialize data
# Strings used in the waterfall sidebar as values.
marker.value.unknownFrame=<unknown location>

View File

@ -147,6 +147,13 @@ const Formatters = {
[L10N.getStr("marker.field.type")]:
L10N.getStr(`marker.worker.${marker.workerOperation}`)
};
},
MessagePortFields: function(marker) {
return {
[L10N.getStr("marker.field.type")]:
L10N.getStr(`marker.messagePort.${marker.messagePortOperation}`)
};
}
};

View File

@ -147,6 +147,12 @@ const TIMELINE_BLUEPRINT = {
label: L10N.getStr("marker.label.worker"),
fields: Formatters.WorkerFields
},
"MessagePort": {
group: 1,
colorName: "graphs-orange",
label: L10N.getStr("marker.label.messagePort"),
fields: Formatters.MessagePortFields
},
/* Group 2 - User Controlled */
"ConsoleTime": {

View File

@ -105,7 +105,7 @@ body {
}
.viewport-rotate-button {
mask-image: url("./images/rotate-viewport.svg");
mask: url("./images/rotate-viewport.svg");
}
/**

View File

@ -56,6 +56,7 @@ let startTest = Task.async(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.enabled", true],
["devtools.webconsole.filter.serviceworkers", true]
]}, resolve);
});

View File

@ -49,6 +49,7 @@ let startTest = Task.async(function*() {
yield new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.enabled", true],
["devtools.webconsole.filter.serviceworkers", true]
]}, resolve);
});

View File

@ -14157,11 +14157,6 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNonSubresourceReques
bool* aShouldIntercept)
{
*aShouldIntercept = false;
// Preffed off.
if (!nsContentUtils::ServiceWorkerInterceptionEnabled()) {
return NS_OK;
}
// No in private browsing
if (mInPrivateBrowsing) {
return NS_OK;

View File

@ -30,12 +30,12 @@ private:
void operator=(const AbstractTimelineMarker& aOther) = delete;
public:
explicit AbstractTimelineMarker(const char* aName,
MarkerTracingType aTracingType);
AbstractTimelineMarker(const char* aName,
MarkerTracingType aTracingType);
explicit AbstractTimelineMarker(const char* aName,
const TimeStamp& aTime,
MarkerTracingType aTracingType);
AbstractTimelineMarker(const char* aName,
const TimeStamp& aTime,
MarkerTracingType aTracingType);
virtual ~AbstractTimelineMarker();

View File

@ -38,8 +38,8 @@ class MOZ_RAII AutoTimelineMarker
RefPtr<nsIDocShell> mDocShell;
public:
explicit AutoTimelineMarker(nsIDocShell* aDocShell, const char* aName
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
AutoTimelineMarker(nsIDocShell* aDocShell,
const char* aName MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoTimelineMarker();
AutoTimelineMarker(const AutoTimelineMarker& aOther) = delete;

View File

@ -15,8 +15,8 @@ namespace mozilla {
class CompositeTimelineMarker : public TimelineMarker
{
public:
explicit CompositeTimelineMarker(const TimeStamp& aTime,
MarkerTracingType aTracingType)
CompositeTimelineMarker(const TimeStamp& aTime,
MarkerTracingType aTracingType)
: TimelineMarker("Composite", aTime, aTracingType)
{
// Even though these markers end up being created on the main thread in the

View File

@ -15,8 +15,8 @@ namespace mozilla {
class ConsoleTimelineMarker : public TimelineMarker
{
public:
explicit ConsoleTimelineMarker(const nsAString& aCause,
MarkerTracingType aTracingType)
ConsoleTimelineMarker(const nsAString& aCause,
MarkerTracingType aTracingType)
: TimelineMarker("ConsoleTime", aTracingType)
, mCause(aCause)
{

View File

@ -15,9 +15,9 @@ namespace mozilla {
class EventTimelineMarker : public TimelineMarker
{
public:
explicit EventTimelineMarker(const nsAString& aType,
uint16_t aPhase,
MarkerTracingType aTracingType)
EventTimelineMarker(const nsAString& aType,
uint16_t aPhase,
MarkerTracingType aTracingType)
: TimelineMarker("DOMEvent", aTracingType)
, mType(aType)
, mPhase(aPhase)

View File

@ -17,13 +17,13 @@ namespace mozilla {
class JavascriptTimelineMarker : public TimelineMarker
{
public:
explicit JavascriptTimelineMarker(const char* aReason,
const char16_t* aFunctionName,
const char16_t* aFileName,
uint32_t aLineNumber,
MarkerTracingType aTracingType,
JS::Handle<JS::Value> aAsyncStack,
JS::Handle<JS::Value> aAsyncCause)
JavascriptTimelineMarker(const char* aReason,
const char16_t* aFunctionName,
const char16_t* aFileName,
uint32_t aLineNumber,
MarkerTracingType aTracingType,
JS::Handle<JS::Value> aAsyncStack,
JS::Handle<JS::Value> aAsyncCause)
: TimelineMarker("Javascript", aTracingType, MarkerStackRequest::NO_STACK)
, mCause(NS_ConvertUTF8toUTF16(aReason))
, mFunctionName(aFunctionName)

View File

@ -0,0 +1,47 @@
/* -*- 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 mozilla_MessagePortTimelineMarker_h_
#define mozilla_MessagePortTimelineMarker_h_
#include "TimelineMarker.h"
#include "mozilla/dom/ProfileTimelineMarkerBinding.h"
namespace mozilla {
class MessagePortTimelineMarker : public TimelineMarker
{
public:
MessagePortTimelineMarker(dom::ProfileTimelineMessagePortOperationType aOperationType,
MarkerTracingType aTracingType)
: TimelineMarker("MessagePort", aTracingType, MarkerStackRequest::NO_STACK)
, mOperationType(aOperationType)
{}
virtual UniquePtr<AbstractTimelineMarker> Clone() override
{
MessagePortTimelineMarker* clone =
new MessagePortTimelineMarker(mOperationType, GetTracingType());
clone->SetCustomTime(GetTime());
return UniquePtr<AbstractTimelineMarker>(clone);
}
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override
{
TimelineMarker::AddDetails(aCx, aMarker);
if (GetTracingType() == MarkerTracingType::START) {
aMarker.mMessagePortOperation.Construct(mOperationType);
}
}
private:
dom::ProfileTimelineMessagePortOperationType mOperationType;
};
} // namespace mozilla
#endif /* mozilla_MessagePortTimelineMarker_h_ */

View File

@ -15,8 +15,8 @@ namespace mozilla {
class RestyleTimelineMarker : public TimelineMarker
{
public:
explicit RestyleTimelineMarker(nsRestyleHint aRestyleHint,
MarkerTracingType aTracingType)
RestyleTimelineMarker(nsRestyleHint aRestyleHint,
MarkerTracingType aTracingType)
: TimelineMarker("Styles", aTracingType)
{
if (aRestyleHint) {

View File

@ -18,14 +18,14 @@ namespace mozilla {
class TimelineMarker : public AbstractTimelineMarker
{
public:
explicit TimelineMarker(const char* aName,
MarkerTracingType aTracingType,
MarkerStackRequest aStackRequest = MarkerStackRequest::STACK);
TimelineMarker(const char* aName,
MarkerTracingType aTracingType,
MarkerStackRequest aStackRequest = MarkerStackRequest::STACK);
explicit TimelineMarker(const char* aName,
const TimeStamp& aTime,
MarkerTracingType aTracingType,
MarkerStackRequest aStackRequest = MarkerStackRequest::STACK);
TimelineMarker(const char* aName,
const TimeStamp& aTime,
MarkerTracingType aTracingType,
MarkerStackRequest aStackRequest = MarkerStackRequest::STACK);
virtual void AddDetails(JSContext* aCx, dom::ProfileTimelineMarker& aMarker) override;
virtual JSObject* GetStack() override;

View File

@ -15,8 +15,8 @@ namespace mozilla {
class WorkerTimelineMarker : public TimelineMarker
{
public:
explicit WorkerTimelineMarker(ProfileTimelineWorkerOperationType aOperationType,
MarkerTracingType aTracingType)
WorkerTimelineMarker(ProfileTimelineWorkerOperationType aOperationType,
MarkerTracingType aTracingType)
: TimelineMarker("Worker", aTracingType, MarkerStackRequest::NO_STACK)
, mOperationType(aOperationType)
{}

View File

@ -15,6 +15,7 @@ EXPORTS.mozilla += [
'JavascriptTimelineMarker.h',
'LayerTimelineMarker.h',
'MarkersStorage.h',
'MessagePortTimelineMarker.h',
'ObservedDocShell.h',
'RestyleTimelineMarker.h',
'TimelineConsumers.h',

View File

@ -179,9 +179,7 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "networking", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newaddon", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifdef NIGHTLY_BUILD
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "performance", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "plugins", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "serviceworkers", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifndef ANDROID

View File

@ -50,7 +50,7 @@ ThreadSafeChromeUtils::NondeterministicGetWeakSetKeys(GlobalObject& aGlobal,
}
}
/* static */ void
/* static */ void
ChromeUtils::OriginAttributesToSuffix(dom::GlobalObject& aGlobal,
const dom::OriginAttributesDictionary& aAttrs,
nsCString& aSuffix)
@ -71,11 +71,17 @@ ChromeUtils::OriginAttributesMatchPattern(dom::GlobalObject& aGlobal,
}
/* static */ void
ChromeUtils::CreateOriginAttributesWithUserContextId(dom::GlobalObject& aGlobal,
const nsAString& aOrigin,
uint32_t aUserContextId,
dom::OriginAttributesDictionary& aAttrs,
ErrorResult& aRv)
ChromeUtils::CreateDefaultOriginAttributes(dom::GlobalObject& aGlobal,
dom::OriginAttributesDictionary& aAttrs)
{
aAttrs = GenericOriginAttributes();
}
/* static */ void
ChromeUtils::CreateOriginAttributesFromOrigin(dom::GlobalObject& aGlobal,
const nsAString& aOrigin,
dom::OriginAttributesDictionary& aAttrs,
ErrorResult& aRv)
{
GenericOriginAttributes attrs;
nsAutoCString suffix;
@ -83,11 +89,18 @@ ChromeUtils::CreateOriginAttributesWithUserContextId(dom::GlobalObject& aGlobal,
aRv.Throw(NS_ERROR_FAILURE);
return;
}
attrs.mUserContextId = aUserContextId;
aAttrs = attrs;
}
/* static */ void
ChromeUtils::CreateOriginAttributesFromDict(dom::GlobalObject& aGlobal,
const dom::OriginAttributesDictionary& aAttrs,
dom::OriginAttributesDictionary& aNewAttrs)
{
aNewAttrs = aAttrs;
}
/* static */ bool
ChromeUtils::IsOriginAttributesEqual(dom::GlobalObject& aGlobal,
const dom::OriginAttributesDictionary& aA,

View File

@ -59,11 +59,19 @@ public:
const dom::OriginAttributesPatternDictionary& aPattern);
static void
CreateOriginAttributesWithUserContextId(dom::GlobalObject& aGlobal,
const nsAString& aOrigin,
uint32_t aUserContextId,
dom::OriginAttributesDictionary& aAttrs,
ErrorResult& aRv);
CreateDefaultOriginAttributes(dom::GlobalObject& aGlobal,
dom::OriginAttributesDictionary& aAttrs);
static void
CreateOriginAttributesFromOrigin(dom::GlobalObject& aGlobal,
const nsAString& aOrigin,
dom::OriginAttributesDictionary& aAttrs,
ErrorResult& aRv);
static void
CreateOriginAttributesFromDict(dom::GlobalObject& aGlobal,
const dom::OriginAttributesDictionary& aAttrs,
dom::OriginAttributesDictionary& aNewAttrs);
static bool
IsOriginAttributesEqual(dom::GlobalObject& aGlobal,

View File

@ -295,6 +295,7 @@ StructuredCloneHolder::Read(nsISupports* aParent,
{
MOZ_ASSERT_IF(mSupportedContext == SameProcessSameThread,
mCreationThread == NS_GetCurrentThread());
MOZ_ASSERT(aParent);
mozilla::AutoRestore<nsISupports*> guard(mParent);
mParent = aParent;
@ -1044,9 +1045,11 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
MOZ_ASSERT(aExtraData < mPortIdentifiers.Length());
const MessagePortIdentifier& portIdentifier = mPortIdentifiers[aExtraData];
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(mParent);
ErrorResult rv;
RefPtr<MessagePort> port =
MessagePort::Create(mParent, portIdentifier, rv);
MessagePort::Create(global, portIdentifier, rv);
if (NS_WARN_IF(rv.Failed())) {
return false;
}

View File

@ -274,7 +274,6 @@ bool nsContentUtils::sEncodeDecodeURLHash = false;
bool nsContentUtils::sGettersDecodeURLHash = false;
bool nsContentUtils::sPrivacyResistFingerprinting = false;
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
bool nsContentUtils::sSWInterceptionEnabled = false;
uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
@ -569,10 +568,6 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sPrivacyResistFingerprinting,
"privacy.resistFingerprinting", false);
Preferences::AddBoolVarCache(&sSWInterceptionEnabled,
"dom.serviceWorkers.interception.enabled",
false);
Preferences::AddUintVarCache(&sHandlingInputTimeout,
"dom.event.handling-user-input-time-limit",
1000);
@ -1754,8 +1749,7 @@ nsContentUtils::ParseLegacyFontSize(const nsAString& aValue)
bool
nsContentUtils::IsControlledByServiceWorker(nsIDocument* aDocument)
{
if (!ServiceWorkerInterceptionEnabled() ||
nsContentUtils::IsInPrivateBrowsing(aDocument)) {
if (nsContentUtils::IsInPrivateBrowsing(aDocument)) {
return false;
}

View File

@ -1996,14 +1996,6 @@ public:
return sSendPerformanceTimingNotifications;
}
/*
* Returns true if ServiceWorker Interception is enabled by pref.
*/
static bool ServiceWorkerInterceptionEnabled()
{
return sSWInterceptionEnabled;
}
/*
* Returns true if the frame timing APIs are enabled.
*/
@ -2706,7 +2698,6 @@ private:
static bool sGettersDecodeURLHash;
static bool sPrivacyResistFingerprinting;
static bool sSendPerformanceTimingNotifications;
static bool sSWInterceptionEnabled;
static uint32_t sCookiesLifetimePolicy;
static uint32_t sCookiesBehavior;

View File

@ -43,7 +43,6 @@ SpecialPowers.pushPrefEnv({'set': [
['gfx.offscreencanvas.enabled', true],
['webgl.force-enabled', true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.interception.enabled", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]
]}, runTest);

View File

@ -31,16 +31,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=238987
// but the last blur event goes to i1, not "begin".
var expectedWindowBlurCount = forwardFocusArray.length + backwardFocusArray.length + 3;
// accessibility.tabfocus must be set to value 7 before running test also
// on a mac.
function setOrRestoreTabFocus(newValue) {
if (!newValue) {
SpecialPowers.clearUserPref("accessibility.tabfocus");
} else {
SpecialPowers.setIntPref("accessibility.tabfocus", newValue);
}
}
function handleFocus(e) {
if (e.target.id == "begin") {
// if the modifier is set, the test is coming back from the end.
@ -128,7 +118,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=238987
"|window| didn't get the right amount of blur events");
// Cleanup
setOrRestoreTabFocus(0);
window.removeEventListener("focus", handleWindowFocus, true);
window.removeEventListener("focus", handleWindowFocus, false);
window.removeEventListener("blur", handleWindowBlur, true);
@ -166,9 +155,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=238987
tab();
}
// accessibility.tabfocus must be set to value 7 before running test also
// on a mac.
function doTest() {
setOrRestoreTabFocus(7);
setTimeout(start, 0);
SpecialPowers.pushPrefEnv({"set": [["accessibility.tabfocus", 7]]}, start);
}
SimpleTest.waitForExplicitFinish();

View File

@ -90,15 +90,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
"tr"
];
// ui.key.contentAccess must be set to value 5 before running the test.
function setOrRestoreContentAccess(newValue) {
if (!newValue) {
SpecialPowers.clearUserPref("ui.key.contentAccess");
} else {
SpecialPowers.setIntPref("ui.key.contentAccess", newValue);
}
}
function handleFocus(e) {
ok("accessKey" in e, "(focus) accesskey property not found on element");
var expected = focusArray.shift();
@ -218,17 +209,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
function start() {
testFocusableElements();
testUnfocusableElements();
setOrRestoreContentAccess(0);
SimpleTest.finish();
}
function doTest() {
setOrRestoreContentAccess(5);
setTimeout(start, 100);
SpecialPowers.pushPrefEnv({"set": [["ui.key.contentAccess", 5]]}, start);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("untriaged");
addLoadEvent(doTest);
</script>

View File

@ -21,19 +21,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=457672
var windowBlurCount = 0;
function setUserPref(reset) {
if (reset) {
SpecialPowers.clearUserPref("browser.link.open_newwindow");
} else {
SpecialPowers.setIntPref("browser.link.open_newwindow", 3);
}
}
function listener(evt) {
if (evt.type == "focus") {
is(windowBlurCount, 1,
"Window should have got blur event when opening a new tab!");
setUserPref(true);
document.getElementsByTagName("a")[0].focus();
SimpleTest.finish();
} else if (evt.type == "blur") {
@ -43,13 +34,14 @@ function listener(evt) {
}
function startTest() {
setUserPref(false);
document.getElementsByTagName("a")[0].focus();
// Note, focus/blur don't bubble
window.addEventListener("focus", listener, false);
window.addEventListener("blur", listener, false);
var subwin = window.open("about:blank", "", "");
subwin.addEventListener("focus", function(e) { subwin.close(); }, false);
SpecialPowers.pushPrefEnv({"set": [["browser.link.open_newwindow", 3]]}, function() {
document.getElementsByTagName("a")[0].focus();
// Note, focus/blur don't bubble
window.addEventListener("focus", listener, false);
window.addEventListener("blur", listener, false);
var subwin = window.open("about:blank", "", "");
subwin.addEventListener("focus", function(e) { subwin.close(); }, false);
});
}
addLoadEvent(startTest);

View File

@ -45,7 +45,7 @@
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTest, window);
SimpleTest.waitForFocus(startTest, window);
var gScrollable128 = document.getElementById("Scrollable128");
var gScrollable96 = document.getElementById("Scrollable96");
@ -1315,50 +1315,8 @@ function* doTests()
function* testBody()
{
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_x", 100);
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_y", 100);
SpecialPowers.setIntPref("mousewheel.default.delta_multiplier_z", 100);
SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_x", 100);
SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_y", 100);
SpecialPowers.setIntPref("mousewheel.with_alt.delta_multiplier_z", 100);
SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_x", 100);
SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_y", 100);
SpecialPowers.setIntPref("mousewheel.with_control.delta_multiplier_z", 100);
SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_x", 100);
SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_y", 100);
SpecialPowers.setIntPref("mousewheel.with_meta.delta_multiplier_z", 100);
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_x", 100);
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_y", 100);
SpecialPowers.setIntPref("mousewheel.with_shift.delta_multiplier_z", 100);
SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_x", 100);
SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_y", 100);
SpecialPowers.setIntPref("mousewheel.with_win.delta_multiplier_z", 100);
// If APZ is enabled we should ensure the preventDefault calls work even
// if the test is running slowly.
SpecialPowers.setIntPref("apz.content_response_timeout", 2000);
yield* prepareScrollUnits();
yield* doTests();
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.default.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_alt.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_control.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_meta.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_shift.delta_multiplier_z");
SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_x");
SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_y");
SpecialPowers.clearUserPref("mousewheel.with_win.delta_multiplier_z");
SpecialPowers.clearUserPref("apz.content_response_timeout");
}
var gTestContinuation = null;
@ -1374,6 +1332,31 @@ function runTest()
}
}
function startTest() {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.default.delta_multiplier_x", 100],
["mousewheel.default.delta_multiplier_y", 100],
["mousewheel.default.delta_multiplier_z", 100],
["mousewheel.with_alt.delta_multiplier_x", 100],
["mousewheel.with_alt.delta_multiplier_y", 100],
["mousewheel.with_alt.delta_multiplier_z", 100],
["mousewheel.with_control.delta_multiplier_x", 100],
["mousewheel.with_control.delta_multiplier_y", 100],
["mousewheel.with_control.delta_multiplier_z", 100],
["mousewheel.with_meta.delta_multiplier_x", 100],
["mousewheel.with_meta.delta_multiplier_y", 100],
["mousewheel.with_meta.delta_multiplier_z", 100],
["mousewheel.with_shift.delta_multiplier_x", 100],
["mousewheel.with_shift.delta_multiplier_y", 100],
["mousewheel.with_shift.delta_multiplier_z", 100],
["mousewheel.with_win.delta_multiplier_x", 100],
["mousewheel.with_win.delta_multiplier_y", 100],
["mousewheel.with_win.delta_multiplier_z", 100],
// If APZ is enabled we should ensure the preventDefault calls work even
// if the test is running slowly.
["apz.content_response_timeout", 2000],
]}, runTest);
}
</script>
</pre>
</body>

View File

@ -10,7 +10,7 @@
<video id="v" controls></video>
<script type="application/javascript">
SimpleTest.waitForFocus(runTests, window);
SimpleTest.waitForFocus(startTests, window);
SimpleTest.requestFlakyTimeout("untriaged");
function is()
@ -32,9 +32,12 @@ function hitEventLoop(aFunc, aTimes)
}
}
function startTests() {
SpecialPowers.pushPrefEnv({"set": [["mousewheel.with_control.action", 3]]}, runTests);
}
function runTests()
{
SpecialPowers.setIntPref("mousewheel.with_control.action", 3);
synthesizeKey("0", { accelKey: true });
var video = document.getElementById("v");
@ -55,8 +58,6 @@ function runTests()
is(SpecialPowers.getFullZoom(window), 1.0,
"failed to reset zoom");
SpecialPowers.clearUserPref("mousewheel.with_control.action");
hitEventLoop(window.opener.finish, 20);
}, 20);
}, 20);

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,35 @@ function testSteps()
let quotaManagerService = Cc["@mozilla.org/dom/quota-manager-service;1"].
getService(Ci.nsIQuotaManagerService);
// Keep at least one database open.
let req = indexedDB.open("foo-a", 1);
req.onerror = errorHandler;
req.onsuccess = grabEventAndContinueHandler;
let event = yield undefined;
let dbA = event.target.result;
// Keep at least one factory operation alive by deleting a database that is
// stil open.
req = indexedDB.open("foo-b", 1);
req.onerror = errorHandler;
req.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
let dbB = event.target.result;
indexedDB.deleteDatabase("foo-b");
// Create a database which we will later try to open while maintenance is
// performed.
req = indexedDB.open("foo-c", 1);
req.onerror = errorHandler;
req.onsuccess = grabEventAndContinueHandler;
event = yield undefined;
let dbC = event.target.result;
dbC.close();
let dbCount = 0;
for (let persistence of ["persistent", "temporary", "default"]) {
@ -104,6 +133,13 @@ function testSteps()
let observer = quotaManagerService.QueryInterface(Ci.nsIObserver);
observer.observe(null, "idle-daily", "");
info("Opening database while maintenance is performed");
req = indexedDB.open("foo-c", 1);
req.onerror = errorHandler;
req.onsuccess = grabEventAndContinueHandler;
yield undefined;
info("Waiting for maintenance to start");
// This time is totally arbitrary. Most likely directory scanning will have

View File

@ -173,8 +173,6 @@ WebrtcDeprecatedPrefixWarning=WebRTC interfaces with the "moz" prefix (mozRTCPee
NavigatorGetUserMediaWarning=navigator.mozGetUserMedia has been replaced by navigator.mediaDevices.getUserMedia
# LOCALIZATION NOTE: Do not translate "ServiceWorker". %S is a URL.
InterceptionFailedWithURL=Failed to load '%S'. A ServiceWorker intercepted the request and encountered an unexpected error.
# LOCALIZATION NOTE: Do not translate "ServiceWorker", "FetchEvent.respondWith()", "opaque", or "Response". %S is a URL.
OpaqueInterceptionDisabledWithURL=Failed to load '%S'. A ServiceWorker passed an opaque Response to FetchEvent.respondWith() while opaque interception is disabled.
# LOCALIZATION NOTE: Do not translate "ServiceWorker", "FetchEvent.respondWith()", "FetchEvent", "no-cors", "opaque", "Response", or "RequestMode". %1$S is a URL. %2$S is a RequestMode value.
BadOpaqueInterceptionRequestModeWithURL=Failed to load '%1$S'. A ServiceWorker passed an opaque Response to FetchEvent.respondWith() while handling a '%2$S' FetchEvent. Opaque Response objects are only valid when the RequestMode is 'no-cors'.
# LOCALIZATION NOTE: Do not translate "ServiceWorker", "Error", "Response", "FetchEvent.respondWith()", or "fetch()". %S is a URL.

View File

@ -326,8 +326,6 @@ MediaDecoderStateMachine::~MediaDecoderStateMachine()
MOZ_ASSERT(NS_IsMainThread(), "Should be on main thread.");
MOZ_COUNT_DTOR(MediaDecoderStateMachine);
mReader = nullptr;
#ifdef XP_WIN
timeEndPeriod(1);
#endif

View File

@ -212,12 +212,10 @@ public:
OwnerThread()->Dispatch(r.forget());
}
// Drop reference to mReader and mResource. Only called during shutdown dance.
// Drop reference to mResource. Only called during shutdown dance.
void BreakCycles() {
MOZ_ASSERT(NS_IsMainThread());
if (mReader) {
mReader->BreakCycles();
}
mReader->BreakCycles();
mResource = nullptr;
}
@ -248,17 +246,11 @@ public:
bool IsRealTime() const { return mRealTime; }
size_t SizeOfVideoQueue() {
if (mReader) {
return mReader->SizeOfVideoQueueInBytes();
}
return 0;
return mReader->SizeOfVideoQueueInBytes();
}
size_t SizeOfAudioQueue() {
if (mReader) {
return mReader->SizeOfAudioQueueInBytes();
}
return 0;
return mReader->SizeOfAudioQueueInBytes();
}
private:
@ -903,7 +895,7 @@ private:
// The reader, don't call its methods with the decoder monitor held.
// This is created in the state machine's constructor.
RefPtr<MediaDecoderReader> mReader;
const RefPtr<MediaDecoderReader> mReader;
// The end time of the last audio frame that's been pushed onto the media sink
// in microseconds. This will approximately be the end time

View File

@ -1103,7 +1103,7 @@ static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices;
already_AddRefed<MediaManager::PledgeChar>
MediaManager::SelectSettings(
MediaStreamConstraints& aConstraints,
RefPtr<Refcountable<ScopedDeletePtr<SourceSet>>>& aSources)
RefPtr<Refcountable<UniquePtr<SourceSet>>>& aSources)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<PledgeChar> p = new PledgeChar();
@ -1414,7 +1414,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
realBackend = manager->GetBackend(aWindowId);
}
ScopedDeletePtr<SourceSet> result(new SourceSet);
auto result = MakeUnique<SourceSet>();
if (hasVideo) {
nsTArray<RefPtr<VideoDevice>> videos;
@ -1432,16 +1432,16 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
result->AppendElement(source);
}
}
SourceSet* handoff = result.forget();
SourceSet* handoff = result.release();
NS_DispatchToMainThread(do_AddRef(NewRunnableFrom([id, handoff]() mutable {
ScopedDeletePtr<SourceSet> result(handoff); // grab result
UniquePtr<SourceSet> result(handoff); // grab result
RefPtr<MediaManager> mgr = MediaManager_GetInstance();
if (!mgr) {
return NS_OK;
}
RefPtr<PledgeSourceSet> p = mgr->mOutstandingPledges.Remove(id);
if (p) {
p->Resolve(result.forget());
p->Resolve(result.release());
}
return NS_OK;
})));
@ -1609,9 +1609,9 @@ media::Parent<media::NonE10s>*
MediaManager::GetNonE10sParent()
{
if (!mNonE10sParent) {
mNonE10sParent = new media::Parent<media::NonE10s>(true);
mNonE10sParent = MakeUnique<media::Parent<media::NonE10s>>(true);
}
return mNonE10sParent;
return mNonE10sParent.get();
}
/* static */ void
@ -2115,8 +2115,8 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
p->Then([this, onSuccess, onFailure, windowID, c, listener, askPermission,
prefs, isHTTPS, callID, origin](SourceSet*& aDevices) mutable {
RefPtr<Refcountable<ScopedDeletePtr<SourceSet>>> devices(
new Refcountable<ScopedDeletePtr<SourceSet>>(aDevices)); // grab result
RefPtr<Refcountable<UniquePtr<SourceSet>>> devices(
new Refcountable<UniquePtr<SourceSet>>(aDevices)); // grab result
// Ensure that the captured 'this' pointer and our windowID are still good.
if (!MediaManager::Exists() ||
@ -2176,7 +2176,7 @@ MediaManager::GetUserMedia(nsPIDOMWindowInner* aWindow,
onFailure.forget(),
windowID, listener,
prefs, origin,
devices->forget()));
devices->release()));
// Store the task w/callbacks.
mActiveCallbacks.Put(callID, task.forget());
@ -2335,7 +2335,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
aVideoType, aAudioType,
aFake, aFakeTracks);
p->Then([id, aWindowId, aOriginKey](SourceSet*& aDevices) mutable {
ScopedDeletePtr<SourceSet> devices(aDevices); // secondary result
UniquePtr<SourceSet> devices(aDevices); // secondary result
// Only run if window is still on our active list.
RefPtr<MediaManager> mgr = MediaManager_GetInstance();
@ -2347,7 +2347,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
return NS_OK;
}
MediaManager_AnonymizeDevices(*devices, aOriginKey);
p->Resolve(devices.forget());
p->Resolve(devices.release());
return NS_OK;
});
});
@ -2381,7 +2381,7 @@ MediaManager::EnumerateDevices(nsPIDOMWindowInner* aWindow,
MediaSourceEnum::Microphone,
fake);
p->Then([onSuccess, windowId, listener](SourceSet*& aDevices) mutable {
ScopedDeletePtr<SourceSet> devices(aDevices); // grab result
UniquePtr<SourceSet> devices(aDevices); // grab result
RefPtr<MediaManager> mgr = MediaManager_GetInstance();
mgr->RemoveFromWindowList(windowId, listener);
nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*devices);

View File

@ -30,6 +30,7 @@
#include "mozilla/media/MediaChild.h"
#include "mozilla/media/MediaParent.h"
#include "mozilla/Logging.h"
#include "mozilla/UniquePtr.h"
#include "DOMMediaStream.h"
#ifdef MOZ_WEBRTC
@ -501,7 +502,7 @@ private:
already_AddRefed<PledgeChar>
SelectSettings(
dom::MediaStreamConstraints& aConstraints,
RefPtr<media::Refcountable<ScopedDeletePtr<SourceSet>>>& aSources);
RefPtr<media::Refcountable<UniquePtr<SourceSet>>>& aSources);
StreamListeners* AddWindowID(uint64_t aWindowId);
WindowTable *GetActiveWindows() {
@ -550,7 +551,7 @@ private:
#endif
public:
media::CoatCheck<media::Pledge<nsCString>> mGetOriginKeyPledges;
ScopedDeletePtr<media::Parent<media::NonE10s>> mNonE10sParent;
UniquePtr<media::Parent<media::NonE10s>> mNonE10sParent;
};
} // namespace mozilla

View File

@ -8,6 +8,7 @@
#include "gfx2DGlue.h"
#include "ImageContainer.h"
#include "Layers.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
@ -52,18 +53,18 @@ VideoFrame::CreateBlackImage(const gfx::IntSize& aSize)
int len = ((aSize.width * aSize.height) * 3 / 2);
// Generate a black image.
ScopedDeletePtr<uint8_t> frame(new uint8_t[len]);
auto frame = MakeUnique<uint8_t[]>(len);
int y = aSize.width * aSize.height;
// Fill Y plane.
memset(frame.rwget(), 0x10, y);
memset(frame.get(), 0x10, y);
// Fill Cb/Cr planes.
memset(frame.rwget() + y, 0x80, (len - y));
memset(frame.get() + y, 0x80, (len - y));
const uint8_t lumaBpp = 8;
const uint8_t chromaBpp = 4;
layers::PlanarYCbCrData data;
data.mYChannel = frame.rwget();
data.mYChannel = frame.get();
data.mYSize = gfx::IntSize(aSize.width, aSize.height);
data.mYStride = (int32_t) (aSize.width * lumaBpp / 8.0);
data.mCbCrStride = (int32_t) (aSize.width * chromaBpp / 8.0);

View File

@ -1,6 +1,5 @@
[DEFAULT]
skip-if = buildapp == 'b2g' # b2g( ReferenceError: MediaSource is not defined)
subsuite = media
support-files =
mediasource.js
seek.webm seek.webm^headers^

View File

@ -127,13 +127,7 @@ MediaOmxCommonDecoder::PauseStateMachine()
MOZ_ASSERT(NS_IsMainThread());
DECODER_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__));
if (mShuttingDown) {
return;
}
if (!GetStateMachine()) {
return;
}
MOZ_ASSERT(GetStateMachine());
// enter dormant state
GetStateMachine()->DispatchSetDormant(true);
}

View File

@ -46,7 +46,7 @@ SanitizeOriginKeys(const uint64_t& aSinceWhen, bool aOnlyPrivateBrowsing)
if (XRE_GetProcessType() == GeckoProcessType_Default) {
// Avoid opening MediaManager in this case, since this is called by
// sanitize.js when cookies are cleared, which can happen on startup.
ScopedDeletePtr<Parent<NonE10s>> tmpParent(new Parent<NonE10s>(true));
auto tmpParent = MakeUnique<Parent<NonE10s>>(true);
tmpParent->RecvSanitizeOriginKeys(aSinceWhen, aOnlyPrivateBrowsing);
} else {
Child::Get()->SendSanitizeOriginKeys(aSinceWhen, aOnlyPrivateBrowsing);

View File

@ -10,6 +10,7 @@
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "nsIAsyncShutdown.h"
#include "mozilla/UniquePtr.h"
#include "base/task.h"
namespace mozilla {
@ -96,8 +97,8 @@ public:
OnSuccessType mOnSuccess;
OnFailureType mOnFailure;
};
mFunctors = new Functors(Forward<OnSuccessType>(aOnSuccess),
Forward<OnFailureType>(aOnFailure));
mFunctors = MakeUnique<Functors>(Forward<OnSuccessType>(aOnSuccess),
Forward<OnFailureType>(aOnFailure));
if (mDone) {
if (!mRejected) {
mFunctors->Succeed(mValue);
@ -142,7 +143,7 @@ private:
bool mDone;
bool mRejected;
ErrorType mError;
ScopedDeletePtr<FunctorsBase> mFunctors;
UniquePtr<FunctorsBase> mFunctors;
};
/* media::NewRunnableFrom() - Create an nsRunnable from a lambda.
@ -337,7 +338,7 @@ private:
* (or owning smart-pointers to such objects) refcountable.
*
* Technical limitation: A template specialization is needed for types that take
* a constructor. Please add below (ScopedDeletePtr covers a lot of ground though).
* a constructor. Please add below (UniquePtr covers a lot of ground though).
*/
template<typename T>
@ -350,13 +351,13 @@ private:
};
template<typename T>
class Refcountable<ScopedDeletePtr<T>> : public ScopedDeletePtr<T>
class Refcountable<UniquePtr<T>> : public UniquePtr<T>
{
public:
explicit Refcountable<ScopedDeletePtr<T>>(T* aPtr) : ScopedDeletePtr<T>(aPtr) {}
explicit Refcountable<UniquePtr<T>>(T* aPtr) : UniquePtr<T>(aPtr) {}
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Refcountable<T>)
private:
~Refcountable<ScopedDeletePtr<T>>() {}
~Refcountable<UniquePtr<T>>() {}
};
/* media::ShutdownBlocker - Async shutdown helper.

View File

@ -23,7 +23,6 @@
[DEFAULT]
skip-if = buildapp == 'mulet' || (os == 'win' && strictContentSandbox) || android_version == '18' # strictContentSandbox (Bug 1042735)
subsuite = media
support-files =
16bit_wave_extrametadata.wav
16bit_wave_extrametadata.wav^headers^

View File

@ -3,7 +3,6 @@
# won't run on b2g desktop tests - bug 1119993
# broken HTTPS on b2g emulator - bug 1135339
skip-if = (os == 'win' && strictContentSandbox) || android_version == '10' || android_version == '18' || (buildapp == 'b2g' && toolkit != 'gonk') || (buildapp == 'b2g' && toolkit == 'gonk') || buildapp == 'mulet'
subsuite = media
support-files =
/.well-known/idp-proxy/idp.js
identityPcTest.js

View File

@ -1,6 +1,5 @@
[DEFAULT]
tags=msg
subsuite=media
support-files =
ipc.json

View File

@ -1,7 +1,6 @@
[DEFAULT]
# strictContentSandbox - bug 1042735, Android 2.3 - bug 981881
tags = msg webrtc
subsuite = media
skip-if = (os == 'win' && strictContentSandbox) || android_version == '10' || (buildapp == 'mulet') || (toolkit == 'gonk' && debug) # b2g(Either bug 1171118 or bug 1169838, take your pick)
support-files =
head.js

View File

@ -1,7 +1,6 @@
[DEFAULT]
tags=msg
tags = webaudio
subsuite = media
skip-if = ((buildapp == 'b2g') && (toolkit != 'gonk' || debug)) || (os == 'win' && strictContentSandbox) #b2g-debug,b2g-desktop(bug 916135); strictContentSandbox(Bug 1042735)
support-files =
audio-expected.wav

View File

@ -1,7 +1,6 @@
[DEFAULT]
tags=msg
skip-if = buildapp == 'b2g' # Bug 1191270, bug 1037287, bug 967606, bug 1096400, etc
subsuite = media
support-files =
head.js
hello.ogg

View File

@ -1,6 +1,5 @@
[DEFAULT]
tags=msg
subsuite = media
support-files =
common.js
file_bfcache_frame.html

View File

@ -13,14 +13,14 @@
#include "mozilla/dom/WorkerRunnable.h"
#include "nsContentUtils.h"
#include "nsIDocument.h"
#include "nsIGlobalObject.h"
#include "nsIPrincipal.h"
#include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h"
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MessageChannel, mWindow, mPort1, mPort2)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MessageChannel, mGlobal, mPort1, mPort2)
NS_IMPL_CYCLE_COLLECTING_ADDREF(MessageChannel)
NS_IMPL_CYCLE_COLLECTING_RELEASE(MessageChannel)
@ -29,9 +29,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MessageChannel)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
MessageChannel::MessageChannel(nsPIDOMWindowInner* aWindow)
: mWindow(aWindow)
MessageChannel::MessageChannel(nsIGlobalObject* aGlobal)
: mGlobal(aGlobal)
{
MOZ_ASSERT(aGlobal);
}
MessageChannel::~MessageChannel()
@ -47,14 +48,15 @@ MessageChannel::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
/* static */ already_AddRefed<MessageChannel>
MessageChannel::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv)
{
// window can be null in workers.
nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
return Constructor(window, aRv);
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
return Constructor(global, aRv);
}
/* static */ already_AddRefed<MessageChannel>
MessageChannel::Constructor(nsPIDOMWindowInner* aWindow, ErrorResult& aRv)
MessageChannel::Constructor(nsIGlobalObject* aGlobal, ErrorResult& aRv)
{
MOZ_ASSERT(aGlobal);
nsID portUUID1;
aRv = nsContentUtils::GenerateUUIDInPlace(portUUID1);
if (aRv.Failed()) {
@ -67,14 +69,14 @@ MessageChannel::Constructor(nsPIDOMWindowInner* aWindow, ErrorResult& aRv)
return nullptr;
}
RefPtr<MessageChannel> channel = new MessageChannel(aWindow);
RefPtr<MessageChannel> channel = new MessageChannel(aGlobal);
channel->mPort1 = MessagePort::Create(aWindow, portUUID1, portUUID2, aRv);
channel->mPort1 = MessagePort::Create(aGlobal, portUUID1, portUUID2, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
channel->mPort2 = MessagePort::Create(aWindow, portUUID2, portUUID1, aRv);
channel->mPort2 = MessagePort::Create(aGlobal, portUUID2, portUUID1, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}

View File

@ -14,7 +14,7 @@
#include "nsWrapperCache.h"
#include "nsCOMPtr.h"
class nsPIDOMWindowInner;
class nsIGlobalObject;
namespace mozilla {
namespace dom {
@ -28,10 +28,10 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessageChannel)
nsPIDOMWindowInner*
nsIGlobalObject*
GetParentObject() const
{
return mWindow;
return mGlobal;
}
virtual JSObject*
@ -41,7 +41,7 @@ public:
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
static already_AddRefed<MessageChannel>
Constructor(nsPIDOMWindowInner* aWindow, ErrorResult& aRv);
Constructor(nsIGlobalObject* aGlobal, ErrorResult& aRv);
MessagePort*
Port1() const
@ -56,10 +56,10 @@ public:
}
private:
explicit MessageChannel(nsPIDOMWindowInner* aWindow);
explicit MessageChannel(nsIGlobalObject* aGlobal);
~MessageChannel();
nsCOMPtr<nsPIDOMWindowInner> mWindow;
nsCOMPtr<nsIGlobalObject> mGlobal;
RefPtr<MessagePort> mPort1;
RefPtr<MessagePort> mPort2;

View File

@ -22,6 +22,9 @@
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/MessagePortTimelineMarker.h"
#include "mozilla/TimelineConsumers.h"
#include "mozilla/TimelineMarker.h"
#include "mozilla/unused.h"
#include "nsContentUtils.h"
#include "nsGlobalWindow.h"
@ -86,15 +89,8 @@ private:
nsresult
DispatchMessage() const
{
nsCOMPtr<nsIGlobalObject> globalObject;
if (NS_IsMainThread()) {
globalObject = do_QueryInterface(mPort->GetParentObject());
} else {
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(workerPrivate);
globalObject = workerPrivate->GlobalScope();
}
nsCOMPtr<nsIGlobalObject> globalObject = mPort->GetParentObject();
MOZ_ASSERT(globalObject);
AutoJSAPI jsapi;
if (!globalObject || !jsapi.Init(globalObject)) {
@ -107,7 +103,27 @@ private:
ErrorResult rv;
JS::Rooted<JS::Value> value(cx);
UniquePtr<AbstractTimelineMarker> start;
UniquePtr<AbstractTimelineMarker> end;
RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();
bool isTimelineRecording = timelines && !timelines->IsEmpty();
if (isTimelineRecording) {
start = MakeUnique<MessagePortTimelineMarker>(
ProfileTimelineMessagePortOperationType::DeserializeData,
MarkerTracingType::START);
}
mData->Read(mPort->GetParentObject(), cx, &value, rv);
if (isTimelineRecording) {
end = MakeUnique<MessagePortTimelineMarker>(
ProfileTimelineMessagePortOperationType::DeserializeData,
MarkerTracingType::END);
timelines->AddMarkerForAllObservedDocShells(start);
timelines->AddMarkerForAllObservedDocShells(end);
}
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
}
@ -259,20 +275,17 @@ NS_IMPL_ISUPPORTS(ForceCloseHelper, nsIIPCBackgroundChildCreateCallback)
} // namespace
MessagePort::MessagePort(nsISupports* aSupports)
: mInnerID(0)
MessagePort::MessagePort(nsIGlobalObject* aGlobal)
: DOMEventTargetHelper(aGlobal)
, mInnerID(0)
, mMessageQueueEnabled(false)
, mIsKeptAlive(false)
{
MOZ_ASSERT(aGlobal);
mIdentifier = new MessagePortIdentifier();
mIdentifier->neutered() = true;
mIdentifier->sequenceId() = 0;
nsCOMPtr<nsIGlobalObject> globalObject = do_QueryInterface(aSupports);
if (NS_WARN_IF(!globalObject)) {
return;
}
BindToOwner(globalObject);
}
MessagePort::~MessagePort()
@ -282,21 +295,25 @@ MessagePort::~MessagePort()
}
/* static */ already_AddRefed<MessagePort>
MessagePort::Create(nsISupports* aSupport, const nsID& aUUID,
MessagePort::Create(nsIGlobalObject* aGlobal, const nsID& aUUID,
const nsID& aDestinationUUID, ErrorResult& aRv)
{
RefPtr<MessagePort> mp = new MessagePort(aSupport);
MOZ_ASSERT(aGlobal);
RefPtr<MessagePort> mp = new MessagePort(aGlobal);
mp->Initialize(aUUID, aDestinationUUID, 1 /* 0 is an invalid sequence ID */,
false /* Neutered */, eStateUnshippedEntangled, aRv);
return mp.forget();
}
/* static */ already_AddRefed<MessagePort>
MessagePort::Create(nsISupports* aSupport,
MessagePort::Create(nsIGlobalObject* aGlobal,
const MessagePortIdentifier& aIdentifier,
ErrorResult& aRv)
{
RefPtr<MessagePort> mp = new MessagePort(aSupport);
MOZ_ASSERT(aGlobal);
RefPtr<MessagePort> mp = new MessagePort(aGlobal);
mp->Initialize(aIdentifier.uuid(), aIdentifier.destinationUuid(),
aIdentifier.sequenceId(), aIdentifier.neutered(),
eStateEntangling, aRv);
@ -420,7 +437,27 @@ MessagePort::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
RefPtr<SharedMessagePortMessage> data = new SharedMessagePortMessage();
UniquePtr<AbstractTimelineMarker> start;
UniquePtr<AbstractTimelineMarker> end;
RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();
bool isTimelineRecording = timelines && !timelines->IsEmpty();
if (isTimelineRecording) {
start = MakeUnique<MessagePortTimelineMarker>(
ProfileTimelineMessagePortOperationType::SerializeData,
MarkerTracingType::START);
}
data->Write(aCx, aMessage, transferable, aRv);
if (isTimelineRecording) {
end = MakeUnique<MessagePortTimelineMarker>(
ProfileTimelineMessagePortOperationType::SerializeData,
MarkerTracingType::END);
timelines->AddMarkerForAllObservedDocShells(start);
timelines->AddMarkerForAllObservedDocShells(end);
}
if (NS_WARN_IF(aRv.Failed())) {
return;
}

View File

@ -16,7 +16,7 @@
#undef PostMessage
#endif
class nsPIDOMWindowInner;
class nsIGlobalObject;
namespace mozilla {
namespace dom {
@ -45,11 +45,12 @@ public:
DOMEventTargetHelper)
static already_AddRefed<MessagePort>
Create(nsISupports* aSupport, const nsID& aUUID,
Create(nsIGlobalObject* aGlobal, const nsID& aUUID,
const nsID& aDestinationUUID, ErrorResult& aRv);
static already_AddRefed<MessagePort>
Create(nsISupports* aSupport, const MessagePortIdentifier& aIdentifier,
Create(nsIGlobalObject* aGlobal,
const MessagePortIdentifier& aIdentifier,
ErrorResult& aRv);
// For IPC.
@ -88,7 +89,7 @@ public:
void Closed();
private:
explicit MessagePort(nsISupports* nsISupports);
explicit MessagePort(nsIGlobalObject* aGlobal);
~MessagePort();
enum State {

View File

@ -68,6 +68,7 @@ http://creativecommons.org/licenses/publicdomain/
SpecialPowers.addPermission("desktop-notification", false, document);
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]

View File

@ -120,6 +120,7 @@ http://creativecommons.org/licenses/publicdomain/
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]

View File

@ -115,6 +115,7 @@ http://creativecommons.org/licenses/publicdomain/
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]

View File

@ -102,6 +102,7 @@ var defaultServerURL = SpecialPowers.getCharPref("dom.push.serverURL");
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],

View File

@ -323,10 +323,10 @@
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.serviceWorkers.interception.enabled", true]
]}, runTest);
SpecialPowers.addPermission('desktop-notification', true, document);
SimpleTest.waitForExplicitFinish();

View File

@ -289,6 +289,7 @@ http://creativecommons.org/licenses/publicdomain/
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]

View File

@ -81,6 +81,7 @@ http://creativecommons.org/licenses/publicdomain/
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]

View File

@ -19,6 +19,7 @@ function setupPrefs() {
return new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [
["dom.push.enabled", true],
["dom.push.connection.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true]

View File

@ -9,6 +9,8 @@ const {PushDB, PushService, PushServiceHttp2} = serviceExports;
var prefs;
var tlsProfile;
var pushEnabled;
var pushConnectionEnabled;
var serverPort = -1;
@ -19,14 +21,19 @@ function run_test() {
dump("using port " + serverPort + "\n");
do_get_profile();
setPrefs();
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
tlsProfile = prefs.getBoolPref("network.http.spdy.enforce-tls-profile");
pushEnabled = prefs.getBoolPref("dom.push.enabled");
pushConnectionEnabled = prefs.getBoolPref("dom.push.connection.enabled");
// Set to allow the cert presented by our H2 server
var oldPref = prefs.getIntPref("network.http.speculative-parallel-limit");
prefs.setIntPref("network.http.speculative-parallel-limit", 0);
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", false);
prefs.setBoolPref("dom.push.enabled", true);
prefs.setBoolPref("dom.push.connection.enabled", true);
addCertOverride("localhost", serverPort,
Ci.nsICertOverrideService.ERROR_UNTRUSTED |
@ -155,4 +162,6 @@ add_task(function* test_pushNotifications() {
add_task(function* test_complete() {
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", tlsProfile);
prefs.setBoolPref("dom.push.enabled", pushEnabled);
prefs.setBoolPref("dom.push.connection.enabled", pushConnectionEnabled);
});

View File

@ -11,6 +11,8 @@ var prefs;
var tlsProfile;
var serverURL;
var serverPort = -1;
var pushEnabled;
var pushConnectionEnabled;
var db;
function run_test() {
@ -22,11 +24,15 @@ function run_test() {
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
tlsProfile = prefs.getBoolPref("network.http.spdy.enforce-tls-profile");
pushEnabled = prefs.getBoolPref("dom.push.enabled");
pushConnectionEnabled = prefs.getBoolPref("dom.push.connection.enabled");
// Set to allow the cert presented by our H2 server
var oldPref = prefs.getIntPref("network.http.speculative-parallel-limit");
prefs.setIntPref("network.http.speculative-parallel-limit", 0);
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", false);
prefs.setBoolPref("dom.push.enabled", true);
prefs.setBoolPref("dom.push.connection.enabled", true);
addCertOverride("localhost", serverPort,
Ci.nsICertOverrideService.ERROR_UNTRUSTED |
@ -119,4 +125,6 @@ add_task(function* test_pushSubscriptionMissingLink2() {
add_task(function* test_complete() {
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", tlsProfile);
prefs.setBoolPref("dom.push.enabled", pushEnabled);
prefs.setBoolPref("dom.push.connection.enabled", pushConnectionEnabled);
});

View File

@ -53,6 +53,7 @@ function run_test() {
servicePrefs.set('testing.notifyWorkers', false);
servicePrefs.set('testing.notifyAllObservers', true);
setPrefs();
run_next_test();
}

View File

@ -18,6 +18,8 @@ const {PushDB, PushService, PushServiceHttp2} = serviceExports;
var prefs;
var tlsProfile;
var pushEnabled;
var pushConnectionEnabled;
var serverPort = -1;
@ -30,11 +32,15 @@ function run_test() {
prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
tlsProfile = prefs.getBoolPref("network.http.spdy.enforce-tls-profile");
pushEnabled = prefs.getBoolPref("dom.push.enabled");
pushConnectionEnabled = prefs.getBoolPref("dom.push.connection.enabled");
// Set to allow the cert presented by our H2 server
var oldPref = prefs.getIntPref("network.http.speculative-parallel-limit");
prefs.setIntPref("network.http.speculative-parallel-limit", 0);
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", false);
prefs.setBoolPref("dom.push.enabled", true);
prefs.setBoolPref("dom.push.connection.enabled", true);
addCertOverride("localhost", serverPort,
Ci.nsICertOverrideService.ERROR_UNTRUSTED |
@ -81,4 +87,6 @@ add_task(function* test_pushUnsubscriptionSuccess() {
add_task(function* test_complete() {
prefs.setBoolPref("network.http.spdy.enforce-tls-profile", tlsProfile);
prefs.setBoolPref("dom.push.enabled", pushEnabled);
prefs.setBoolPref("dom.push.connection.enabled", pushConnectionEnabled);
});

View File

@ -3773,6 +3773,7 @@ QuotaManager::OpenDirectory(PersistenceType aPersistenceType,
void
QuotaManager::OpenDirectoryInternal(Nullable<PersistenceType> aPersistenceType,
const OriginScope& aOriginScope,
Nullable<Client::Type> aClientType,
bool aExclusive,
OpenDirectoryListener* aOpenListener)
{
@ -3783,7 +3784,7 @@ QuotaManager::OpenDirectoryInternal(Nullable<PersistenceType> aPersistenceType,
EmptyCString(),
aOriginScope,
Nullable<bool>(),
Nullable<Client::Type>(),
Nullable<Client::Type>(aClientType),
aExclusive,
true,
aOpenListener);
@ -5029,6 +5030,7 @@ NormalOriginOperationBase::Open()
QuotaManager::Get()->OpenDirectoryInternal(mPersistenceType,
mOriginScope,
Nullable<Client::Type>(),
mExclusive,
this);
}

View File

@ -230,6 +230,7 @@ public:
void
OpenDirectoryInternal(Nullable<PersistenceType> aPersistenceType,
const OriginScope& aOriginScope,
Nullable<Client::Type> aClientType,
bool aExclusive,
OpenDirectoryListener* aOpenListener);

View File

@ -16,6 +16,7 @@ EXPORTS.mozilla.dom.quota += [
'ActorsParent.h',
'Client.h',
'FileStreams.h',
'OriginScope.h',
'PersistenceType.h',
'QuotaCommon.h',
'QuotaManager.h',

View File

@ -135,7 +135,6 @@
onload = function() {
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.interception.enabled", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.caches.enabled", true]

View File

@ -36,7 +36,6 @@ function receiveMessage(event) {
onload = function() {
SpecialPowers.pushPrefEnv({"set": [
["dom.serviceWorkers.exemptFromPerDomainMax", true],
["dom.serviceWorkers.interception.enabled", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.caches.enabled", true]

View File

@ -12,7 +12,6 @@ function testScript(script) {
SpecialPowers.pushPrefEnv({
"set": [["dom.requestcache.enabled", true],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.interception.opaque.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.serviceWorkers.exemptFromPerDomainMax", true]]
}, function() {

View File

@ -30,13 +30,39 @@ interface ChromeUtils : ThreadSafeChromeUtils {
optional OriginAttributesPatternDictionary pattern);
/**
* Returns an OriginAttributes dictionary using the origin URI but forcing
* the passed userContextId.
* Returns an OriginAttributesDictionary with all default attributes added
* and assigned default values.
*
* @returns An OriginAttributesDictionary populated with the
* default attributes added and assigned default values.
*/
static OriginAttributesDictionary
createDefaultOriginAttributes();
/**
* Returns an OriginAttributesDictionary with values from the |origin| suffix
* and unspecified attributes added and assigned default values.
*
* @param origin The origin URI to create from.
* @returns An OriginAttributesDictionary with values from
* the origin suffix and unspecified attributes
* added and assigned default values.
*/
[Throws]
static OriginAttributesDictionary
createOriginAttributesWithUserContextId(DOMString origin,
unsigned long userContextId);
createOriginAttributesFromOrigin(DOMString origin);
/**
* Returns an OriginAttributesDictionary that is a copy of |originAttrs| with
* unspecified attributes added and assigned default values.
*
* @param originAttrs The origin attributes to copy.
* @returns An OriginAttributesDictionary copy of |originAttrs|
* with unspecified attributes added and assigned
* default values.
*/
static OriginAttributesDictionary
createOriginAttributesFromDict(optional OriginAttributesDictionary originAttrs);
/**
* Returns true if the 2 OriginAttributes are equal.

View File

@ -25,6 +25,11 @@ dictionary ProfileTimelineLayerRect {
long height = 0;
};
enum ProfileTimelineMessagePortOperationType {
"serializeData",
"deserializeData",
};
enum ProfileTimelineWorkerOperationType {
"serializeDataOffMainThread",
"serializeDataOnMainThread",
@ -61,6 +66,9 @@ dictionary ProfileTimelineMarker {
/* For Style markers. */
DOMString restyleHint;
/* For MessagePort markers. */
ProfileTimelineMessagePortOperationType messagePortOperation;
/* For Worker markers. */
ProfileTimelineWorkerOperationType workerOperation;
};

View File

@ -22,7 +22,6 @@ interface ServiceWorkerGlobalScope : WorkerGlobalScope {
attribute EventHandler oninstall;
attribute EventHandler onactivate;
[Func="mozilla::dom::workers::ServiceWorkerGlobalScope::InterceptionEnabled"]
attribute EventHandler onfetch;
// The event.source of these MessageEvents are instances of Client

View File

@ -2288,13 +2288,14 @@ RuntimeService::CreateSharedWorkerFromLoadInfo(JSContext* aCx,
// We don't actually care about this MessageChannel, but we use it to 'steal'
// its 2 connected ports.
RefPtr<MessageChannel> channel = MessageChannel::Constructor(window, rv);
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(window);
RefPtr<MessageChannel> channel = MessageChannel::Constructor(global, rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
}
RefPtr<SharedWorker> sharedWorker = new SharedWorker(window, workerPrivate,
channel->Port1());
channel->Port1());
if (!workerPrivate->RegisterSharedWorker(sharedWorker, channel->Port2())) {
NS_WARNING("Worker is unreachable, this shouldn't happen!");

View File

@ -554,15 +554,6 @@ RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValu
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
// Allow opaque response interception to be disabled until we can ensure the
// security implications are not a complete disaster.
if (response->Type() == ResponseType::Opaque &&
!worker->OpaqueInterceptionEnabled()) {
autoCancel.SetCancelMessage(
NS_LITERAL_CSTRING("OpaqueInterceptionDisabledWithURL"), mRequestURL);
return;
}
// Section "HTTP Fetch", step 2.2:
// If one of the following conditions is true, return a network error:
// * response's type is "error".

View File

@ -31,8 +31,6 @@ WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled,
WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)
WORKER_SIMPLE_PREF("dom.serviceWorkers.enabled", ServiceWorkersEnabled, SERVICEWORKERS_ENABLED)
WORKER_SIMPLE_PREF("dom.serviceWorkers.testing.enabled", ServiceWorkersTestingEnabled, SERVICEWORKERS_TESTING_ENABLED)
WORKER_SIMPLE_PREF("dom.serviceWorkers.interception.enabled", InterceptionEnabled, INTERCEPTION_ENABLED)
WORKER_SIMPLE_PREF("dom.serviceWorkers.interception.opaque.enabled", OpaqueInterceptionEnabled, INTERCEPTION_OPAQUE_ENABLED)
WORKER_SIMPLE_PREF("dom.serviceWorkers.openWindow.enabled", OpenWindowEnabled, OPEN_WINDOW_ENABLED)
WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
WORKER_SIMPLE_PREF("dom.requestcache.enabled", RequestCacheEnabled, REQUESTCACHE_ENABLED)

View File

@ -668,11 +668,24 @@ public:
DispatchDOMEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
DOMEventTargetHelper* aTarget, bool aIsMainThread)
{
nsCOMPtr<nsPIDOMWindowInner> parent;
if (aIsMainThread) {
parent = do_QueryInterface(aTarget->GetParentObject());
nsCOMPtr<nsIGlobalObject> parent = do_QueryInterface(aTarget->GetParentObject());
// For some workers without window, parent is null and we try to find it
// from the JS Context.
if (!parent) {
JS::Rooted<JSObject*> globalObject(aCx, JS::CurrentGlobalOrNull(aCx));
if (NS_WARN_IF(!globalObject)) {
return false;
}
parent = xpc::NativeGlobal(globalObject);
if (NS_WARN_IF(!parent)) {
return false;
}
}
MOZ_ASSERT(parent);
JS::Rooted<JS::Value> messageData(aCx);
ErrorResult rv;
@ -6376,7 +6389,7 @@ WorkerPrivate::ConnectMessagePort(JSContext* aCx,
// This MessagePortIdentifier is used to create a new port, still connected
// with the other one, but in the worker thread.
ErrorResult rv;
RefPtr<MessagePort> port = MessagePort::Create(nullptr, aIdentifier, rv);
RefPtr<MessagePort> port = MessagePort::Create(globalScope, aIdentifier, rv);
if (NS_WARN_IF(rv.Failed())) {
return false;
}

View File

@ -633,16 +633,6 @@ ServiceWorkerGlobalScope::SkipWaiting(ErrorResult& aRv)
return promise.forget();
}
// static
bool
ServiceWorkerGlobalScope::InterceptionEnabled(JSContext* aCx, JSObject* aObj)
{
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(worker);
worker->AssertIsOnWorkerThread();
return worker->InterceptionEnabled();
}
bool
ServiceWorkerGlobalScope::OpenWindowEnabled(JSContext* aCx, JSObject* aObj)
{

View File

@ -239,9 +239,6 @@ public:
WrapGlobalObject(JSContext* aCx,
JS::MutableHandle<JSObject*> aReflector) override;
static bool
InterceptionEnabled(JSContext* aCx, JSObject* aObj);
static bool
OpenWindowEnabled(JSContext* aCx, JSObject* aObj);

View File

@ -28,6 +28,7 @@
#include "nsVariant.h"
#include "RuntimeService.h"
#include "WorkerScope.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "XMLHttpRequestUpload.h"
@ -1355,7 +1356,12 @@ EventRunnable::WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
ErrorResult rv;
JS::Rooted<JS::Value> response(aCx);
Read(nullptr, aCx, &response, rv);
GlobalObject globalObj(aCx, aWorkerPrivate->GlobalScope()->GetWrapper());
nsCOMPtr<nsIGlobalObject> global =
do_QueryInterface(globalObj.GetAsSupports());
Read(global, aCx, &response, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return false;
@ -1532,8 +1538,18 @@ SendRunnable::MainThreadRun()
ErrorResult rv;
JS::Rooted<JSObject*> globalObject(cx, JS::CurrentGlobalOrNull(cx));
if (NS_WARN_IF(!globalObject)) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIGlobalObject> parent = xpc::NativeGlobal(globalObject);
if (NS_WARN_IF(!parent)) {
return NS_ERROR_FAILURE;
}
JS::Rooted<JS::Value> body(cx);
Read(nullptr, cx, &body, rv);
Read(parent, cx, &body, rv);
if (NS_WARN_IF(rv.Failed())) {
return rv.StealNSResult();
}

View File

@ -45,8 +45,7 @@ function test() {
SpecialPowers.pushPrefEnv({'set': [['dom.serviceWorkers.enabled', true],
['dom.serviceWorkers.exemptFromPerDomainMax', true],
['dom.serviceWorkers.testing.enabled', true],
['dom.serviceWorkers.interception.enabled', true]]},
['dom.serviceWorkers.testing.enabled', true]]},
function() {
var url = gTestRoot + 'download/window.html';
var tab = gBrowser.addTab();

View File

@ -29,7 +29,6 @@ function test() {
SpecialPowers.pushPrefEnv({'set': [['dom.serviceWorkers.enabled', true],
['dom.serviceWorkers.exemptFromPerDomainMax', true],
['dom.serviceWorkers.testing.enabled', true],
['dom.serviceWorkers.interception.enabled', true],
['dom.caches.enabled', true],
['browser.cache.disk.enable', false],
['browser.cache.memory.enable', false]]},

View File

@ -1,4 +0,0 @@
// Only succeeds if onfetch is available.
if (!("onfetch" in self)) {
throw new Error("Not capable of interception");
}

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