зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to fx-team. a=merge
This commit is contained in:
Коммит
a249083da4
|
@ -65,7 +65,6 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsWhitespaceTokenizer.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsIDOMCharacterData.h"
|
||||
|
|
|
@ -1762,11 +1762,12 @@ HyperTextAccessible::RelationByType(RelationType aType)
|
|||
|
||||
switch (aType) {
|
||||
case RelationType::NODE_CHILD_OF:
|
||||
if (mContent->IsMathMLElement()) {
|
||||
if (HasOwnContent() && mContent->IsMathMLElement()) {
|
||||
Accessible* parent = Parent();
|
||||
if (parent) {
|
||||
nsIContent* parentContent = parent->GetContent();
|
||||
if (parentContent->IsMathMLElement(nsGkAtoms::mroot_)) {
|
||||
if (parentContent &&
|
||||
parentContent->IsMathMLElement(nsGkAtoms::mroot_)) {
|
||||
// Add a relation pointing to the parent <mroot>.
|
||||
rel.AppendTarget(parent);
|
||||
}
|
||||
|
@ -1774,7 +1775,7 @@ HyperTextAccessible::RelationByType(RelationType aType)
|
|||
}
|
||||
break;
|
||||
case RelationType::NODE_PARENT_OF:
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::mroot_)) {
|
||||
if (HasOwnContent() && mContent->IsMathMLElement(nsGkAtoms::mroot_)) {
|
||||
Accessible* base = GetChildAt(0);
|
||||
Accessible* index = GetChildAt(1);
|
||||
if (base && index) {
|
||||
|
|
|
@ -300,7 +300,8 @@ let OutputGenerator = {
|
|||
'definitionlist': INCLUDE_DESC | INCLUDE_NAME,
|
||||
'dialog': INCLUDE_DESC | INCLUDE_NAME,
|
||||
'chrome window': IGNORE_EXPLICIT_NAME,
|
||||
'app root': IGNORE_EXPLICIT_NAME },
|
||||
'app root': IGNORE_EXPLICIT_NAME,
|
||||
'statusbar': NAME_FROM_SUBTREE_RULE },
|
||||
|
||||
objectOutputFunctions: {
|
||||
_generateBaseOutput:
|
||||
|
|
|
@ -659,7 +659,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
|||
<option value="null" selected>Never</option>
|
||||
</select>
|
||||
<div id="statusbar-1" role="status">Last sync:<span>2 days ago</span></div>
|
||||
<div aria-label="Last sync: 30min ago" id="statusbar-2" role="status"></div>
|
||||
<div aria-label="Last sync: 30min ago" id="statusbar-2" role="status">I should be ignored</div>
|
||||
<span id="switch-1" role="switch" aria-label="Simple switch" aria-checked="true"></span>
|
||||
<span id="switch-2" role="switch" aria-label="Another switch" aria-checked="false"></span>
|
||||
</div>
|
||||
|
|
|
@ -360,10 +360,10 @@ pref("layout.css.touch_action.enabled", false);
|
|||
|
||||
#ifdef MOZ_SAFE_BROWSING
|
||||
// Safe browsing does nothing unless this pref is set
|
||||
pref("browser.safebrowsing.enabled", true);
|
||||
pref("browser.safebrowsing.enabled", false);
|
||||
|
||||
// Prevent loading of pages identified as malware
|
||||
pref("browser.safebrowsing.malware.enabled", true);
|
||||
pref("browser.safebrowsing.malware.enabled", false);
|
||||
|
||||
pref("browser.safebrowsing.debug", false);
|
||||
pref("browser.safebrowsing.updateURL", "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2&key=%GOOGLE_API_KEY%");
|
||||
|
|
|
@ -61,11 +61,11 @@ let developerHUD = {
|
|||
* observed metrics with `target.register(metric)`, and keep them up-to-date
|
||||
* with `target.update(metric, message)` when necessary.
|
||||
*/
|
||||
registerWatcher: function dwp_registerWatcher(watcher) {
|
||||
registerWatcher(watcher) {
|
||||
this._watchers.unshift(watcher);
|
||||
},
|
||||
|
||||
init: function dwp_init() {
|
||||
init() {
|
||||
if (this._client) {
|
||||
return;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ let developerHUD = {
|
|||
});
|
||||
},
|
||||
|
||||
uninit: function dwp_uninit() {
|
||||
uninit() {
|
||||
if (!this._client) {
|
||||
return;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ let developerHUD = {
|
|||
* This method will ask all registered watchers to track and update metrics
|
||||
* on an app frame.
|
||||
*/
|
||||
trackFrame: function dwp_trackFrame(frame) {
|
||||
trackFrame(frame) {
|
||||
if (this._targets.has(frame)) {
|
||||
return;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ let developerHUD = {
|
|||
});
|
||||
},
|
||||
|
||||
untrackFrame: function dwp_untrackFrame(frame) {
|
||||
untrackFrame(frame) {
|
||||
let target = this._targets.get(frame);
|
||||
if (target) {
|
||||
for (let w of this._watchers) {
|
||||
|
@ -152,7 +152,7 @@ let developerHUD = {
|
|||
}
|
||||
},
|
||||
|
||||
onFrameCreated: function (frame, isFirstAppFrame) {
|
||||
onFrameCreated(frame, isFirstAppFrame) {
|
||||
let mozapp = frame.getAttribute('mozapp');
|
||||
if (!mozapp) {
|
||||
return;
|
||||
|
@ -160,7 +160,7 @@ let developerHUD = {
|
|||
this.trackFrame(frame);
|
||||
},
|
||||
|
||||
onFrameDestroyed: function (frame, isLastAppFrame) {
|
||||
onFrameDestroyed(frame, isLastAppFrame) {
|
||||
let mozapp = frame.getAttribute('mozapp');
|
||||
if (!mozapp) {
|
||||
return;
|
||||
|
@ -168,7 +168,7 @@ let developerHUD = {
|
|||
this.untrackFrame(frame);
|
||||
},
|
||||
|
||||
log: function dwp_log(message) {
|
||||
log(message) {
|
||||
if (this._logging) {
|
||||
dump(DEVELOPER_HUD_LOG_PREFIX + ': ' + message + '\n');
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ Target.prototype = {
|
|||
/**
|
||||
* Register a metric that can later be updated. Does not update the front-end.
|
||||
*/
|
||||
register: function target_register(metric) {
|
||||
register(metric) {
|
||||
this.metrics.set(metric, 0);
|
||||
},
|
||||
|
||||
|
@ -212,7 +212,7 @@ Target.prototype = {
|
|||
* Modify one of a target's metrics, and send out an event to notify relevant
|
||||
* parties (e.g. the developer HUD, automated tests, etc).
|
||||
*/
|
||||
update: function target_update(metric, message) {
|
||||
update(metric, message) {
|
||||
if (!metric.name) {
|
||||
throw new Error('Missing metric.name');
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ Target.prototype = {
|
|||
* Nicer way to call update() when the metric value is a number that needs
|
||||
* to be incremented.
|
||||
*/
|
||||
bump: function target_bump(metric, message) {
|
||||
bump(metric, message) {
|
||||
metric.value = (this.metrics.get(metric.name) || 0) + 1;
|
||||
this.update(metric, message);
|
||||
},
|
||||
|
@ -260,7 +260,7 @@ Target.prototype = {
|
|||
* Void a metric value and make sure it isn't displayed on the front-end
|
||||
* anymore.
|
||||
*/
|
||||
clear: function target_clear(metric) {
|
||||
clear(metric) {
|
||||
metric.value = 0;
|
||||
this.update(metric);
|
||||
},
|
||||
|
@ -269,19 +269,19 @@ Target.prototype = {
|
|||
* Tear everything down, including the front-end by sending a message without
|
||||
* widgets.
|
||||
*/
|
||||
destroy: function target_destroy() {
|
||||
destroy() {
|
||||
delete this.metrics;
|
||||
this._send({});
|
||||
},
|
||||
|
||||
_send: function target_send(data) {
|
||||
_send(data) {
|
||||
let frame = this.frame;
|
||||
|
||||
shell.sendEvent(frame, 'developer-hud-update', Cu.cloneInto(data, frame));
|
||||
this._sendTelemetryEvent(data.metric);
|
||||
},
|
||||
|
||||
_sendTelemetryEvent: function target_sendTelemetryEvent(metric) {
|
||||
_sendTelemetryEvent(metric) {
|
||||
if (!developerHUD._telemetry || !metric || metric.skipTelemetry) {
|
||||
return;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ let consoleWatcher = {
|
|||
'CORS'
|
||||
],
|
||||
|
||||
init: function cw_init(client) {
|
||||
init(client) {
|
||||
this._client = client;
|
||||
this.consoleListener = this.consoleListener.bind(this);
|
||||
|
||||
|
@ -359,7 +359,7 @@ let consoleWatcher = {
|
|||
client.addListener('reflowActivity', this.consoleListener);
|
||||
},
|
||||
|
||||
trackTarget: function cw_trackTarget(target) {
|
||||
trackTarget(target) {
|
||||
target.register('reflows');
|
||||
target.register('warnings');
|
||||
target.register('errors');
|
||||
|
@ -374,7 +374,7 @@ let consoleWatcher = {
|
|||
});
|
||||
},
|
||||
|
||||
untrackTarget: function cw_untrackTarget(target) {
|
||||
untrackTarget(target) {
|
||||
this._client.request({
|
||||
to: target.actor.consoleActor,
|
||||
type: 'stopListeners',
|
||||
|
@ -384,7 +384,7 @@ let consoleWatcher = {
|
|||
this._targets.delete(target.actor.consoleActor);
|
||||
},
|
||||
|
||||
consoleListener: function cw_consoleListener(type, packet) {
|
||||
consoleListener(type, packet) {
|
||||
let target = this._targets.get(packet.from);
|
||||
let metric = {};
|
||||
let output = '';
|
||||
|
@ -477,7 +477,7 @@ let consoleWatcher = {
|
|||
target.bump(metric, output);
|
||||
},
|
||||
|
||||
formatSourceURL: function cw_formatSourceURL(packet) {
|
||||
formatSourceURL(packet) {
|
||||
// Abbreviate source URL
|
||||
let source = WebConsoleUtils.abbreviateSourceURL(packet.sourceURL);
|
||||
|
||||
|
@ -489,9 +489,7 @@ let consoleWatcher = {
|
|||
return source;
|
||||
},
|
||||
|
||||
handleTelemetryMessage:
|
||||
function cw_handleTelemetryMessage(target, packet) {
|
||||
|
||||
handleTelemetryMessage(target, packet) {
|
||||
if (!developerHUD._telemetry) {
|
||||
return;
|
||||
}
|
||||
|
@ -540,13 +538,13 @@ let eventLoopLagWatcher = {
|
|||
_fronts: new Map(),
|
||||
_active: false,
|
||||
|
||||
init: function(client) {
|
||||
init(client) {
|
||||
this._client = client;
|
||||
|
||||
SettingsListener.observe('hud.jank', false, this.settingsListener.bind(this));
|
||||
},
|
||||
|
||||
settingsListener: function(value) {
|
||||
settingsListener(value) {
|
||||
if (this._active == value) {
|
||||
return;
|
||||
}
|
||||
|
@ -565,7 +563,7 @@ let eventLoopLagWatcher = {
|
|||
}
|
||||
},
|
||||
|
||||
trackTarget: function(target) {
|
||||
trackTarget(target) {
|
||||
target.register('jank');
|
||||
|
||||
let front = new EventLoopLagFront(this._client, target.actor);
|
||||
|
@ -580,7 +578,7 @@ let eventLoopLagWatcher = {
|
|||
}
|
||||
},
|
||||
|
||||
untrackTarget: function(target) {
|
||||
untrackTarget(target) {
|
||||
let fronts = this._fronts;
|
||||
if (fronts.has(target)) {
|
||||
fronts.get(target).destroy();
|
||||
|
@ -611,7 +609,7 @@ let memoryWatcher = {
|
|||
},
|
||||
_active: false,
|
||||
|
||||
init: function mw_init(client) {
|
||||
init(client) {
|
||||
this._client = client;
|
||||
let watching = this._watching;
|
||||
|
||||
|
@ -624,7 +622,7 @@ let memoryWatcher = {
|
|||
}
|
||||
},
|
||||
|
||||
update: function mw_update() {
|
||||
update() {
|
||||
let watching = this._watching;
|
||||
let active = watching.appmemory || watching.uss;
|
||||
|
||||
|
@ -642,7 +640,7 @@ let memoryWatcher = {
|
|||
this._active = active;
|
||||
},
|
||||
|
||||
measure: function mw_measure(target) {
|
||||
measure(target) {
|
||||
let watch = this._watching;
|
||||
let front = this._fronts.get(target);
|
||||
let format = this.formatMemory;
|
||||
|
@ -685,11 +683,11 @@ let memoryWatcher = {
|
|||
});
|
||||
}
|
||||
|
||||
let timer = setTimeout(() => this.measure(target), 800);
|
||||
let timer = setTimeout(() => this.measure(target), 2000);
|
||||
this._timers.set(target, timer);
|
||||
},
|
||||
|
||||
formatMemory: function mw_formatMemory(bytes) {
|
||||
formatMemory(bytes) {
|
||||
var prefix = ['','K','M','G','T','P','E','Z','Y'];
|
||||
var i = 0;
|
||||
for (; bytes > 1024 && i < prefix.length; ++i) {
|
||||
|
@ -698,7 +696,7 @@ let memoryWatcher = {
|
|||
return (Math.round(bytes * 100) / 100) + ' ' + prefix[i] + 'B';
|
||||
},
|
||||
|
||||
trackTarget: function mw_trackTarget(target) {
|
||||
trackTarget(target) {
|
||||
target.register('uss');
|
||||
target.register('memory');
|
||||
this._fronts.set(target, MemoryFront(this._client, target.actor));
|
||||
|
@ -707,7 +705,7 @@ let memoryWatcher = {
|
|||
}
|
||||
},
|
||||
|
||||
untrackTarget: function mw_untrackTarget(target) {
|
||||
untrackTarget(target) {
|
||||
let front = this._fronts.get(target);
|
||||
if (front) {
|
||||
front.destroy();
|
||||
|
|
|
@ -148,12 +148,16 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
|
|||
// Get the hardware info and firmware revision from device properties.
|
||||
let hardware_info = null;
|
||||
let firmware_revision = null;
|
||||
let product_manufacturer = null;
|
||||
let product_model = null;
|
||||
let product_device = null;
|
||||
let build_number = null;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
hardware_info = libcutils.property_get('ro.hardware');
|
||||
firmware_revision = libcutils.property_get('ro.firmware_revision');
|
||||
product_manufacturer = libcutils.property_get('ro.product.manufacturer');
|
||||
product_model = libcutils.property_get('ro.product.model');
|
||||
product_device = libcutils.property_get('ro.product.device');
|
||||
build_number = libcutils.property_get('ro.build.version.incremental');
|
||||
#endif
|
||||
|
||||
|
@ -173,7 +177,9 @@ Components.utils.import('resource://gre/modules/ctypes.jsm');
|
|||
'deviceinfo.platform_build_id': appInfo.platformBuildID,
|
||||
'deviceinfo.hardware': hardware_info,
|
||||
'deviceinfo.firmware_revision': firmware_revision,
|
||||
'deviceinfo.product_model': product_model
|
||||
'deviceinfo.product_manufacturer': product_manufacturer,
|
||||
'deviceinfo.product_model': product_model,
|
||||
'deviceinfo.product_device': product_device
|
||||
}
|
||||
lock.set(setting);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<project name="platform/external/webrtc" path="external/webrtc" revision="446452f84e9cc4c75d8e80f6f05e24793397a19d"/>
|
||||
<project name="platform/external/yaffs2" path="external/yaffs2" revision="a2cff2275e1b501ff478b03757d6e4f05fddc2db"/>
|
||||
<project name="platform/external/zlib" path="external/zlib" revision="a5c7131da47c991585a6c6ac0c063b6d7d56e3fc"/>
|
||||
<project name="platform/frameworks/base" path="frameworks/base" revision="2d12cb68a6c680e1ef50c6fbd19f782f67aec9de"/>
|
||||
<project name="platform/frameworks/base" path="frameworks/base" revision="d9d67d72dab332472d19aff19985d41d1c883763"/>
|
||||
<project name="platform/frameworks/native" path="frameworks/native" revision="8d54940d9bdad8fec3208ff58ddab590be9fe0d4"/>
|
||||
<project name="platform/frameworks/opt/emoji" path="frameworks/opt/emoji" revision="dbbe673145107e99883f62bafd70c5f43f11065c"/>
|
||||
<project name="platform/frameworks/wilhelm" path="frameworks/wilhelm" revision="aac6c4bb59a6577c97cbda68699829b507b7490d"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "e6506d68e01489b57616f8b74e8773f938ce62b3",
|
||||
"git_revision": "86af137c7f4c41c1185e609339002ab47fd6c640",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "b126eb6c8cb42a881f56ed9ed9c81306858a388b",
|
||||
"revision": "e700d1e96a1185d51c9f5782e442dc0610a10d95",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="e6506d68e01489b57616f8b74e8773f938ce62b3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="86af137c7f4c41c1185e609339002ab47fd6c640"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="47f48a42502b1c694db2b162011a67a2ff888c5d"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -14,12 +14,10 @@
|
|||
#include <fcntl.h>
|
||||
#elif defined(XP_UNIX)
|
||||
#include <sys/resource.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include <mach/mach_time.h>
|
||||
#include "MacQuirks.h"
|
||||
#endif
|
||||
|
||||
|
@ -214,83 +212,6 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
|
|||
return XRE_main(argc, argv, &appData, mainFlags);
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
||||
/**
|
||||
* Used only when GetTickCount64 is not available on the platform.
|
||||
* Last result of GetTickCount call. Kept in [ms].
|
||||
*/
|
||||
static DWORD sLastGTCResult = 0;
|
||||
|
||||
/**
|
||||
* Higher part of the 64-bit value of MozGetTickCount64,
|
||||
* incremented atomically.
|
||||
*/
|
||||
static DWORD sLastGTCRollover = 0;
|
||||
|
||||
/**
|
||||
* Function protecting GetTickCount result from rolling over. The original
|
||||
* code comes from the Windows implementation of the TimeStamp class minus the
|
||||
* locking harness which isn't needed here.
|
||||
*
|
||||
* @returns The current time in milliseconds
|
||||
*/
|
||||
static ULONGLONG WINAPI
|
||||
MozGetTickCount64()
|
||||
{
|
||||
DWORD GTC = ::GetTickCount();
|
||||
|
||||
/* Pull the rollover counter forward only if new value of GTC goes way
|
||||
* down under the last saved result */
|
||||
if ((sLastGTCResult > GTC) && ((sLastGTCResult - GTC) > (1UL << 30)))
|
||||
++sLastGTCRollover;
|
||||
|
||||
sLastGTCResult = GTC;
|
||||
return (ULONGLONG)sLastGTCRollover << 32 | sLastGTCResult;
|
||||
}
|
||||
|
||||
typedef ULONGLONG (WINAPI* GetTickCount64_t)();
|
||||
static GetTickCount64_t sGetTickCount64 = nullptr;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Local TimeStamp::Now()-compatible implementation used to record timestamps
|
||||
* which will be passed to XRE_StartupTimelineRecord().
|
||||
*/
|
||||
static uint64_t
|
||||
TimeStamp_Now()
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
LARGE_INTEGER freq;
|
||||
::QueryPerformanceFrequency(&freq);
|
||||
|
||||
HMODULE kernelDLL = GetModuleHandleW(L"kernel32.dll");
|
||||
sGetTickCount64 = reinterpret_cast<GetTickCount64_t>
|
||||
(GetProcAddress(kernelDLL, "GetTickCount64"));
|
||||
|
||||
if (!sGetTickCount64) {
|
||||
/* If the platform does not support the GetTickCount64 (Windows XP doesn't),
|
||||
* then use our fallback implementation based on GetTickCount. */
|
||||
sGetTickCount64 = MozGetTickCount64;
|
||||
}
|
||||
|
||||
return sGetTickCount64() * freq.QuadPart;
|
||||
#elif defined(XP_MACOSX)
|
||||
return mach_absolute_time();
|
||||
#elif defined(HAVE_CLOCK_MONOTONIC)
|
||||
struct timespec ts;
|
||||
int rv = clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
|
||||
if (rv != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t baseNs = (uint64_t)ts.tv_sec * 1000000000;
|
||||
return baseNs + (uint64_t)ts.tv_nsec;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
FileExists(const char *path)
|
||||
{
|
||||
|
@ -411,7 +332,7 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
uint64_t start = TimeStamp_Now();
|
||||
mozilla::TimeStamp start = mozilla::TimeStamp::Now();
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
TriggerQuirks();
|
||||
|
|
|
@ -150,12 +150,12 @@ let handleContentContextMenu = function (event) {
|
|||
|
||||
let customMenuItems = PageMenuChild.build(event.target);
|
||||
let principal = doc.nodePrincipal;
|
||||
sendSyncMessage("contextmenu",
|
||||
{ editFlags, spellInfo, customMenuItems, addonInfo,
|
||||
principal, docLocation, charSet, baseURI, referrer,
|
||||
referrerPolicy, contentType, contentDisposition,
|
||||
frameOuterWindowID, selectionInfo, disableSetDesktopBg },
|
||||
{ event, popupNode: event.target });
|
||||
sendRpcMessage("contextmenu",
|
||||
{ editFlags, spellInfo, customMenuItems, addonInfo,
|
||||
principal, docLocation, charSet, baseURI, referrer,
|
||||
referrerPolicy, contentType, contentDisposition,
|
||||
frameOuterWindowID, selectionInfo, disableSetDesktopBg },
|
||||
{ event, popupNode: event.target });
|
||||
}
|
||||
else {
|
||||
// Break out to the parent window and pass the add-on info along
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
#include "AboutRedirector.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsDOMString.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "prtime.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#include "nsIStringBundle.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIProcess.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "imgIRequest.h"
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
#include "nsIURL.h"
|
||||
#include "nsIWebBrowserPersist.h"
|
||||
#include "nsMacShellService.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIProperties.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsShellService.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsShellService.h"
|
||||
#include "nsWindowsShellService.h"
|
||||
#include "nsIProcess.h"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
. "$topsrcdir/browser/config/mozconfigs/common"
|
||||
. "$topsrcdir/build/macosx/mozconfig.common"
|
||||
|
||||
ac_add_options --with-l10n-base=../../../l10n
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
|
|
|
@ -308,6 +308,6 @@ def dumpScreen(utilityPath):
|
|||
returncode = subprocess.call(utility + [imgfilename])
|
||||
printstatus(returncode, utilityname)
|
||||
except OSError, err:
|
||||
log.info("Failed to start %s for screenshot: %s" %
|
||||
utility[0], err.strerror)
|
||||
log.info("Failed to start %s for screenshot: %s"
|
||||
% (utility[0], err.strerror))
|
||||
return
|
||||
|
|
|
@ -29,6 +29,14 @@ typedef ASTConsumer *ASTConsumerPtr;
|
|||
|
||||
namespace {
|
||||
|
||||
QualType GetCallReturnType(const CallExpr *expr) {
|
||||
#if CLANG_VERSION_FULL >= 307
|
||||
return expr->getCallReturnType(expr->getCalleeDecl()->getASTContext());
|
||||
#else
|
||||
return expr->getCallReturnType();
|
||||
#endif
|
||||
}
|
||||
|
||||
using namespace clang::ast_matchers;
|
||||
class DiagnosticsMatcher {
|
||||
public:
|
||||
|
@ -784,7 +792,7 @@ void DiagnosticsMatcher::ScopeChecker::run(
|
|||
noteInferred(expr->getAllocatedType(), Diag);
|
||||
} else if (const CallExpr *expr =
|
||||
Result.Nodes.getNodeAs<CallExpr>("node")) {
|
||||
QualType badType = expr->getCallReturnType()->getPointeeType();
|
||||
QualType badType = GetCallReturnType(expr)->getPointeeType();
|
||||
Diag.Report(expr->getLocStart(), errorID) << badType;
|
||||
noteInferred(badType, Diag);
|
||||
}
|
||||
|
@ -837,7 +845,7 @@ void DiagnosticsMatcher::NonHeapClassChecker::run(
|
|||
Diag.Report(expr->getStartLoc(), stackID) << expr->getAllocatedType();
|
||||
noteInferred(expr->getAllocatedType(), Diag);
|
||||
} else if (const CallExpr *expr = Result.Nodes.getNodeAs<CallExpr>("node")) {
|
||||
QualType badType = expr->getCallReturnType()->getPointeeType();
|
||||
QualType badType = GetCallReturnType(expr)->getPointeeType();
|
||||
Diag.Report(expr->getLocStart(), stackID) << badType;
|
||||
noteInferred(badType, Diag);
|
||||
}
|
||||
|
@ -984,12 +992,13 @@ class MozCheckAction : public PluginASTAction {
|
|||
public:
|
||||
ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, StringRef fileName) override {
|
||||
#if CLANG_VERSION_FULL >= 306
|
||||
std::unique_ptr<MozChecker> checker(make_unique<MozChecker>(CI));
|
||||
std::unique_ptr<MozChecker> checker(llvm::make_unique<MozChecker>(CI));
|
||||
ASTConsumerPtr other(checker->getOtherConsumer());
|
||||
|
||||
std::vector<std::unique_ptr<ASTConsumer>> consumers;
|
||||
std::vector<ASTConsumerPtr> consumers;
|
||||
consumers.push_back(std::move(checker));
|
||||
consumers.push_back(checker->getOtherConsumer());
|
||||
return make_unique<MultiplexConsumer>(std::move(consumers));
|
||||
consumers.push_back(std::move(other));
|
||||
return llvm::make_unique<MultiplexConsumer>(std::move(consumers));
|
||||
#else
|
||||
MozChecker *checker = new MozChecker(CI);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "nsPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsNullPrincipal.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "nsNullPrincipal.h"
|
||||
#include "nsNullPrincipalURI.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsError.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "mozilla/ipc/URIParams.h"
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "pratom.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsJSPrincipals.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIStandardURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStandardURL.h"
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ CERT_CacheOCSPResponseFromSideChannel
|
|||
CERT_CertChainFromCert
|
||||
CERT_CertificateRequestTemplate DATA
|
||||
CERT_CertificateTemplate DATA
|
||||
CERT_CertListFromCert
|
||||
CERT_ChangeCertTrust
|
||||
CERT_CheckCertUsage
|
||||
CERT_CheckCertValidTimes
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "SerializedLoadContext.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIPrivateBrowsingChannel.h"
|
||||
#include "nsIWebSocketChannel.h"
|
||||
|
||||
namespace IPC {
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
* 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 "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsIFile.h"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/dom/workers/ServiceWorkerManager.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
|
@ -38,6 +39,7 @@
|
|||
#include "nsCURILoader.h"
|
||||
#include "nsDocShellCID.h"
|
||||
#include "nsDOMCID.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
#include "nsRect.h"
|
||||
|
@ -182,13 +184,18 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIIDNService.h"
|
||||
#include "nsIInputStreamChannel.h"
|
||||
#include "nsINestedURI.h"
|
||||
#include "nsISHContainer.h"
|
||||
#include "nsISHistory.h"
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsISocketProvider.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIURIFixup.h"
|
||||
#include "nsIURILoader.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWebBrowserFind.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
|
|
@ -34,7 +34,7 @@ function debug(aMsg) {
|
|||
}
|
||||
|
||||
const DB_NAME = "activities";
|
||||
const DB_VERSION = 1;
|
||||
const DB_VERSION = 2;
|
||||
const STORE_NAME = "activities";
|
||||
|
||||
function ActivitiesDb() {
|
||||
|
@ -63,6 +63,25 @@ ActivitiesDb.prototype = {
|
|||
*/
|
||||
upgradeSchema: function actdb_upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) {
|
||||
debug("Upgrade schema " + aOldVersion + " -> " + aNewVersion);
|
||||
|
||||
let self = this;
|
||||
|
||||
function upgrade(currentVersion) {
|
||||
let next = upgrade.bind(self, currentVersion + 1);
|
||||
switch (currentVersion) {
|
||||
case 0:
|
||||
self.createSchema(aDb, next);
|
||||
break;
|
||||
case 1:
|
||||
self.upgradeSchemaVersion2(aDb, aTransaction, next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
upgrade(aOldVersion);
|
||||
},
|
||||
|
||||
createSchema: function(aDb, aNext) {
|
||||
let objectStore = aDb.createObjectStore(STORE_NAME, { keyPath: "id" });
|
||||
|
||||
// indexes
|
||||
|
@ -70,6 +89,49 @@ ActivitiesDb.prototype = {
|
|||
objectStore.createIndex("manifest", "manifest", { unique: false });
|
||||
|
||||
debug("Created object stores and indexes");
|
||||
|
||||
aNext();
|
||||
},
|
||||
|
||||
upgradeSchemaVersion2: function(aDb, aTransaction, aNext) {
|
||||
debug("Upgrading DB to version 2");
|
||||
|
||||
// In order to be able to have multiple activities with same name
|
||||
// but different descriptions, we need to update the keypath from
|
||||
// a hash made from {manifest, name} to a hash made from {manifest,
|
||||
// name, description}.
|
||||
//
|
||||
// Unfortunately, updating the keypath is not allowed by IDB, so we
|
||||
// need to remove and recreate the activities object store.
|
||||
|
||||
let activities = [];
|
||||
let objectStore = aTransaction.objectStore(STORE_NAME);
|
||||
objectStore.openCursor().onsuccess = (event) => {
|
||||
let cursor = event.target.result;
|
||||
if (!cursor) {
|
||||
aDb.deleteObjectStore(STORE_NAME);
|
||||
|
||||
let objectStore = aDb.createObjectStore(STORE_NAME, { keyPath: "id" });
|
||||
|
||||
// indexes
|
||||
objectStore.createIndex("name", "name", { unique: false });
|
||||
objectStore.createIndex("manifest", "manifest", { unique: false });
|
||||
|
||||
this.add(activities, () => {
|
||||
debug("DB upgraded to version 2");
|
||||
aNext();
|
||||
}, () => {
|
||||
dump("Error upgrading DB to version 2 " + error + "\n");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let activity = cursor.value;
|
||||
debug("Upgrading activity " + JSON.stringify(activity));
|
||||
activity.id = this.createId(activity);
|
||||
activities.push(activity);
|
||||
cursor.continue();
|
||||
};
|
||||
},
|
||||
|
||||
// unique ids made of (uri, action)
|
||||
|
@ -83,8 +145,17 @@ ActivitiesDb.prototype = {
|
|||
hasher.init(hasher.SHA1);
|
||||
|
||||
// add uri and action to the hash
|
||||
["manifest", "name"].forEach(function(aProp) {
|
||||
let data = converter.convertToByteArray(aObject[aProp], {});
|
||||
["manifest", "name", "description"].forEach(function(aProp) {
|
||||
if (!aObject[aProp]) {
|
||||
return;
|
||||
}
|
||||
|
||||
let property = aObject[aProp];
|
||||
if (aProp == "description") {
|
||||
property = JSON.stringify(aObject[aProp]);
|
||||
}
|
||||
|
||||
let data = converter.convertToByteArray(property, {});
|
||||
hasher.update(data, data.length);
|
||||
});
|
||||
|
||||
|
@ -110,16 +181,17 @@ ActivitiesDb.prototype = {
|
|||
|
||||
// Remove all the activities carried in the |aObjects| array.
|
||||
remove: function actdb_remove(aObjects) {
|
||||
this.newTxn("readwrite", STORE_NAME, function (txn, store) {
|
||||
aObjects.forEach(function (aObject) {
|
||||
this.newTxn("readwrite", STORE_NAME, (txn, store) => {
|
||||
aObjects.forEach((aObject) => {
|
||||
let object = {
|
||||
manifest: aObject.manifest,
|
||||
name: aObject.name
|
||||
name: aObject.name,
|
||||
description: aObject.description
|
||||
};
|
||||
debug("Going to remove " + JSON.stringify(object));
|
||||
store.delete(this.createId(object));
|
||||
}, this);
|
||||
}.bind(this), function() {}, function() {});
|
||||
});
|
||||
}, function() {}, function() {});
|
||||
},
|
||||
|
||||
// Remove all activities associated with the given |aManifest| URL.
|
||||
|
@ -247,8 +319,8 @@ let Activities = {
|
|||
debug("Activity choice: " + aResult);
|
||||
|
||||
// We have no matching activity registered, let's fire an error.
|
||||
// Don't do this check until we have passed to UIGlue so the glue can choose to launch
|
||||
// its own activity if needed.
|
||||
// Don't do this check until we have passed to UIGlue so the glue
|
||||
// can choose to launch its own activity if needed.
|
||||
if (aResults.options.length === 0) {
|
||||
self.trySendAndCleanup(aMsg.id, "Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
const ACTIVITY_GLUE_CID = Components.ID("{f4cfbe10-a106-4cd1-b04e-0d2a6aac138b}");
|
||||
const SYS_MSG_GLUE_CID = Components.ID("{b0b6b9af-bc4e-4200-bffe-fb7691065ec9}");
|
||||
|
||||
const gRootUrl = "http://test/chrome/dom/activities/tests/mochi/";
|
||||
|
||||
function registerComponent(aObject, aDescription, aContract, aCid) {
|
||||
info("Registering " + aCid);
|
||||
|
||||
var componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.registerFactory(aCid, aDescription, aContract, aObject);
|
||||
|
||||
// Keep the id on the object so we can unregister later.
|
||||
aObject.cid = aCid;
|
||||
}
|
||||
|
||||
function unregisterComponent(aObject) {
|
||||
info("Unregistering " + aObject.cid);
|
||||
var componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.unregisterFactory(aObject.cid, aObject);
|
||||
}
|
||||
|
||||
function cbError(aEvent) {
|
||||
ok(false, "Error callback invoked " +
|
||||
aEvent.target.error.name + " " + aEvent.target.error.message);
|
||||
finish();
|
||||
}
|
||||
|
||||
function unexpectedSuccess(aMsg) {
|
||||
return function() {
|
||||
ok(false, "Should not have succeeded: " + aMsg);
|
||||
finish();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,17 @@
|
|||
{
|
||||
"name": "Random app",
|
||||
"activities": {
|
||||
"import-app": { "blob": { "required": true } }
|
||||
"import-app": { "blob": { "required": true } },
|
||||
"bug1176712": [{
|
||||
"filters": {
|
||||
"type": "type1"
|
||||
},
|
||||
"href": "href1"
|
||||
}, {
|
||||
"filters": {
|
||||
"type": "type2"
|
||||
},
|
||||
"href": "href2"
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
[DEFAULT]
|
||||
skip-if = e10s
|
||||
support-files =
|
||||
common.js
|
||||
system.webapp
|
||||
system.webapp^headers^
|
||||
manifest.webapp
|
||||
manifest.webapp^headers^
|
||||
|
||||
[test_dev_mode_activity.html]
|
||||
[test_same_name_multiple_filters.html]
|
||||
|
|
|
@ -9,6 +9,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={1123846}
|
|||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome-harness.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="http://test/chrome/dom/activities/tests/mochi/common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -33,9 +35,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={1123846}
|
|||
* 4) Dev mode, system app and other app installed (success, only system app returned).
|
||||
*/
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||
|
||||
var gRootUrl = "http://test/chrome/dom/activities/tests/mochi/";
|
||||
var gGenerator = runTest();
|
||||
|
||||
function go() {
|
||||
|
@ -52,19 +51,6 @@ function go() {
|
|||
continueTest) });
|
||||
}
|
||||
|
||||
function cbError(aEvent) {
|
||||
ok(false, "Error callback invoked " +
|
||||
aEvent.target.error.name + " " + aEvent.target.error.message);
|
||||
finish();
|
||||
}
|
||||
|
||||
function unexpectedSuccess(aMsg) {
|
||||
return function() {
|
||||
ok(false, "Should not have succeeded: " + aMsg);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var systemAppUrl = gRootUrl + "system.webapp";
|
||||
|
@ -92,28 +78,6 @@ function uninstall(aApp) {
|
|||
request.onsuccess = continueTest;
|
||||
}
|
||||
|
||||
function registerComponent(aObject, aDescription, aContract) {
|
||||
var uuidGenerator = Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator);
|
||||
var cid = uuidGenerator.generateUUID();
|
||||
|
||||
info("Registering " + cid);
|
||||
|
||||
var componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.registerFactory(cid, aDescription, aContract, aObject);
|
||||
|
||||
// Keep the id on the object so we can unregister later.
|
||||
aObject.cid = cid;
|
||||
}
|
||||
|
||||
function unregisterComponent(aObject) {
|
||||
info("Unregistering " + aObject.cid);
|
||||
var componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.unregisterFactory(aObject.cid, aObject);
|
||||
}
|
||||
|
||||
var ActivityGlue = {
|
||||
// nsISupports implementation.
|
||||
QueryInterface: function(iid) {
|
||||
|
@ -157,22 +121,27 @@ var SystemMessageGlue = {
|
|||
|
||||
// nsISystemMessageGlue implementation.
|
||||
openApp(pageURL, manifestURL, type, target, showApp, onlyShowApp, extra) {
|
||||
// We should only try to open a page in the sytem app.
|
||||
// We should only try to open a page in the system app.
|
||||
is(manifestURL, systemAppUrl, "Opening a page in the system app.");
|
||||
}
|
||||
};
|
||||
|
||||
registerComponent(ActivityGlue,
|
||||
"Activity Glue",
|
||||
"@mozilla.org/dom/activities/ui-glue;1");
|
||||
"@mozilla.org/dom/activities/ui-glue;1",
|
||||
ACTIVITY_GLUE_CID);
|
||||
|
||||
registerComponent(SystemMessageGlue,
|
||||
"System Message Glue",
|
||||
"@mozilla.org/dom/messages/system-message-glue;1");
|
||||
"@mozilla.org/dom/messages/system-message-glue;1",
|
||||
SYS_MSG_GLUE_CID);
|
||||
|
||||
function finish() {
|
||||
unregisterComponent(ActivityGlue);
|
||||
unregisterComponent(SystemMessageGlue);
|
||||
obsService.removeObserver(continueTest, "new-activity-registered-success");
|
||||
obsService.removeObserver(continueTest, "new-activity-registered-failure");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,222 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id={1176712}
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug {1176712}</title>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome-harness.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="http://test/chrome/dom/activities/tests/mochi/common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id={1176712}">Mozilla Bug {1176712}</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript;version=1.7">
|
||||
|
||||
var gGenerator = runTest();
|
||||
|
||||
function go() {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "webapps-manage", "allow": 1, "context": document },
|
||||
{ "type": "browser", "allow": 1, "context": document },
|
||||
{ "type": "embed-apps", "allow": 1, "context": document }],
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{'set': [["dom.mozBrowserFramesEnabled", true],
|
||||
["dom.sysmsg.enabled", true]]},
|
||||
continueTest) });
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function installApp(aUrl) {
|
||||
var request = navigator.mozApps.install(aUrl, { });
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
return request;
|
||||
}
|
||||
|
||||
function uninstall(aApp) {
|
||||
info("Uninstalling " + (aApp ? aApp.manifestURL : "NO APP!!"));
|
||||
var request = navigator.mozApps.mgmt.uninstall(aApp);
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
}
|
||||
|
||||
var ActivityGlue = {
|
||||
// nsISupports implementation.
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIFactory) ||
|
||||
iid.equals(Ci.nsIActivityUIGlue)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
// nsIFactory implementation.
|
||||
createInstance: function(outer, iid) {
|
||||
return this.QueryInterface(iid);
|
||||
},
|
||||
|
||||
// nsIActivityUIGlue implementation.
|
||||
chooseActivity: function(aOptions, aActivities, aCallback) {
|
||||
aCallback.handleEvent(Ci.nsIActivityUIGlueCallback.WEBAPPS_ACTIVITY,
|
||||
aActivities.length == 1 ? 0 : -1);
|
||||
}
|
||||
};
|
||||
|
||||
var SystemMessageGlue = {
|
||||
// nsISupports implementation.
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIFactory) ||
|
||||
iid.equals(Ci.nsISystemMessageGlue)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
// nsIFactory implementation.
|
||||
createInstance: function(outer, iid) {
|
||||
return this.QueryInterface(iid);
|
||||
},
|
||||
|
||||
// nsISystemMessageGlue implementation.
|
||||
openApp(pageURL, manifestURL, type, target, showApp, onlyShowApp, extra) {
|
||||
}
|
||||
};
|
||||
|
||||
registerComponent(ActivityGlue,
|
||||
"Activity Glue",
|
||||
"@mozilla.org/dom/activities/ui-glue;1",
|
||||
ACTIVITY_GLUE_CID);
|
||||
|
||||
registerComponent(SystemMessageGlue,
|
||||
"System Message Glue",
|
||||
"@mozilla.org/dom/messages/system-message-glue;1",
|
||||
SYS_MSG_GLUE_CID);
|
||||
|
||||
function finish() {
|
||||
unregisterComponent(ActivityGlue);
|
||||
unregisterComponent(SystemMessageGlue);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function continueTest() {
|
||||
try {
|
||||
gGenerator.next();
|
||||
} catch (e if e instanceof StopIteration) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
SpecialPowers.setAllAppsLaunchable(true);
|
||||
|
||||
SpecialPowers.autoConfirmAppInstall(continueTest);
|
||||
yield undefined;
|
||||
|
||||
SpecialPowers.autoConfirmAppUninstall(continueTest);
|
||||
yield undefined;
|
||||
|
||||
// Check how many apps we are starting with.
|
||||
var request = navigator.mozApps.mgmt.getAll();
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
var initialAppsCount = request.result.length;
|
||||
info("Starting with " + initialAppsCount + " apps installed.");
|
||||
|
||||
// Before app installed
|
||||
|
||||
var activity = new MozActivity({
|
||||
name: "bug1176712",
|
||||
data: {
|
||||
type: "type1"
|
||||
}
|
||||
});
|
||||
activity.onsuccess = unexpectedSuccess("Shouldn't launch unregistered activity");
|
||||
activity.onerror = () => {
|
||||
ok(activity.error.name == "NO_PROVIDER", "Expected NO_PROVIDER");
|
||||
continueTest();
|
||||
};
|
||||
yield undefined;
|
||||
|
||||
var activity = new MozActivity({
|
||||
name: "bug1176712",
|
||||
data: {
|
||||
type: "type2"
|
||||
}
|
||||
});
|
||||
activity.onsuccess = unexpectedSuccess("Shouldn't launch unregistered activity");
|
||||
activity.onerror = () => {
|
||||
ok(activity.error.name == "NO_PROVIDER", "Expected NO_PROVIDER");
|
||||
continueTest();
|
||||
};
|
||||
yield undefined;
|
||||
|
||||
var request = installApp(gRootUrl + "manifest.webapp");
|
||||
yield undefined;
|
||||
var app = request.result;
|
||||
ok(app, "App installed");
|
||||
|
||||
// After app installed
|
||||
|
||||
var activity = new MozActivity({
|
||||
name: "bug1176712",
|
||||
data: {
|
||||
type: "type1"
|
||||
}
|
||||
});
|
||||
activity.onsuccess = function() {
|
||||
ok(true, "Activity launch succeed");
|
||||
continueTest();
|
||||
}
|
||||
activity.onerror = cbError;
|
||||
yield undefined;
|
||||
|
||||
var activity = new MozActivity({
|
||||
name: "bug1176712",
|
||||
data: {
|
||||
type: "type2"
|
||||
}
|
||||
});
|
||||
activity.onsuccess = function() {
|
||||
ok(true, "Activity launch succeed");
|
||||
continueTest();
|
||||
}
|
||||
activity.onerror = cbError;
|
||||
yield undefined;
|
||||
|
||||
// Cleanup
|
||||
uninstall(app);
|
||||
yield undefined;
|
||||
|
||||
// Check that we restored the app registry.
|
||||
request = navigator.mozApps.mgmt.getAll();
|
||||
request.onerror = cbError;
|
||||
request.onsuccess = continueTest;
|
||||
yield undefined;
|
||||
|
||||
is(request.result.length, initialAppsCount, "All apps are uninstalled.");
|
||||
}
|
||||
|
||||
addLoadEvent(go);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -40,11 +40,11 @@ class AnimValuesStyleRule;
|
|||
class CommonAnimationManager;
|
||||
} // namespace css
|
||||
|
||||
namespace dom {
|
||||
|
||||
class CSSAnimation;
|
||||
class CSSTransition;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Animation
|
||||
: public nsISupports
|
||||
, public nsWrapperCache
|
||||
|
@ -218,11 +218,6 @@ public:
|
|||
*/
|
||||
Nullable<TimeDuration> GetCurrentOrPendingStartTime() const;
|
||||
|
||||
const nsString& Name() const
|
||||
{
|
||||
return mEffect ? mEffect->Name() : EmptyString();
|
||||
}
|
||||
|
||||
bool IsPausedOrPausing() const
|
||||
{
|
||||
return PlayState() == AnimationPlayState::Paused ||
|
||||
|
|
|
@ -193,12 +193,10 @@ public:
|
|||
KeyframeEffectReadOnly(nsIDocument* aDocument,
|
||||
Element* aTarget,
|
||||
nsCSSPseudoElements::Type aPseudoType,
|
||||
const AnimationTiming &aTiming,
|
||||
const nsSubstring& aName)
|
||||
const AnimationTiming &aTiming)
|
||||
: AnimationEffectReadOnly(aDocument)
|
||||
, mTarget(aTarget)
|
||||
, mTiming(aTiming)
|
||||
, mName(aName)
|
||||
, mIsFinishedTransition(false)
|
||||
, mPseudoType(aPseudoType)
|
||||
{
|
||||
|
@ -227,10 +225,6 @@ public:
|
|||
" pseudo-element is not yet supported.");
|
||||
return mTarget;
|
||||
}
|
||||
void GetName(nsString& aRetVal) const
|
||||
{
|
||||
aRetVal = Name();
|
||||
}
|
||||
|
||||
// Temporary workaround to return both the target element and pseudo-type
|
||||
// until we implement PseudoElement.
|
||||
|
@ -239,12 +233,6 @@ public:
|
|||
aTarget = mTarget;
|
||||
aPseudoType = mPseudoType;
|
||||
}
|
||||
// Alternative to GetName that returns a reference to the member for
|
||||
// more efficient internal usage.
|
||||
virtual const nsString& Name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
void SetParentTime(Nullable<TimeDuration> aParentTime);
|
||||
|
||||
|
@ -340,7 +328,6 @@ protected:
|
|||
Nullable<TimeDuration> mParentTime;
|
||||
|
||||
AnimationTiming mTiming;
|
||||
nsString mName;
|
||||
// A flag to mark transitions that have finished and are due to
|
||||
// be removed on the next throttle-able cycle.
|
||||
bool mIsFinishedTransition;
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="../testcommon.js"></script>
|
||||
<style>
|
||||
div {
|
||||
/* Make it easier to calculate expected values: */
|
||||
animation-timing-function: linear ! important;
|
||||
}
|
||||
|
||||
@keyframes anim {
|
||||
from { margin-left: 100px; }
|
||||
to { margin-left: 200px; }
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function assert_playbackrate(animation,
|
||||
previousAnimationCurrentTime,
|
||||
previousTimelineCurrentTime,
|
||||
description) {
|
||||
var accuracy = 0.001; /* accuracy of DOMHighResTimeStamp */
|
||||
|
||||
var animationCurrentTimeDifference =
|
||||
animation.currentTime - previousAnimationCurrentTime;
|
||||
var timelineCurrentTimeDifference =
|
||||
animation.timeline.currentTime - previousTimelineCurrentTime;
|
||||
|
||||
assert_approx_equals(animationCurrentTimeDifference,
|
||||
timelineCurrentTimeDifference * animation.playbackRate,
|
||||
accuracy,
|
||||
description);
|
||||
}
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(test, {'style': 'animation: anim 10s'});
|
||||
var animation = div.getAnimations()[0];
|
||||
|
||||
animation.ready.then(t.step_func_done(function() {
|
||||
animation.currentTime = 7000; // ms
|
||||
animation.playbackRate = 0.5;
|
||||
|
||||
assert_equals(animation.currentTime, 7000,
|
||||
'Reducing Animation.playbackRate should not change the currentTime ' +
|
||||
'of a playing animation');
|
||||
|
||||
animation.playbackRate = 2;
|
||||
|
||||
assert_equals(animation.currentTime, 7000,
|
||||
'Increasing Animation.playbackRate should not change the currentTime ' +
|
||||
'of a playing animation');
|
||||
}));
|
||||
}, 'Test the initial effect of setting playbackRate on currentTime');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(test, {'style': 'animation: anim 100s'});
|
||||
var animation = div.getAnimations()[0];
|
||||
|
||||
animation.playbackRate = 2;
|
||||
|
||||
var previousTimelineCurrentTime;
|
||||
var previousAnimationCurrentTime;
|
||||
|
||||
animation.ready.then(function() {
|
||||
previousAnimationCurrentTime = animation.currentTime;
|
||||
previousTimelineCurrentTime = animation.timeline.currentTime;
|
||||
return waitForFrame();
|
||||
}).then(t.step_func_done(function() {
|
||||
assert_playbackrate(animation,
|
||||
previousAnimationCurrentTime,
|
||||
previousTimelineCurrentTime,
|
||||
'animation.currentTime should be 10 times faster than timeline.');
|
||||
}));
|
||||
}, 'Test the effect of setting playbackRate on currentTime');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(test, {'style': 'animation: anim 100s'});
|
||||
var animation = div.getAnimations()[0];
|
||||
|
||||
animation.playbackRate = 2;
|
||||
|
||||
var previousTimelineCurrentTime;
|
||||
var previousAnimationCurrentTime;
|
||||
|
||||
animation.ready.then(function() {
|
||||
previousAnimationCurrentTime = animation.currentTime;
|
||||
previousTimelineCurrentTime = animation.timeline.currentTime;
|
||||
|
||||
animation.playbackRate = 1;
|
||||
|
||||
return waitForFrame();
|
||||
}).then(t.step_func_done(function() {
|
||||
assert_equals(animation.playbackRate, 1,
|
||||
'sanity check: animation.playbackRate is still 1.');
|
||||
assert_playbackrate(animation,
|
||||
previousAnimationCurrentTime,
|
||||
previousTimelineCurrentTime,
|
||||
'animation.currentTime should be the same speed as timeline now.');
|
||||
}));
|
||||
}, 'Test the effect of setting playbackRate while playing animation');
|
||||
|
||||
done();
|
||||
</script>
|
||||
</body>
|
|
@ -13,21 +13,21 @@
|
|||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'xyz 100s';
|
||||
assert_equals(div.getAnimations()[0].effect.name, 'xyz',
|
||||
'Animation effect name matches keyframes rule name');
|
||||
}, 'Effect name makes keyframe rule');
|
||||
assert_equals(div.getAnimations()[0].animationName, 'xyz',
|
||||
'Animation name matches keyframes rule name');
|
||||
}, 'Animation name makes keyframe rule');
|
||||
|
||||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'x\\yz 100s';
|
||||
assert_equals(div.getAnimations()[0].effect.name, 'xyz',
|
||||
'Escaped animation effect name matches keyframes rule name');
|
||||
assert_equals(div.getAnimations()[0].animationName, 'xyz',
|
||||
'Escaped animation name matches keyframes rule name');
|
||||
}, 'Escaped animation name');
|
||||
|
||||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'x\\79 z 100s';
|
||||
assert_equals(div.getAnimations()[0].effect.name, 'xyz',
|
||||
assert_equals(div.getAnimations()[0].animationName, 'xyz',
|
||||
'Hex-escaped animation name matches keyframes rule'
|
||||
+ ' name');
|
||||
}, 'Animation name with hex-escape');
|
|
@ -27,6 +27,8 @@ test(function(t) {
|
|||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
|
||||
// FIXME: This test does too many things. It should be split up.
|
||||
|
||||
// Add an animation
|
||||
div.style.animation = 'anim1 100s';
|
||||
var animations = div.getAnimations();
|
||||
|
@ -60,6 +62,12 @@ async_test(function(t) {
|
|||
}));
|
||||
}, 'getAnimations for CSS Animations');
|
||||
|
||||
test(function(t) {
|
||||
var div = addDiv(t, { style: 'animation: anim1 100s' });
|
||||
assert_class_string(div.getAnimations()[0], 'CSSAnimation',
|
||||
'Interface of returned animation is CSSAnimation');
|
||||
}, 'getAnimations returns CSSAnimation objects for CSS Animations');
|
||||
|
||||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
|
||||
|
@ -88,14 +96,13 @@ async_test(function(t) {
|
|||
assert_equals(animations.length, 2,
|
||||
'getAnimations returns Animations for both animations and'
|
||||
+ ' transitions that run simultaneously');
|
||||
return waitForAllAnimations(animations);
|
||||
})).then(t.step_func(function() {
|
||||
assert_true(animations[0].startTime > animations[1].startTime,
|
||||
'Animations for transitions appear before animations even if they'
|
||||
+ ' start later');
|
||||
assert_class_string(animations[0], 'CSSTransition',
|
||||
'First-returned animation is the CSS Transition');
|
||||
assert_class_string(animations[1], 'CSSAnimation',
|
||||
'Second-returned animation is the CSS Animation');
|
||||
t.done();
|
||||
}));
|
||||
}, 'getAnimations for both CSS Animations and Transitions at once');
|
||||
}, 'getAnimations for both CSS Animations and CSS Transitions at once');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
|
|
|
@ -9,7 +9,7 @@ setup({explicit_done: true});
|
|||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.animations-api.core.enabled", true]]},
|
||||
function() {
|
||||
window.open("file_effect-name.html");
|
||||
window.open("file_animation-playbackrate.html");
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
setup({explicit_done: true});
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.animations-api.core.enabled", true]]},
|
||||
function() {
|
||||
window.open("file_cssanimation-animationname.html");
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -14,10 +14,10 @@ test(function(t) {
|
|||
div.style.transition = 'all 100s';
|
||||
div.style.left = '100px';
|
||||
|
||||
assert_equals(div.getAnimations()[0].effect.name, 'left',
|
||||
'The name for the transitions corresponds to the property ' +
|
||||
'being transitioned');
|
||||
}, 'Effect name for transitions');
|
||||
assert_equals(div.getAnimations()[0].transitionProperty, 'left',
|
||||
'The transitionProperty for the corresponds to the specific ' +
|
||||
'property being transitioned');
|
||||
}, 'CSSTransition.transitionProperty');
|
||||
|
||||
done();
|
||||
</script>
|
|
@ -8,6 +8,8 @@
|
|||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
|
||||
// FIXME: This test does too many things. It should be split up.
|
||||
|
||||
// Add a couple of transitions
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
|
@ -42,6 +44,16 @@ async_test(function(t) {
|
|||
}));
|
||||
}, 'getAnimations for CSS Transitions');
|
||||
|
||||
test(function(t) {
|
||||
var div = addDiv(t, { style: 'left: 0px; transition: all 100s' });
|
||||
|
||||
flushComputedStyle(div);
|
||||
div.style.left = '100px';
|
||||
|
||||
assert_class_string(div.getAnimations()[0], 'CSSTransition',
|
||||
'Interface of returned animation is CSSTransition');
|
||||
}, 'getAnimations returns CSSTransition objects for CSS Transitions');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ setup({explicit_done: true});
|
|||
SpecialPowers.pushPrefEnv(
|
||||
{ "set": [["dom.animations-api.core.enabled", true]]},
|
||||
function() {
|
||||
window.open("file_effect-name.html");
|
||||
window.open("file_csstransition-transitionproperty.html");
|
||||
});
|
||||
</script>
|
|
@ -16,14 +16,16 @@ support-files = css-animations/file_animation-finished.html
|
|||
support-files = css-animations/file_animation-pausing.html
|
||||
[css-animations/test_animation-play.html]
|
||||
support-files = css-animations/file_animation-play.html
|
||||
[css-animations/test_animation-playbackrate.html]
|
||||
support-files = css-animations/file_animation-playbackrate.html
|
||||
[css-animations/test_animation-playstate.html]
|
||||
support-files = css-animations/file_animation-playstate.html
|
||||
[css-animations/test_animation-ready.html]
|
||||
support-files = css-animations/file_animation-ready.html
|
||||
[css-animations/test_animation-starttime.html]
|
||||
support-files = css-animations/file_animation-starttime.html
|
||||
[css-animations/test_effect-name.html]
|
||||
support-files = css-animations/file_effect-name.html
|
||||
[css-animations/test_cssanimation-animationname.html]
|
||||
support-files = css-animations/file_cssanimation-animationname.html
|
||||
[css-animations/test_effect-target.html]
|
||||
support-files = css-animations/file_effect-target.html
|
||||
[css-animations/test_element-get-animations.html]
|
||||
|
@ -41,8 +43,8 @@ support-files = css-transitions/file_animation-pausing.html
|
|||
support-files = css-transitions/file_animation-ready.html
|
||||
[css-transitions/test_animation-starttime.html]
|
||||
support-files = css-transitions/file_animation-starttime.html
|
||||
[css-transitions/test_effect-name.html]
|
||||
support-files = css-transitions/file_effect-name.html
|
||||
[css-transitions/test_csstransition-transitionproperty.html]
|
||||
support-files = css-transitions/file_csstransition-transitionproperty.html
|
||||
[css-transitions/test_effect-target.html]
|
||||
support-files = css-transitions/file_effect-target.html
|
||||
[css-transitions/test_element-get-animations.html]
|
||||
|
|
|
@ -80,7 +80,7 @@ function flushComputedStyle(elem) {
|
|||
for (var funcName of ["async_test", "assert_not_equals", "assert_equals",
|
||||
"assert_approx_equals", "assert_less_than_equal",
|
||||
"assert_between_inclusive", "assert_true", "assert_false",
|
||||
"assert_throws", "test"]) {
|
||||
"assert_class_string", "assert_throws", "test"]) {
|
||||
window[funcName] = opener[funcName].bind(opener);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ this.EXPORTED_SYMBOLS = ["InterAppCommService"];
|
|||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
|
||||
const DEBUG = false;
|
||||
function debug(aMsg) {
|
||||
|
@ -220,6 +219,24 @@ this.InterAppCommService = {
|
|||
this._messagePortPairs = {};
|
||||
},
|
||||
|
||||
/* These attributes main use is to allow testing this in an isolated way
|
||||
* that doesn't depend on the app service, or the system messenger working on
|
||||
* the test environment
|
||||
*/
|
||||
get appsService() {
|
||||
return this._appsService || appsService;
|
||||
},
|
||||
set appsService(aService) {
|
||||
this._appsService = aService;
|
||||
},
|
||||
get messenger() {
|
||||
return this._messenger || messenger;
|
||||
},
|
||||
set messenger(aMessenger) {
|
||||
this._messenger = aMessenger;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Registration of a page that wants to be connected to other apps through
|
||||
* the Inter-App Communication API.
|
||||
|
@ -241,6 +258,7 @@ this.InterAppCommService = {
|
|||
" aDescription: " + aDescription +
|
||||
" aRules.minimumAccessLevel: " + aRules.minimumAccessLevel +
|
||||
" aRules.manifestURLs: " + aRules.manifestURLs +
|
||||
" aRules.pageURLs: " + aRules.pageURLs +
|
||||
" aRules.installOrigins: " + aRules.installOrigins);
|
||||
}
|
||||
|
||||
|
@ -316,6 +334,35 @@ this.InterAppCommService = {
|
|||
return false;
|
||||
},
|
||||
|
||||
_matchPageURLs: function(aRules, aPageURL) {
|
||||
|
||||
if (!aRules || !aRules.pageURLs) {
|
||||
if (DEBUG) {
|
||||
debug("rules.pageURLs is not available. No need to match.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!Array.isArray(aRules.pageURLs)) {
|
||||
aRules.pageURLs = [aRules.pageURLs];
|
||||
}
|
||||
|
||||
let pageURLs = aRules.pageURLs;
|
||||
let isAllowed = false;
|
||||
for (let i = 0, li = pageURLs.length; i < li && !isAllowed ; i++) {
|
||||
let regExpAllowedURL = new RegExp(pageURLs[i]);
|
||||
isAllowed = regExpAllowedURL.test(aPageURL);
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
debug("rules.pageURLs is " + (isAllowed ? "" : "not") + " matched!" +
|
||||
" pageURLs: " + pageURLs +
|
||||
" aPageURL: " + aPageURL);
|
||||
}
|
||||
|
||||
return isAllowed;
|
||||
},
|
||||
|
||||
_matchInstallOrigins: function(aRules, aInstallOrigin) {
|
||||
if (!aRules || !Array.isArray(aRules.installOrigins)) {
|
||||
if (DEBUG) {
|
||||
|
@ -337,10 +384,30 @@ this.InterAppCommService = {
|
|||
return false;
|
||||
},
|
||||
|
||||
// A connection is allowed if all the rules are matched.
|
||||
// The publisher is matched against the rules defined by the subscriber on the
|
||||
// manifest, and the subscriber is matched against the rules defined by the
|
||||
// publisher on the call to connect.
|
||||
// The possible rules for both subscribers and publishers are:
|
||||
// * minimumAccessLevel: "privileged"|"certified"|"web"|undefined
|
||||
// The default (non existant or undefined value) is "certified".
|
||||
// That means that if an explicit minimumAccessLevel rule does not
|
||||
// exist then the peer of the connection *must* be a certified app.
|
||||
// * pageURLs: Array of regExp of URLs. If the value exists, only the pages
|
||||
// whose URLs are explicitly declared on the array (matched) can connect.
|
||||
// Otherwise all pages can connect
|
||||
// * installOrigins: Array of origin URLs. If the value exist, only the apps
|
||||
// whose origins are on the array can connect. Otherwise, all origins are
|
||||
// allowed. This is only checked for non certified apps!
|
||||
// The default value (empty or non existant rules) is:
|
||||
// * Only certified apps can connect
|
||||
// * Any originator/receiving page URLs are valid
|
||||
// * Any origin is valid.
|
||||
_matchRules: function(aPubAppManifestURL, aPubRules,
|
||||
aSubAppManifestURL, aSubRules) {
|
||||
let pubApp = appsService.getAppByManifestURL(aPubAppManifestURL);
|
||||
let subApp = appsService.getAppByManifestURL(aSubAppManifestURL);
|
||||
aSubAppManifestURL, aSubRules,
|
||||
aPubPageURL, aSubPageURL) {
|
||||
let pubApp = this.appsService.getAppByManifestURL(aPubAppManifestURL);
|
||||
let subApp = this.appsService.getAppByManifestURL(aSubAppManifestURL);
|
||||
|
||||
let isPubAppCertified =
|
||||
(pubApp.appStatus == Ci.nsIPrincipal.APP_STATUS_CERTIFIED);
|
||||
|
@ -348,10 +415,8 @@ this.InterAppCommService = {
|
|||
let isSubAppCertified =
|
||||
(subApp.appStatus == Ci.nsIPrincipal.APP_STATUS_CERTIFIED);
|
||||
|
||||
// TODO Bug 907068 In the initiative step, we only expose this API to
|
||||
// certified apps to meet the time line. Eventually, we need to make
|
||||
// it available for the non-certified apps as well. For now, only the
|
||||
// certified apps can match the rules.
|
||||
#ifndef NIGHTLY_BUILD
|
||||
|
||||
if (!isPubAppCertified || !isSubAppCertified) {
|
||||
if (DEBUG) {
|
||||
debug("Only certified apps are allowed to do connections.");
|
||||
|
@ -359,6 +424,22 @@ this.InterAppCommService = {
|
|||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
let numSubRules = (aSubRules && Object.keys(aSubRules).length) || 0;
|
||||
let numPubRules = (aPubRules && Object.keys(aPubRules).length) || 0;
|
||||
|
||||
if ((!isSubAppCertified && !numPubRules) ||
|
||||
(!isPubAppCertified && !numSubRules)) {
|
||||
if (DEBUG) {
|
||||
debug("If there aren't rules defined only certified apps are allowed " +
|
||||
"to do connections.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (!aPubRules && !aSubRules) {
|
||||
if (DEBUG) {
|
||||
debug("No rules for publisher and subscriber. No need to match.");
|
||||
|
@ -378,6 +459,12 @@ this.InterAppCommService = {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check pageURLs.
|
||||
if (!this._matchPageURLs(aPubRules, aSubPageURL) ||
|
||||
!this._matchPageURLs(aSubRules, aPubPageURL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check installOrigins. Note that we only check the install origin for the
|
||||
// non-certified app, because the certified app doesn't have install origin.
|
||||
if ((!isSubAppCertified &&
|
||||
|
@ -393,11 +480,13 @@ this.InterAppCommService = {
|
|||
|
||||
_dispatchMessagePorts: function(aKeyword, aPubAppManifestURL,
|
||||
aAllowedSubAppManifestURLs,
|
||||
aTarget, aOuterWindowID, aRequestID) {
|
||||
aTarget, aOuterWindowID, aRequestID,
|
||||
aPubPageURL) {
|
||||
if (DEBUG) {
|
||||
debug("_dispatchMessagePorts: aKeyword: " + aKeyword +
|
||||
" aPubAppManifestURL: " + aPubAppManifestURL +
|
||||
" aAllowedSubAppManifestURLs: " + aAllowedSubAppManifestURLs);
|
||||
" aAllowedSubAppManifestURLs: " + aAllowedSubAppManifestURLs +
|
||||
" aPubPageURL: " + aPubPageURL);
|
||||
}
|
||||
|
||||
if (aAllowedSubAppManifestURLs.length == 0) {
|
||||
|
@ -442,9 +531,10 @@ this.InterAppCommService = {
|
|||
};
|
||||
|
||||
// Fire system message to deliver the message port to the subscriber.
|
||||
messenger.sendMessage("connection",
|
||||
this.messenger.sendMessage("connection",
|
||||
{ keyword: aKeyword,
|
||||
messagePortID: messagePortID },
|
||||
messagePortID: messagePortID,
|
||||
pubPageURL: aPubPageURL},
|
||||
Services.io.newURI(subscribedInfo.pageURL, null, null),
|
||||
Services.io.newURI(subscribedInfo.manifestURL, null, null));
|
||||
|
||||
|
@ -530,6 +620,7 @@ this.InterAppCommService = {
|
|||
_connect: function(aMessage, aTarget) {
|
||||
let keyword = aMessage.keyword;
|
||||
let pubRules = aMessage.rules;
|
||||
let pubPageURL = aMessage.pubPageURL;
|
||||
let pubAppManifestURL = aMessage.manifestURL;
|
||||
let outerWindowID = aMessage.outerWindowID;
|
||||
let requestID = aMessage.requestID;
|
||||
|
@ -540,7 +631,7 @@ this.InterAppCommService = {
|
|||
debug("No apps are subscribed for this connection. Returning.");
|
||||
}
|
||||
this._dispatchMessagePorts(keyword, pubAppManifestURL, [],
|
||||
aTarget, outerWindowID, requestID);
|
||||
aTarget, outerWindowID, requestID, pubPageURL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -566,7 +657,8 @@ this.InterAppCommService = {
|
|||
|
||||
let matched =
|
||||
this._matchRules(pubAppManifestURL, pubRules,
|
||||
subAppManifestURL, subRules);
|
||||
subAppManifestURL, subRules,
|
||||
pubPageURL, subscribedInfo.pageURL);
|
||||
if (!matched) {
|
||||
if (DEBUG) {
|
||||
debug("Rules are not matched. Skipping: " + subAppManifestURL);
|
||||
|
@ -588,7 +680,7 @@ this.InterAppCommService = {
|
|||
|
||||
this._dispatchMessagePorts(keyword, pubAppManifestURL,
|
||||
allowedSubAppManifestURLs,
|
||||
aTarget, outerWindowID, requestID);
|
||||
aTarget, outerWindowID, requestID, pubPageURL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -602,33 +694,36 @@ this.InterAppCommService = {
|
|||
};
|
||||
|
||||
let glue = Cc["@mozilla.org/dom/apps/inter-app-comm-ui-glue;1"]
|
||||
.createInstance(Ci.nsIInterAppCommUIGlue);
|
||||
.createInstance(Ci.nsIInterAppCommUIGlue);
|
||||
if (glue) {
|
||||
glue.selectApps(callerID, pubAppManifestURL, keyword, appsToSelect).then(
|
||||
function(aData) {
|
||||
aData.pubPageURL = pubPageURL;
|
||||
this._handleSelectedApps(aData);
|
||||
}.bind(this),
|
||||
function(aError) {
|
||||
if (DEBUG) {
|
||||
debug("Error occurred in the UI glue component. " + aError)
|
||||
debug("Error occurred in the UI glue component. " + aError);
|
||||
}
|
||||
|
||||
// Resolve the caller as if there were no selected apps.
|
||||
this._handleSelectedApps({ callerID: callerID,
|
||||
keyword: keyword,
|
||||
manifestURL: pubAppManifestURL,
|
||||
pubPageURL: pubPageURL,
|
||||
selectedApps: [] });
|
||||
}.bind(this)
|
||||
);
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
debug("Error! The UI glue component is not implemented.")
|
||||
debug("Error! The UI glue component is not implemented.");
|
||||
}
|
||||
|
||||
// Resolve the caller as if there were no selected apps.
|
||||
this._handleSelectedApps({ callerID: callerID,
|
||||
keyword: keyword,
|
||||
manifestURL: pubAppManifestURL,
|
||||
pubPageURL: pubPageURL,
|
||||
selectedApps: [] });
|
||||
}
|
||||
},
|
||||
|
@ -865,6 +960,7 @@ this.InterAppCommService = {
|
|||
let target = caller.target;
|
||||
|
||||
let pubAppManifestURL = aData.manifestURL;
|
||||
let pubPageURL = aData.pubPageURL;
|
||||
let keyword = aData.keyword;
|
||||
let selectedApps = aData.selectedApps;
|
||||
|
||||
|
@ -872,14 +968,14 @@ this.InterAppCommService = {
|
|||
if (selectedApps.length == 0) {
|
||||
// Only do the connections for the existing allowed subscribers because
|
||||
// no new apps are selected to connect.
|
||||
if (DEBUG) debug("No new apps are selected to connect.")
|
||||
if (DEBUG) debug("No new apps are selected to connect.");
|
||||
|
||||
allowedSubAppManifestURLs =
|
||||
this._getAllowedSubAppManifestURLs(keyword, pubAppManifestURL);
|
||||
} else {
|
||||
// Do connections for for the existing allowed subscribers and the newly
|
||||
// selected subscribers.
|
||||
if (DEBUG) debug("Some new apps are selected to connect.")
|
||||
if (DEBUG) debug("Some new apps are selected to connect.");
|
||||
|
||||
allowedSubAppManifestURLs =
|
||||
this._addSelectedApps(keyword, pubAppManifestURL, selectedApps);
|
||||
|
@ -889,7 +985,7 @@ this.InterAppCommService = {
|
|||
// including the old connections and the newly selected connection.
|
||||
this._dispatchMessagePorts(keyword, pubAppManifestURL,
|
||||
allowedSubAppManifestURLs,
|
||||
target, outerWindowID, requestID);
|
||||
target, outerWindowID, requestID, pubPageURL);
|
||||
},
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
|
@ -965,7 +1061,8 @@ this.InterAppCommService = {
|
|||
return;
|
||||
}
|
||||
|
||||
let manifestURL = appsService.getManifestURLByLocalId(params.appId);
|
||||
let manifestURL =
|
||||
this.appsService.getManifestURLByLocalId(params.appId);
|
||||
if (!manifestURL) {
|
||||
if (DEBUG) {
|
||||
debug("Error updating registered/allowed connections for an " +
|
||||
|
|
|
@ -86,6 +86,7 @@ function InterAppConnectionRequest() {
|
|||
if (DEBUG) debug("InterAppConnectionRequest()");
|
||||
this.keyword = null;
|
||||
this.port = null;
|
||||
this.from = null;
|
||||
};
|
||||
|
||||
InterAppConnectionRequest.prototype = {
|
||||
|
@ -97,10 +98,12 @@ InterAppConnectionRequest.prototype = {
|
|||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
||||
|
||||
__init: function(aKeyword, aPort) {
|
||||
if (DEBUG) debug("__init: aKeyword: " + aKeyword + " aPort: " + aPort);
|
||||
__init: function(aKeyword, aPort, aFrom) {
|
||||
if (DEBUG) debug("__init: aKeyword: " + aKeyword + " aPort: " + aPort +
|
||||
" aFrom: " + aFrom);
|
||||
this.keyword = aKeyword;
|
||||
this.port = aPort;
|
||||
this.from = aFrom;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -124,7 +127,8 @@ InterAppConnectionRequestWrapper.prototype = {
|
|||
|
||||
let port = new aWindow.MozInterAppMessagePort(aMessage.messagePortID);
|
||||
let connectionRequest =
|
||||
new aWindow.MozInterAppConnectionRequest(aMessage.keyword, port);
|
||||
new aWindow.MozInterAppConnectionRequest(aMessage.keyword, port,
|
||||
aMessage.pubPageURL);
|
||||
|
||||
return connectionRequest;
|
||||
},
|
||||
|
|
|
@ -610,10 +610,12 @@ WebappsApplication.prototype = {
|
|||
this.addMessageListeners(["Webapps:Connect:Return:OK",
|
||||
"Webapps:Connect:Return:KO"]);
|
||||
return this.createPromise(function (aResolve, aReject) {
|
||||
let from = this._window.location.origin + this._window.location.pathname;
|
||||
cpmm.sendAsyncMessage("Webapps:Connect", {
|
||||
keyword: aKeyword,
|
||||
rules: aRules,
|
||||
manifestURL: this.manifestURL,
|
||||
pubPageURL: from,
|
||||
outerWindowID: this._id,
|
||||
topWindowID: this._topId,
|
||||
requestID: this.getPromiseResolverId({
|
||||
|
|
|
@ -990,7 +990,8 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
// |aEntryPoint| is either the entry_point name or the null in which case we
|
||||
// use the root of the manifest.
|
||||
_createActivitiesToRegister: function(aManifest, aApp, aEntryPoint, aRunUpdate) {
|
||||
_createActivitiesToRegister: function(aManifest, aApp, aEntryPoint,
|
||||
aRunUpdate, aUninstall) {
|
||||
let activitiesToRegister = [];
|
||||
let root = aManifest;
|
||||
if (aEntryPoint && aManifest.entry_points[aEntryPoint]) {
|
||||
|
@ -1003,46 +1004,56 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
let manifest = new ManifestHelper(aManifest, aApp.origin, aApp.manifestURL);
|
||||
for (let activity in root.activities) {
|
||||
let description = root.activities[activity];
|
||||
let href = description.href;
|
||||
if (!href) {
|
||||
href = manifest.launch_path;
|
||||
let entry = root.activities[activity];
|
||||
if (!Array.isArray(entry)) {
|
||||
entry = [entry];
|
||||
}
|
||||
for (let i = 0; i < entry.length; i++) {
|
||||
let description = entry[i];
|
||||
let href = description.href;
|
||||
if (!href) {
|
||||
href = manifest.launch_path;
|
||||
}
|
||||
|
||||
try {
|
||||
href = manifest.resolveURL(href);
|
||||
} catch (e) {
|
||||
debug("Activity href (" + href + ") is invalid, skipping. " +
|
||||
"Error is: " + e);
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
href = manifest.resolveURL(href);
|
||||
} catch (e) {
|
||||
debug("Activity href (" + href + ") is invalid, skipping. " +
|
||||
"Error is: " + e);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make a copy of the description object since we don't want to modify
|
||||
// the manifest itself, but need to register with a resolved URI.
|
||||
let newDesc = {};
|
||||
for (let prop in description) {
|
||||
newDesc[prop] = description[prop];
|
||||
}
|
||||
newDesc.href = href;
|
||||
// Make a copy of the description object since we don't want to modify
|
||||
// the manifest itself, but need to register with a resolved URI.
|
||||
let newDesc = {};
|
||||
for (let prop in description) {
|
||||
newDesc[prop] = description[prop];
|
||||
}
|
||||
newDesc.href = href;
|
||||
|
||||
debug('_createActivitiesToRegister: ' + aApp.manifestURL + ', activity ' +
|
||||
activity + ', description.href is ' + newDesc.href);
|
||||
debug('_createActivitiesToRegister: ' + aApp.manifestURL + ', activity ' +
|
||||
activity + ', description.href is ' + newDesc.href);
|
||||
|
||||
if (aRunUpdate) {
|
||||
activitiesToRegister.push({ "manifest": aApp.manifestURL,
|
||||
"name": activity,
|
||||
"icon": manifest.iconURLForSize(128),
|
||||
"description": newDesc });
|
||||
}
|
||||
if (aRunUpdate || aUninstall) {
|
||||
activitiesToRegister.push({ "manifest": aApp.manifestURL,
|
||||
"name": activity,
|
||||
"icon": manifest.iconURLForSize(128),
|
||||
"description": newDesc });
|
||||
}
|
||||
|
||||
let launchPathURI = Services.io.newURI(href, null, null);
|
||||
let manifestURI = Services.io.newURI(aApp.manifestURL, null, null);
|
||||
if (aUninstall) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SystemMessagePermissionsChecker
|
||||
.isSystemMessagePermittedToRegister("activity",
|
||||
aApp.manifestURL,
|
||||
aManifest)) {
|
||||
msgmgr.registerPage("activity", launchPathURI, manifestURI);
|
||||
let launchPathURI = Services.io.newURI(href, null, null);
|
||||
let manifestURI = Services.io.newURI(aApp.manifestURL, null, null);
|
||||
|
||||
if (SystemMessagePermissionsChecker
|
||||
.isSystemMessagePermittedToRegister("activity",
|
||||
aApp.manifestURL,
|
||||
aManifest)) {
|
||||
msgmgr.registerPage("activity", launchPathURI, manifestURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
return activitiesToRegister;
|
||||
|
@ -1088,28 +1099,6 @@ this.DOMApplicationRegistry = {
|
|||
this._registerActivitiesForApps([{ manifest: aManifest, app: aApp }], aRunUpdate);
|
||||
},
|
||||
|
||||
// |aEntryPoint| is either the entry_point name or the null in which case we
|
||||
// use the root of the manifest.
|
||||
_createActivitiesToUnregister: function(aManifest, aApp, aEntryPoint) {
|
||||
let activitiesToUnregister = [];
|
||||
let root = aManifest;
|
||||
if (aEntryPoint && aManifest.entry_points[aEntryPoint]) {
|
||||
root = aManifest.entry_points[aEntryPoint];
|
||||
}
|
||||
|
||||
if (!root.activities) {
|
||||
return activitiesToUnregister;
|
||||
}
|
||||
|
||||
for (let activity in root.activities) {
|
||||
let description = root.activities[activity];
|
||||
activitiesToUnregister.push({ "manifest": aApp.manifestURL,
|
||||
"name": activity,
|
||||
"description": description });
|
||||
}
|
||||
return activitiesToUnregister;
|
||||
},
|
||||
|
||||
// |aAppsToUnregister| contains an array of apps to be unregistered, where
|
||||
// each element is an object in the format of {manifest: foo, app: bar}.
|
||||
_unregisterActivitiesForApps: function(aAppsToUnregister) {
|
||||
|
@ -1119,7 +1108,7 @@ this.DOMApplicationRegistry = {
|
|||
let manifest = aApp.manifest;
|
||||
let app = aApp.app;
|
||||
activitiesToUnregister.push.apply(activitiesToUnregister,
|
||||
this._createActivitiesToUnregister(manifest, app, null));
|
||||
this._createActivitiesToRegister(manifest, app, null, false, true));
|
||||
|
||||
if (!manifest.entry_points) {
|
||||
return;
|
||||
|
@ -1127,7 +1116,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
for (let entryPoint in manifest.entry_points) {
|
||||
activitiesToUnregister.push.apply(activitiesToUnregister,
|
||||
this._createActivitiesToUnregister(manifest, app, entryPoint));
|
||||
this._createActivitiesToRegister(manifest, app, entryPoint, false, true));
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ EXTRA_JS_MODULES += [
|
|||
'AppDownloadManager.jsm',
|
||||
'AppsServiceChild.jsm',
|
||||
'FreeSpaceWatcher.jsm',
|
||||
'InterAppCommService.jsm',
|
||||
'Langpacks.jsm',
|
||||
'OfflineCacheInstaller.jsm',
|
||||
'PermissionsInstaller.jsm',
|
||||
|
@ -45,6 +44,7 @@ EXTRA_JS_MODULES += [
|
|||
EXTRA_PP_JS_MODULES += [
|
||||
'AppsUtils.jsm',
|
||||
'ImportExport.jsm',
|
||||
'InterAppCommService.jsm',
|
||||
'OperatorApps.jsm',
|
||||
'ScriptPreloader.jsm',
|
||||
'TrustedHostedAppsUtils.jsm',
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/InterAppCommService.jsm");
|
||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
let UUIDGenerator = Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator);
|
||||
|
@ -11,15 +13,25 @@ let UUIDGenerator = Cc["@mozilla.org/uuid-generator;1"]
|
|||
const MESSAGE_PORT_ID = UUIDGenerator.generateUUID().toString();
|
||||
const FAKE_MESSAGE_PORT_ID = UUIDGenerator.generateUUID().toString();
|
||||
const OUTER_WINDOW_ID = UUIDGenerator.generateUUID().toString();
|
||||
const TOP_WINDOW_ID = UUIDGenerator.generateUUID().toString();
|
||||
const REQUEST_ID = UUIDGenerator.generateUUID().toString();
|
||||
|
||||
const PUB_APP_MANIFEST_URL = "app://pubApp.gaiamobile.org/manifest.webapp";
|
||||
const SUB_APP_MANIFEST_URL = "app://subApp.gaiamobile.org/manifest.webapp";
|
||||
const PUB_APP_MANIFEST_URL = "app://pubapp.gaiamobile.org/manifest.webapp";
|
||||
const PUB_APP_MANIFEST_URL_WRONG =
|
||||
"app://pubappnotaccepted.gaiamobile.org/manifest.webapp";
|
||||
const SUB_APP_MANIFEST_URL = "app://subapp.gaiamobile.org/manifest.webapp";
|
||||
const SUB_APP_MANIFEST_URL_WRONG =
|
||||
"app://subappnotaccepted.gaiamobile.org/manifest.webapp";
|
||||
|
||||
const PUB_APP_PAGE_URL = "app://pubApp.gaiamobile.org/handler.html";
|
||||
const SUB_APP_PAGE_URL = "app://subApp.gaiamobile.org/handler.html";
|
||||
const PUB_APP_PAGE_URL = "app://pubapp.gaiamobile.org/handler.html";
|
||||
const PUB_APP_PAGE_URL_WRONG = "app://pubapp.gaiamobile.org/notAccepted.html";
|
||||
const SUB_APP_PAGE_URL = "app://subapp.gaiamobile.org/handler.html";
|
||||
const SUB_APP_PAGE_URL_WORNG = "app://subapp.gaiamobile.org/notAccepted.html";
|
||||
|
||||
const PAGE_URL_REG_EXP = "^app://.*\\.gaiamobile\\.org/handler.html";
|
||||
|
||||
const KEYWORD = "test";
|
||||
const CONNECT_KEYWORD = "connect-test";
|
||||
|
||||
function create_message_port_pair(aMessagePortId,
|
||||
aKeyword,
|
||||
|
@ -340,7 +352,7 @@ add_test(function test_postMessage() {
|
|||
SUB_APP_MANIFEST_URL,
|
||||
{ text: "sub app says world again" });
|
||||
} else {
|
||||
do_throw("sub app receives an unexpected message")
|
||||
do_throw("sub app receives an unexpected message");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -386,7 +398,7 @@ add_test(function test_registerMessagePort_with_queued_messages() {
|
|||
clear_message_port_pairs();
|
||||
run_next_test();
|
||||
} else {
|
||||
do_throw("sub app receives an unexpected message")
|
||||
do_throw("sub app receives an unexpected message");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -450,6 +462,629 @@ add_test(function test_cancelConnection() {
|
|||
run_next_test();
|
||||
});
|
||||
|
||||
|
||||
function registerConnection(aKeyword, aSubAppPageURL, aSubAppManifestURL,
|
||||
aDescription, aRules) {
|
||||
var subAppPageUrl = Services.io.newURI(aSubAppPageURL, null, null);
|
||||
var subAppManifestUrl = Services.io.newURI(aSubAppManifestURL, null, null);
|
||||
InterAppCommService.registerConnection(aKeyword, subAppPageUrl,
|
||||
subAppManifestUrl, aDescription,
|
||||
aRules);
|
||||
}
|
||||
|
||||
add_test(function test_registerConnection() {
|
||||
InterAppCommService._registeredConnections = {};
|
||||
var description = "A test connection";
|
||||
|
||||
// Rules can have (ATM):
|
||||
// * minimumAccessLevel
|
||||
// * manifestURLs
|
||||
// * pageURLs
|
||||
// * installOrigins
|
||||
var sampleRules = {
|
||||
minimumAccessLevel: "certified",
|
||||
pageURLs: ["http://a.server.com/a/page.html"]
|
||||
};
|
||||
|
||||
registerConnection(CONNECT_KEYWORD, SUB_APP_PAGE_URL, SUB_APP_MANIFEST_URL,
|
||||
description, sampleRules);
|
||||
|
||||
var regConn = InterAppCommService._registeredConnections[CONNECT_KEYWORD];
|
||||
do_check_true(regConn !== undefined);
|
||||
var regEntry = regConn[SUB_APP_MANIFEST_URL];
|
||||
do_check_true(regEntry !== undefined);
|
||||
do_check_eq(regEntry.pageURL, SUB_APP_PAGE_URL);
|
||||
do_check_eq(regEntry.description, description);
|
||||
do_check_eq(regEntry.rules, sampleRules);
|
||||
do_check_eq(regEntry.manifestURL, SUB_APP_MANIFEST_URL);
|
||||
|
||||
InterAppCommService._registeredConnections = {};
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
||||
// Simulates mozApps connect
|
||||
function connect(publisher, aTargetSendAsyncMessage) {
|
||||
let message = {
|
||||
name: "Webapps:Connect",
|
||||
json: {
|
||||
keyword: publisher.connectKw,
|
||||
rules: publisher.rules,
|
||||
manifestURL: publisher.manifestURL,
|
||||
pubPageURL: publisher.pageURL,
|
||||
outerWindowID: OUTER_WINDOW_ID,
|
||||
topWindowID: TOP_WINDOW_ID,
|
||||
requestID: REQUEST_ID
|
||||
},
|
||||
target: {
|
||||
sendAsyncMessage: function(aName, aData) {
|
||||
if (aTargetSendAsyncMessage) {
|
||||
aTargetSendAsyncMessage(aName, aData);
|
||||
}
|
||||
},
|
||||
assertContainApp: function(_manifestURL) {
|
||||
return (publisher.manifestURL == _manifestURL);
|
||||
}
|
||||
}
|
||||
};
|
||||
InterAppCommService.receiveMessage(message);
|
||||
};
|
||||
|
||||
function registerComponent(aObject, aDescription, aContract) {
|
||||
var uuidGenerator = Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator);
|
||||
var cid = uuidGenerator.generateUUID();
|
||||
|
||||
var componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.registerFactory(cid, aDescription, aContract, aObject);
|
||||
|
||||
// Keep the id on the object so we can unregister later.
|
||||
aObject.cid = cid;
|
||||
}
|
||||
|
||||
function unregisterComponent(aObject) {
|
||||
var componentManager =
|
||||
Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
componentManager.unregisterFactory(aObject.cid, aObject);
|
||||
}
|
||||
|
||||
// The fun thing about this mock is that it actually does the same than the
|
||||
// current actual implementation does.
|
||||
var mockUIGlue = {
|
||||
// nsISupports implementation.
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsISupports) ||
|
||||
iid.equals(Ci.nsIFactory) ||
|
||||
iid.equals(Ci.nsIInterAppCommUIGlue)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
// nsIFactory implementation.
|
||||
createInstance: function(outer, iid) {
|
||||
return this.QueryInterface(iid);
|
||||
},
|
||||
|
||||
// nsIActivityUIGlue implementation.
|
||||
selectApps: function(aCallerID, aPubAppManifestURL, aKeyword,
|
||||
aAppsToSelect) {
|
||||
return Promise.resolve({
|
||||
callerID: aCallerID,
|
||||
keyword: aKeyword,
|
||||
manifestURL: aPubAppManifestURL,
|
||||
selectedApps: aAppsToSelect
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Used to keep a fake table of installed apps (needed by mockAppsService)
|
||||
var webappsTable = {
|
||||
};
|
||||
|
||||
var mockAppsService = {
|
||||
// We use the status and the installOrigin here only.
|
||||
getAppByManifestURL: function (aPubAppManifestURL) {
|
||||
return webappsTable[aPubAppManifestURL];
|
||||
},
|
||||
|
||||
// And so far so well this should not be used by tests at all.
|
||||
getManifestURLByLocalId: function(appId) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Template test for connect
|
||||
function simpleConnectTestTemplate(aTestCase) {
|
||||
dump("TEST: " + aTestCase.subscriber.description + "\n");
|
||||
|
||||
// First, add some mocking....
|
||||
|
||||
// System Messenger
|
||||
var resolveMessenger, rejectMessenger;
|
||||
var messengerPromise = new Promise((resolve, reject) => {
|
||||
resolveMessenger = resolve;
|
||||
rejectMessenger = reject;
|
||||
});
|
||||
var mockMessenger = {
|
||||
sendMessage: function(aName, aData, aDestURL, aDestManURL) {
|
||||
do_check_eq(aName, "connection");
|
||||
resolveMessenger(aData);
|
||||
}
|
||||
};
|
||||
InterAppCommService.messenger = mockMessenger;
|
||||
|
||||
// AppsService
|
||||
InterAppCommService.appsService = mockAppsService;
|
||||
|
||||
// Set the initial state:
|
||||
// First, setup our fake webappsTable:
|
||||
var subs = aTestCase.subscriber;
|
||||
var pub = aTestCase.publisher;
|
||||
webappsTable[subs.manifestURL] = subs.webappEntry;
|
||||
webappsTable[pub.manifestURL] = pub.webappEntry;
|
||||
|
||||
InterAppCommService._registeredConnections = {};
|
||||
clear_allowed_connections();
|
||||
clear_message_port_pairs();
|
||||
|
||||
registerConnection(subs.connectKw, subs.pageURL, subs.manifestURL,
|
||||
subs.description, subs.rules);
|
||||
|
||||
// And now we can try connecting...
|
||||
connect(pub, function(aName, aData) {
|
||||
|
||||
var expectedName = "Webapps:Connect:Return:OK";
|
||||
var expectedLength = 1;
|
||||
if (!aTestCase.expectedSuccess) {
|
||||
expectedName = "Webapps:Connect:Return:KO";
|
||||
expectedLength = 0;
|
||||
}
|
||||
|
||||
do_check_eq(aName, expectedName);
|
||||
var numPortIDs =
|
||||
(aData.messagePortIDs && aData.messagePortIDs.length ) || 0;
|
||||
do_check_eq(numPortIDs, expectedLength);
|
||||
if (expectedLength) {
|
||||
var portPair =
|
||||
InterAppCommService._messagePortPairs[aData.messagePortIDs[0]];
|
||||
do_check_eq(portPair.publisher.manifestURL,pub.manifestURL);
|
||||
do_check_eq(portPair.subscriber.manifestURL, subs.manifestURL);
|
||||
} else {
|
||||
run_next_test();
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to wait for the message to be "received" on the publisher also
|
||||
messengerPromise.then(messageData => {
|
||||
do_check_eq(messageData.keyword, subs.connectKw);
|
||||
do_check_eq(messageData.pubPageURL, pub.pageURL);
|
||||
do_check_eq(messageData.messagePortID, aData.messagePortIDs[0]);
|
||||
// Cleanup
|
||||
InterAppCommService.registeredConnections = {};
|
||||
clear_allowed_connections();
|
||||
clear_message_port_pairs();
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
const CERTIFIED = Ci.nsIPrincipal.APP_STATUS_CERTIFIED;
|
||||
const PRIVILEGED = Ci.nsIPrincipal.APP_STATUS_PRIVILEGED;
|
||||
const INSTALLED = Ci.nsIPrincipal.APP_STATUS_INSTALLED;
|
||||
const NOT_INSTALLED = Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED;
|
||||
|
||||
var connectTestCases = [
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "Trivial case [empty rules]. Successful test",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "not certified SUB status and not PUB rules",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: PRIVILEGED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "not certified PUB status and not SUB rules",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: INSTALLED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchMinimumAccessLvl --> Sub INSTALLED PubRul web",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: INSTALLED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {
|
||||
minimumAccessLevel:"web"
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchMinimumAccessLvl --> Sub NOT INSTALLED PubRul web",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: NOT_INSTALLED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {
|
||||
minimumAccessLevel:"web"
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchMinimumAccessLvl --> Pub CERTIFIED SubRul certified",
|
||||
rules: {
|
||||
minimumAccessLevel:"certified"
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchMinimumAccessLvl --> Pub PRIVILEGED SubRul certified",
|
||||
rules: {
|
||||
minimumAccessLevel:"certified"
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: PRIVILEGED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchManifest --> Pub manifest1 SubRules:{ manifest1 }",
|
||||
rules: {
|
||||
manifestURLs: [PUB_APP_MANIFEST_URL]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchManifest --> Pub manifest2 SubRules:{ manifest1 }",
|
||||
rules: {
|
||||
manifestURLs: [PUB_APP_MANIFEST_URL]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL_WRONG,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchManifest --> Sub manifest1 PubRules:{ manifest1 }",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {
|
||||
manifestURLs: [SUB_APP_MANIFEST_URL]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL_WRONG,
|
||||
description: "matchManifest --> Sub manifest2 PubRules:{ manifest1 }",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {
|
||||
manifestURLs: [SUB_APP_MANIFEST_URL]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL_WRONG,
|
||||
description: "matchPage --> Pub page1 SubRules:{ page1 }",
|
||||
rules: {
|
||||
pageURLs: [PAGE_URL_REG_EXP]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchPage --> Pub page2 SubRules:{ page1 }",
|
||||
rules: {
|
||||
pageURLs: [PAGE_URL_REG_EXP]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL_WRONG,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchPage --> Sub page1 PubRules:{ page1 }",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {
|
||||
pageURLs: [PAGE_URL_REG_EXP]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: true
|
||||
},
|
||||
{
|
||||
subscriber: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: SUB_APP_PAGE_URL_WORNG,
|
||||
manifestURL: SUB_APP_MANIFEST_URL,
|
||||
description: "matchPage --> Sub page2 PubRules:{ page1 }",
|
||||
rules: {},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
publisher: {
|
||||
connectKw: CONNECT_KEYWORD,
|
||||
pageURL: PUB_APP_PAGE_URL,
|
||||
manifestURL: PUB_APP_MANIFEST_URL,
|
||||
rules: {
|
||||
pageURLs: [PAGE_URL_REG_EXP]
|
||||
},
|
||||
webappEntry: {
|
||||
appStatus: CERTIFIED,
|
||||
installOrigin: "app://system.gaiamobile.org"
|
||||
}
|
||||
},
|
||||
expectedSuccess: false
|
||||
}
|
||||
];
|
||||
|
||||
// Only run these test cases if we're on a nightly build. Otherwise they
|
||||
// don't make much sense.
|
||||
if (AppConstants.NIGHTLY_BUILD) {
|
||||
registerComponent(mockUIGlue,
|
||||
"Mock InterApp UI Glue",
|
||||
"@mozilla.org/dom/apps/inter-app-comm-ui-glue;1");
|
||||
|
||||
do_register_cleanup(function () {
|
||||
// Cleanup the mocks
|
||||
InterAppCommService.messenger = undefined;
|
||||
InterAppCommService.appsService = undefined;
|
||||
unregisterComponent(mockUIGlue);
|
||||
});
|
||||
connectTestCases.forEach(
|
||||
aTestCase =>
|
||||
add_test(simpleConnectTestTemplate.bind(undefined, aTestCase))
|
||||
);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
do_get_profile();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "ArchiveZipEvent.h"
|
||||
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsNetCID.h"
|
||||
|
||||
#include "mozilla/dom/ArchiveReaderBinding.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "nsILinkHandler.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsIAnonymousContentCreator.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIAuthPrompt2.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIPromptFactory.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
|
|
@ -1235,7 +1235,7 @@ BlobImplTemporaryBlob::GetInternalStream(nsIInputStream** aStream,
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
// FileList implementation
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileList, mFiles)
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileList, mFiles, mParent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileList)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
|
|
|
@ -989,11 +989,6 @@ public:
|
|||
return mParent;
|
||||
}
|
||||
|
||||
void Disconnect()
|
||||
{
|
||||
mParent = nullptr;
|
||||
}
|
||||
|
||||
bool Append(File *aFile) { return mFiles.AppendElement(aFile); }
|
||||
|
||||
bool Remove(uint32_t aIndex) {
|
||||
|
@ -1040,7 +1035,7 @@ public:
|
|||
|
||||
private:
|
||||
nsTArray<nsRefPtr<File>> mFiles;
|
||||
nsISupports *mParent;
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/SyncRunnable.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/HTMLCanvasElementBinding.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsSize.h"
|
||||
|
||||
class nsICanvasRenderingContextInternal;
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
#include "nsIPermissionManager.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "TimeManager.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsCSSProps.h"
|
||||
|
|
|
@ -712,6 +712,13 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
ShadowRoot::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
{
|
||||
*aResult = nullptr;
|
||||
return NS_ERROR_DOM_DATA_CLONE_ERR;
|
||||
}
|
||||
|
||||
void
|
||||
ShadowRoot::DestroyContent()
|
||||
{
|
||||
|
|
|
@ -183,6 +183,8 @@ protected:
|
|||
// mark whether it is in the composed document, but we have run out of flags
|
||||
// so instead we track it here.
|
||||
bool mIsComposedDocParticipant;
|
||||
|
||||
nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
|
||||
};
|
||||
|
||||
class ShadowRootStyleSheetList : public StyleSheetList
|
||||
|
|
|
@ -43,6 +43,8 @@ enum StructuredCloneTags {
|
|||
|
||||
SCTAG_DOM_NFC_NDEF,
|
||||
|
||||
SCTAG_DOM_RTC_CERTIFICATE,
|
||||
|
||||
SCTAG_DOM_MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ThirdPartyUtil.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#include "nsJSUtils.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIAuthPrompt2.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "xpcpublic.h"
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include "nsCPrefetchService.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIMIMEHeaderParam.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
|
|
@ -134,6 +134,7 @@
|
|||
#include "nsILoadContext.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIMIMEHeaderParam.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsINode.h"
|
||||
#include "mozilla/dom/NodeInfo.h"
|
||||
|
@ -155,6 +156,7 @@
|
|||
#include "nsIStreamConverterService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIWordBreaker.h"
|
||||
|
|
|
@ -27,7 +27,6 @@ extern PRLogModuleInfo* GetDataChannelLog();
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "DataChannel.h"
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nsError.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsDataDocumentContentPolicy.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsINode.h"
|
||||
|
|
|
@ -84,7 +84,10 @@
|
|||
#include "nsIScriptError.h"
|
||||
#include "nsStyleSheetService.h"
|
||||
|
||||
#include "nsNetUtil.h" // for NS_MakeAbsoluteURI
|
||||
#include "nsNetUtil.h" // for NS_NewURI
|
||||
#include "nsIInputStreamChannel.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIAuthPrompt2.h"
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
|
|
|
@ -137,6 +137,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameMessageManager)
|
|||
tmp->mListeners.EnumerateRead(CycleCollectorTraverseListeners,
|
||||
static_cast<void*>(&cb));
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildManagers)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParentManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
|
@ -151,6 +152,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFrameMessageManager)
|
|||
Disconnect(false);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChildManagers)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParentManager)
|
||||
tmp->mInitialProcessData.setNull();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ protected:
|
|||
bool mDisconnected;
|
||||
mozilla::dom::ipc::MessageManagerCallback* mCallback;
|
||||
nsAutoPtr<mozilla::dom::ipc::MessageManagerCallback> mOwnedCallback;
|
||||
nsFrameMessageManager* mParentManager;
|
||||
nsRefPtr<nsFrameMessageManager> mParentManager;
|
||||
nsTArray<nsString> mPendingScripts;
|
||||
nsTArray<bool> mPendingScriptsGlobalStates;
|
||||
JS::Heap<JS::Value> mInitialProcessData;
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "mozilla/dom/WakeLock.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptTimeoutHandler.h"
|
||||
|
@ -40,6 +41,7 @@
|
|||
#include "nsWindowMemoryReporter.h"
|
||||
#include "WindowNamedPropertiesHandler.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
// Helper Classes
|
||||
#include "nsJSUtils.h"
|
||||
|
@ -3680,8 +3682,8 @@ nsPIDOMWindow::CreatePerformanceObjectIfNeeded()
|
|||
bool
|
||||
nsPIDOMWindow::GetAudioMuted() const
|
||||
{
|
||||
if (!IsInnerWindow()) {
|
||||
return mInnerWindow->GetAudioMuted();
|
||||
if (IsInnerWindow()) {
|
||||
return mOuterWindow->GetAudioMuted();
|
||||
}
|
||||
|
||||
return mAudioMuted;
|
||||
|
@ -3690,8 +3692,8 @@ nsPIDOMWindow::GetAudioMuted() const
|
|||
void
|
||||
nsPIDOMWindow::SetAudioMuted(bool aMuted)
|
||||
{
|
||||
if (!IsInnerWindow()) {
|
||||
mInnerWindow->SetAudioMuted(aMuted);
|
||||
if (IsInnerWindow()) {
|
||||
mOuterWindow->SetAudioMuted(aMuted);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3706,8 +3708,8 @@ nsPIDOMWindow::SetAudioMuted(bool aMuted)
|
|||
float
|
||||
nsPIDOMWindow::GetAudioVolume() const
|
||||
{
|
||||
if (!IsInnerWindow()) {
|
||||
return mInnerWindow->GetAudioVolume();
|
||||
if (IsInnerWindow()) {
|
||||
return mOuterWindow->GetAudioVolume();
|
||||
}
|
||||
|
||||
return mAudioVolume;
|
||||
|
@ -3716,8 +3718,8 @@ nsPIDOMWindow::GetAudioVolume() const
|
|||
nsresult
|
||||
nsPIDOMWindow::SetAudioVolume(float aVolume)
|
||||
{
|
||||
if (!IsInnerWindow()) {
|
||||
return mInnerWindow->SetAudioVolume(aVolume);
|
||||
if (IsInnerWindow()) {
|
||||
return mOuterWindow->SetAudioVolume(aVolume);
|
||||
}
|
||||
|
||||
if (aVolume < 0.0) {
|
||||
|
@ -3766,7 +3768,7 @@ nsPIDOMWindow::RefreshMediaElements()
|
|||
{
|
||||
nsRefPtr<AudioChannelService> service =
|
||||
AudioChannelService::GetOrCreateAudioChannelService();
|
||||
service->RefreshAgentsVolume(this);
|
||||
service->RefreshAgentsVolume(GetCurrentInnerWindow());
|
||||
}
|
||||
|
||||
// nsISpeechSynthesisGetter
|
||||
|
|
|
@ -76,7 +76,6 @@
|
|||
#include "nsIWidget.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsPIBoxObject.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsScriptLoader.h"
|
||||
#include "nsFrameLoader.h"
|
||||
#include "xpcpublic.h"
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsTextFormatter.h"
|
||||
|
@ -61,6 +60,8 @@
|
|||
#ifdef MOZ_NFC
|
||||
#include "mozilla/dom/MozNDEFRecord.h"
|
||||
#endif // MOZ_NFC
|
||||
#include "mozilla/dom/RTCCertificate.h"
|
||||
#include "mozilla/dom/RTCCertificateBinding.h"
|
||||
#include "mozilla/dom/StructuredClone.h"
|
||||
#include "mozilla/dom/SubtleCryptoBinding.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
|
@ -2547,6 +2548,25 @@ NS_DOMReadStructuredClone(JSContext* cx,
|
|||
#endif
|
||||
}
|
||||
|
||||
if (tag == SCTAG_DOM_RTC_CERTIFICATE) {
|
||||
nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(cx));
|
||||
if (!global) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Prevent the return value from being trashed by a GC during ~nsRefPtr.
|
||||
JS::Rooted<JSObject*> result(cx);
|
||||
{
|
||||
nsRefPtr<RTCCertificate> cert = new RTCCertificate(global);
|
||||
if (!cert->ReadStructuredClone(reader)) {
|
||||
result = nullptr;
|
||||
} else {
|
||||
result = cert->WrapObject(cx, nullptr);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Don't know what this is. Bail.
|
||||
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
|
||||
return nullptr;
|
||||
|
@ -2571,6 +2591,13 @@ NS_DOMWriteStructuredClone(JSContext* cx,
|
|||
key->WriteStructuredClone(writer);
|
||||
}
|
||||
|
||||
// Handle WebRTC Certificate cloning
|
||||
RTCCertificate* cert;
|
||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(RTCCertificate, obj, cert))) {
|
||||
return JS_WriteUint32Pair(writer, SCTAG_DOM_RTC_CERTIFICATE, 0) &&
|
||||
cert->WriteStructuredClone(writer);
|
||||
}
|
||||
|
||||
if (xpc::IsReflector(obj)) {
|
||||
nsCOMPtr<nsISupports> base = xpc::UnwrapReflectorToISupports(obj);
|
||||
nsCOMPtr<nsIPrincipal> principal = do_QueryInterface(base);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nsIDOMHTMLObjectElement.h"
|
||||
#include "nsIDOMHTMLAppletElement.h"
|
||||
#include "nsIExternalProtocolHandler.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "nsIDOMComment.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
|
|
@ -28,6 +28,12 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsIAuthPrompt.h"
|
||||
#include "nsIAuthPrompt2.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIUploadChannel.h"
|
||||
|
|
|
@ -1,38 +1,40 @@
|
|||
dump('loaded child cpow test\n');
|
||||
|
||||
content.document.title = "Hello, Kitty";
|
||||
const Cu = Components.utils;
|
||||
|
||||
var done_count = 0;
|
||||
var is_remote;
|
||||
|
||||
(function start() {
|
||||
[is_remote] = sendSyncMessage("cpows:is_remote");
|
||||
parent_test();
|
||||
error_reporting_test();
|
||||
dom_test();
|
||||
xray_test();
|
||||
if (typeof Symbol === "function") {
|
||||
symbol_test();
|
||||
[is_remote] = sendRpcMessage("cpows:is_remote");
|
||||
|
||||
var tests = [
|
||||
parent_test,
|
||||
error_reporting_test,
|
||||
dom_test,
|
||||
xray_test,
|
||||
symbol_test,
|
||||
compartment_test,
|
||||
regexp_test,
|
||||
postmessage_test,
|
||||
sync_test,
|
||||
async_test,
|
||||
rpc_test,
|
||||
lifetime_test
|
||||
];
|
||||
|
||||
function go() {
|
||||
if (tests.length == 0) {
|
||||
sendRpcMessage("cpows:done", {});
|
||||
return;
|
||||
}
|
||||
compartment_test();
|
||||
regexp_test();
|
||||
postmessage_test();
|
||||
sync_test();
|
||||
async_test();
|
||||
rpc_test();
|
||||
nested_sync_test();
|
||||
// The sync-ness of this call is important, because otherwise
|
||||
// we tear down the child's document while we are
|
||||
// still in the async test in the parent.
|
||||
// This test races with itself to be the final test.
|
||||
lifetime_test(function() {
|
||||
done_count++;
|
||||
if (done_count == 2)
|
||||
sendSyncMessage("cpows:done", {});
|
||||
|
||||
var test = tests[0];
|
||||
tests.shift();
|
||||
test(function() {
|
||||
go();
|
||||
});
|
||||
}
|
||||
)();
|
||||
|
||||
go();
|
||||
})();
|
||||
|
||||
function ok(condition, message) {
|
||||
dump('condition: ' + condition + ', ' + message + '\n');
|
||||
|
@ -69,6 +71,7 @@ function make_object()
|
|||
|
||||
let with_null_proto = Object.create(null);
|
||||
|
||||
content.document.title = "Hello, Kitty";
|
||||
return { "data": o,
|
||||
"throwing": throwing,
|
||||
"document": content.document,
|
||||
|
@ -84,7 +87,7 @@ function make_json()
|
|||
return { check: "ok" };
|
||||
}
|
||||
|
||||
function parent_test()
|
||||
function parent_test(finish)
|
||||
{
|
||||
function f(check_func) {
|
||||
let result = check_func(10);
|
||||
|
@ -104,38 +107,39 @@ function parent_test()
|
|||
sb.func = func;
|
||||
ok(sb.eval('func()') == 101, "can call parent's function in child");
|
||||
|
||||
done_count++;
|
||||
if (done_count == 2)
|
||||
sendSyncMessage("cpows:done", {});
|
||||
finish();
|
||||
});
|
||||
sendSyncMessage("cpows:parent_test", {}, {func: f});
|
||||
sendRpcMessage("cpows:parent_test", {}, {func: f});
|
||||
}
|
||||
|
||||
function error_reporting_test() {
|
||||
sendSyncMessage("cpows:error_reporting_test", {}, {});
|
||||
function error_reporting_test(finish) {
|
||||
sendRpcMessage("cpows:error_reporting_test", {}, {});
|
||||
finish();
|
||||
}
|
||||
|
||||
function dom_test()
|
||||
function dom_test(finish)
|
||||
{
|
||||
let element = content.document.createElement("div");
|
||||
element.id = "it_works";
|
||||
content.document.body.appendChild(element);
|
||||
|
||||
sendAsyncMessage("cpows:dom_test", {}, {element: element});
|
||||
sendRpcMessage("cpows:dom_test", {}, {element: element});
|
||||
Components.utils.schedulePreciseGC(function() {
|
||||
sendSyncMessage("cpows:dom_test_after_gc");
|
||||
sendRpcMessage("cpows:dom_test_after_gc");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
function xray_test()
|
||||
function xray_test(finish)
|
||||
{
|
||||
let element = content.document.createElement("div");
|
||||
element.wrappedJSObject.foo = "hello";
|
||||
|
||||
sendSyncMessage("cpows:xray_test", {}, {element: element});
|
||||
sendRpcMessage("cpows:xray_test", {}, {element: element});
|
||||
finish();
|
||||
}
|
||||
|
||||
function symbol_test()
|
||||
function symbol_test(finish)
|
||||
{
|
||||
let iterator = Symbol.iterator;
|
||||
let named = Symbol.for("cpow-test");
|
||||
|
@ -145,16 +149,18 @@ function symbol_test()
|
|||
[named]: named,
|
||||
};
|
||||
let test = ['a'];
|
||||
sendSyncMessage("cpows:symbol_test", {}, {object: object, test: test});
|
||||
sendRpcMessage("cpows:symbol_test", {}, {object: object, test: test});
|
||||
finish();
|
||||
}
|
||||
|
||||
// Parent->Child references should go X->parent.privilegedJunkScope->child.privilegedJunkScope->Y
|
||||
// Child->Parent references should go X->child.privilegedJunkScope->parent.unprivilegedJunkScope->Y
|
||||
function compartment_test()
|
||||
function compartment_test(finish)
|
||||
{
|
||||
// This test primarily checks various compartment invariants for CPOWs, and
|
||||
// doesn't make sense to run in-process.
|
||||
if (!is_remote) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -178,41 +184,47 @@ function compartment_test()
|
|||
|
||||
return results;
|
||||
}
|
||||
sendSyncMessage("cpows:compartment_test", {}, { getUnprivilegedObject: sb.getUnprivilegedObject,
|
||||
testParentObject: testParentObject });
|
||||
sendRpcMessage("cpows:compartment_test", {}, { getUnprivilegedObject: sb.getUnprivilegedObject,
|
||||
testParentObject: testParentObject });
|
||||
finish();
|
||||
}
|
||||
|
||||
function regexp_test()
|
||||
function regexp_test(finish)
|
||||
{
|
||||
sendSyncMessage("cpows:regexp_test", {}, { regexp: /myRegExp/g });
|
||||
sendRpcMessage("cpows:regexp_test", {}, { regexp: /myRegExp/g });
|
||||
finish();
|
||||
}
|
||||
|
||||
function postmessage_test()
|
||||
function postmessage_test(finish)
|
||||
{
|
||||
sendSyncMessage("cpows:postmessage_test", {}, { win: content.window });
|
||||
sendRpcMessage("cpows:postmessage_test", {}, { win: content.window });
|
||||
finish();
|
||||
}
|
||||
|
||||
function sync_test()
|
||||
function sync_test(finish)
|
||||
{
|
||||
dump('beginning cpow sync test\n');
|
||||
sync_obj = make_object();
|
||||
sendSyncMessage("cpows:sync",
|
||||
sendRpcMessage("cpows:sync",
|
||||
make_json(),
|
||||
make_object());
|
||||
finish();
|
||||
}
|
||||
|
||||
function async_test()
|
||||
function async_test(finish)
|
||||
{
|
||||
dump('beginning cpow async test\n');
|
||||
async_obj = make_object();
|
||||
sendAsyncMessage("cpows:async",
|
||||
make_json(),
|
||||
async_obj);
|
||||
|
||||
addMessageListener("cpows:async_done", finish);
|
||||
}
|
||||
|
||||
var rpc_obj;
|
||||
|
||||
function rpc_test()
|
||||
function rpc_test(finish)
|
||||
{
|
||||
dump('beginning cpow rpc test\n');
|
||||
rpc_obj = make_object();
|
||||
|
@ -223,26 +235,7 @@ function rpc_test()
|
|||
sendRpcMessage("cpows:rpc",
|
||||
make_json(),
|
||||
rpc_obj);
|
||||
}
|
||||
|
||||
function nested_sync_test()
|
||||
{
|
||||
dump('beginning cpow nested sync test\n');
|
||||
sync_obj = make_object();
|
||||
sync_obj.data.reenter = function () {
|
||||
let caught = false;
|
||||
try {
|
||||
sendSyncMessage("cpows:reenter_sync", { }, { });
|
||||
} catch (e) {
|
||||
caught = true;
|
||||
}
|
||||
if (!ok(caught, "should not allow nested sync"))
|
||||
return "fail";
|
||||
return "ok";
|
||||
}
|
||||
sendSyncMessage("cpows:nested_sync",
|
||||
make_json(),
|
||||
rpc_obj);
|
||||
finish();
|
||||
}
|
||||
|
||||
function lifetime_test(finish)
|
||||
|
@ -257,7 +250,7 @@ function lifetime_test(finish)
|
|||
|
||||
dump("beginning lifetime test\n");
|
||||
var obj = {"will_die": {"f": 1}};
|
||||
let [result] = sendSyncMessage("cpows:lifetime_test_1", {}, {obj: obj});
|
||||
let [result] = sendRpcMessage("cpows:lifetime_test_1", {}, {obj: obj});
|
||||
ok(result == 10, "got sync result");
|
||||
ok(obj.wont_die.f == 2, "got reverse CPOW");
|
||||
obj.will_die = null;
|
||||
|
@ -266,6 +259,6 @@ function lifetime_test(finish)
|
|||
ok(obj.wont_die.f == 2, "reverse CPOW still works");
|
||||
finish();
|
||||
});
|
||||
sendSyncMessage("cpows:lifetime_test_2");
|
||||
sendRpcMessage("cpows:lifetime_test_2");
|
||||
});
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
"getOwnPropertyDescriptor.value works");
|
||||
let obj = new data.ctor();
|
||||
ok(obj.a === 3, "constructor call");
|
||||
ok(document.title === "Hello, Kitty", "document node");
|
||||
is(document.title, "Hello, Kitty", "document node");
|
||||
is(typeof document.cookie, "string", "can get document.cookie");
|
||||
is(typeof document.defaultView.navigator.userAgent, "string", "can get navigator.userAgent");
|
||||
|
||||
|
@ -141,6 +141,7 @@
|
|||
|
||||
function recvAsyncMessage(message) {
|
||||
testCpowMessage(message);
|
||||
savedMM.sendAsyncMessage("cpows:async_done");
|
||||
}
|
||||
|
||||
function recvSyncMessage(message) {
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
var ac = new AudioContext();
|
||||
fetch("audio.ogg").then(response => {
|
||||
return response.arrayBuffer();
|
||||
}).then(ab => {
|
||||
return ac.decodeAudioData(ab);
|
||||
}).then(ab => {
|
||||
var src = ac.createBufferSource();
|
||||
src.buffer = ab;
|
||||
src.loop = true;
|
||||
src.start();
|
||||
src.connect(ac.destination);
|
||||
setTimeout(() => {
|
||||
if (ac.state == "running") {
|
||||
parent.runTest();
|
||||
} else {
|
||||
setTimeout(arguments.callee, 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var suspendPromise;
|
||||
function suspendAC() {
|
||||
suspendPromise = ac.suspend();
|
||||
}
|
||||
|
||||
var resumePromise;
|
||||
function resumeAC() {
|
||||
suspendPromise.then(() => {
|
||||
resumePromise = ac.resume();
|
||||
});
|
||||
}
|
||||
|
||||
function closeAC() {
|
||||
resumePromise.then(() => {
|
||||
ac.close();
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
var ac = new AudioContext();
|
||||
fetch("audio.ogg").then(response => {
|
||||
return response.arrayBuffer();
|
||||
}).then(ab => {
|
||||
return ac.decodeAudioData(ab);
|
||||
}).then(ab => {
|
||||
var src = ac.createBufferSource();
|
||||
src.buffer = ab;
|
||||
src.loop = true;
|
||||
src.start();
|
||||
src.connect(ac.destination);
|
||||
});
|
||||
</script>
|
|
@ -237,6 +237,8 @@ support-files =
|
|||
referrerHelper.js
|
||||
test_performance_user_timing.js
|
||||
img_referrer_testserver.sjs
|
||||
file_webaudioLoop.html
|
||||
file_webaudioLoop2.html
|
||||
|
||||
[test_anonymousContent_api.html]
|
||||
[test_anonymousContent_append_after_reflow.html]
|
||||
|
@ -305,6 +307,10 @@ skip-if = e10s || buildapp == 'b2g'
|
|||
[test_urlSearchParams.html]
|
||||
[test_urlSearchParams_utf8.html]
|
||||
[test_urlutils_stringify.html]
|
||||
[test_webaudioNotification.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
[test_webaudioNotificationStopOnNavigation.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
[test_window_constructor.html]
|
||||
[test_window_cross_origin_props.html]
|
||||
[test_window_define_symbol.html]
|
||||
|
|
|
@ -78,10 +78,25 @@ function runTest() {
|
|||
|
||||
utils.audioVolume = 0;
|
||||
is(utils.audioVolume, 0.0, "utils.audioVolume is ok");
|
||||
utils.audioVolume = 1.0;
|
||||
is(utils.audioVolume, 1.0, "utils.audioVolume is ok");
|
||||
utils.audioVolume = 0.6;
|
||||
is(utils.audioVolume.toFixed(2), "0.60", "utils.audioVolume is ok");
|
||||
utils.audioMuted = true;
|
||||
|
||||
SimpleTest.finish();
|
||||
// Navigate the iframe to another URL, and verify that the volume and muted
|
||||
// information is preserved.
|
||||
iframe.onload = function() {
|
||||
utils = SpecialPowers.wrap(iframe.contentWindow).
|
||||
QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
ok(utils, "nsIDOMWindowUtils");
|
||||
|
||||
ok(utils.audioMuted, "Audio should still be muted");
|
||||
utils.audioMuted = false;
|
||||
ok(utils.audioVolume.toFixed(2), "0.60", "Volume should be preserved");
|
||||
|
||||
SimpleTest.finish();
|
||||
};
|
||||
iframe.src = "data:text/html,page";
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({ "set": [["media.useAudioChannelService", true]]}, runTest);
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for audio controller in windows</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<iframe></iframe>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var expectedNotification = null;
|
||||
var iframe = null;
|
||||
|
||||
var observer = {
|
||||
observe: function(subject, topic, data) {
|
||||
is(topic, "media-playback", "media-playback received");
|
||||
is(data, expectedNotification, "This is the right notification");
|
||||
SimpleTest.executeSoon(runTest);
|
||||
}
|
||||
};
|
||||
|
||||
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIObserverService);
|
||||
|
||||
var tests = [
|
||||
function() {
|
||||
iframe = document.querySelector("iframe");
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
|
||||
},
|
||||
|
||||
function() {
|
||||
iframe.src = "file_webaudioLoop.html";
|
||||
},
|
||||
|
||||
function() {
|
||||
observerService.addObserver(observer, "media-playback", false);
|
||||
ok(true, "Observer set");
|
||||
runTest();
|
||||
},
|
||||
|
||||
function() {
|
||||
expectedNotification = 'inactive';
|
||||
iframe.contentWindow.suspendAC();
|
||||
},
|
||||
|
||||
function() {
|
||||
expectedNotification = 'active';
|
||||
iframe.contentWindow.resumeAC();
|
||||
},
|
||||
|
||||
function() {
|
||||
expectedNotification = 'inactive';
|
||||
iframe.contentWindow.closeAC();
|
||||
},
|
||||
|
||||
function() {
|
||||
observerService.removeObserver(observer, "media-playback");
|
||||
ok(true, "Observer removed");
|
||||
runTest();
|
||||
}
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
if (!tests.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var test = tests.shift();
|
||||
test();
|
||||
}
|
||||
|
||||
onload = runTest;
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for audio controller in windows</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<iframe></iframe>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var expectedNotification = null;
|
||||
var iframe = null;
|
||||
|
||||
var observer = {
|
||||
observe: function(subject, topic, data) {
|
||||
is(topic, "media-playback", "media-playback received");
|
||||
is(data, expectedNotification, "This is the right notification");
|
||||
runTest();
|
||||
}
|
||||
};
|
||||
|
||||
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIObserverService);
|
||||
|
||||
var tests = [
|
||||
function() {
|
||||
iframe = document.querySelector("iframe");
|
||||
SpecialPowers.pushPrefEnv({"set": [["media.useAudioChannelService", true]]}, runTest);
|
||||
},
|
||||
|
||||
function() {
|
||||
observerService.addObserver(observer, "media-playback", false);
|
||||
ok(true, "Observer set");
|
||||
runTest();
|
||||
},
|
||||
|
||||
function() {
|
||||
expectedNotification = 'active';
|
||||
iframe.src = "file_webaudioLoop2.html";
|
||||
},
|
||||
|
||||
function() {
|
||||
expectedNotification = 'inactive';
|
||||
iframe.src = "data:text/html,page without audio";
|
||||
},
|
||||
|
||||
function() {
|
||||
observerService.removeObserver(observer, "media-playback");
|
||||
ok(true, "Observer removed");
|
||||
runTest();
|
||||
}
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
if (!tests.length) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var test = tests.shift();
|
||||
test();
|
||||
}
|
||||
|
||||
onload = runTest;
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1138,6 +1138,9 @@ class CGHeaders(CGWrapper):
|
|||
|
||||
for m in desc.interface.members:
|
||||
addHeaderForFunc(PropertyDefiner.getStringAttr(m, "Func"))
|
||||
staticTypeOverride = PropertyDefiner.getStringAttr(m, "StaticClassOverride")
|
||||
if staticTypeOverride:
|
||||
bindingHeaders.add("/".join(staticTypeOverride.split("::")) + ".h")
|
||||
# getExtendedAttribute() returns a list, extract the entry.
|
||||
funcList = desc.interface.getExtendedAttribute("Func")
|
||||
if funcList is not None:
|
||||
|
@ -6771,8 +6774,11 @@ class CGPerSignatureCall(CGThing):
|
|||
|
||||
argsPre = []
|
||||
if static:
|
||||
nativeMethodName = "%s::%s" % (descriptor.nativeType,
|
||||
nativeMethodName)
|
||||
nativeType = descriptor.nativeType
|
||||
staticTypeOverride = PropertyDefiner.getStringAttr(idlNode, "StaticClassOverride")
|
||||
if (staticTypeOverride):
|
||||
nativeType = staticTypeOverride
|
||||
nativeMethodName = "%s::%s" % (nativeType, nativeMethodName)
|
||||
# If we're a constructor, "obj" may not be a function, so calling
|
||||
# XrayAwareCalleeGlobal() on it is not safe. Of course in the
|
||||
# constructor case either "obj" is an Xray or we're already in the
|
||||
|
@ -6809,9 +6815,10 @@ class CGPerSignatureCall(CGThing):
|
|||
needsUnwrappedVar = False
|
||||
unwrappedVar = "obj"
|
||||
elif descriptor.interface.isJSImplemented():
|
||||
needsUnwrap = True
|
||||
needsUnwrappedVar = True
|
||||
argsPost.append("js::GetObjectCompartment(unwrappedObj ? *unwrappedObj : obj)")
|
||||
if not idlNode.isStatic():
|
||||
needsUnwrap = True
|
||||
needsUnwrappedVar = True
|
||||
argsPost.append("js::GetObjectCompartment(unwrappedObj ? *unwrappedObj : obj)")
|
||||
elif needScopeObject(returnType, arguments, self.extendedAttributes,
|
||||
descriptor.wrapperCache, True,
|
||||
idlNode.getExtendedAttribute("StoreInSlot")):
|
||||
|
@ -13283,7 +13290,7 @@ class CGBindingImplClass(CGClass):
|
|||
"""
|
||||
Common codegen for generating a C++ implementation of a WebIDL interface
|
||||
"""
|
||||
def __init__(self, descriptor, cgMethod, cgGetter, cgSetter, wantGetParent=True, wrapMethodName="WrapObject"):
|
||||
def __init__(self, descriptor, cgMethod, cgGetter, cgSetter, wantGetParent=True, wrapMethodName="WrapObject", skipStaticMethods=False):
|
||||
"""
|
||||
cgMethod, cgGetter and cgSetter are classes used to codegen methods,
|
||||
getters and setters.
|
||||
|
@ -13314,7 +13321,8 @@ class CGBindingImplClass(CGClass):
|
|||
if m.isMethod():
|
||||
if m.isIdentifierLess():
|
||||
continue
|
||||
appendMethod(m)
|
||||
if not m.isStatic() or not skipStaticMethods:
|
||||
appendMethod(m)
|
||||
elif m.isAttr():
|
||||
self.methodDecls.append(cgGetter(descriptor, m))
|
||||
if not m.readonly:
|
||||
|
@ -13809,7 +13817,7 @@ class CGJSImplSetter(CGJSImplMember):
|
|||
|
||||
class CGJSImplClass(CGBindingImplClass):
|
||||
def __init__(self, descriptor):
|
||||
CGBindingImplClass.__init__(self, descriptor, CGJSImplMethod, CGJSImplGetter, CGJSImplSetter)
|
||||
CGBindingImplClass.__init__(self, descriptor, CGJSImplMethod, CGJSImplGetter, CGJSImplSetter, skipStaticMethods=True)
|
||||
|
||||
if descriptor.interface.parent:
|
||||
parentClass = descriptor.getDescriptor(
|
||||
|
|
|
@ -3377,7 +3377,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
|
|||
|
||||
if self.getExtendedAttribute("NewObject"):
|
||||
if self.dependsOn == "Nothing" or self.dependsOn == "DOMState":
|
||||
raise WebIDLError("A [NewObject] method is not idempotent, "
|
||||
raise WebIDLError("A [NewObject] method is not idempotent, "
|
||||
"so it has to depend on something other than DOM state.",
|
||||
[self.location])
|
||||
|
||||
|
@ -4528,6 +4528,12 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
"legacycaller.",
|
||||
[overloadWithPromiseReturnType.location])
|
||||
|
||||
if self.getExtendedAttribute("StaticClassOverride") and not \
|
||||
(self.identifier.scope.isJSImplemented() and self.isStatic()):
|
||||
raise WebIDLError("StaticClassOverride can be applied to static"
|
||||
" methods on JS-implemented classes only.",
|
||||
[self.location])
|
||||
|
||||
def overloadsForArgCount(self, argc):
|
||||
return [overload for overload in self._overloads if
|
||||
len(overload.arguments) == argc or
|
||||
|
@ -4645,7 +4651,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
identifier == "AvailableIn" or
|
||||
identifier == "CheckPermissions" or
|
||||
identifier == "BinaryName" or
|
||||
identifier == "MethodIdentityTestable"):
|
||||
identifier == "MethodIdentityTestable" or
|
||||
identifier == "StaticClassOverride"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче