mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 777384 - Test case r=jlebar
--HG-- extra : rebase_source : 777580f0a22bfb3d9d447097b0f4a379f2b7416b
This commit is contained in:
parent
71f4b773d3
commit
d4e9c05829
@ -364,6 +364,7 @@ function checkIFrame(aFrame, data) {
|
|||||||
checkedCount++;
|
checkedCount++;
|
||||||
if (checkedCount == checksTodo) {
|
if (checkedCount == checksTodo) {
|
||||||
SpecialPowers.removePermission("browser", "http://example.org");
|
SpecialPowers.removePermission("browser", "http://example.org");
|
||||||
|
SpecialPowers.removePermission("embed-apps", "http://example.org");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
} else {
|
} else {
|
||||||
gTestRunner.next();
|
gTestRunner.next();
|
||||||
@ -389,6 +390,7 @@ function runTest() {
|
|||||||
};
|
};
|
||||||
iframe.addChild = function() {
|
iframe.addChild = function() {
|
||||||
SpecialPowers.addPermission("browser", true, iframe.contentDocument);
|
SpecialPowers.addPermission("browser", true, iframe.contentDocument);
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, iframe.contentDocument);
|
||||||
|
|
||||||
var childFrame = document.createElement('iframe');
|
var childFrame = document.createElement('iframe');
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ function setUp() {
|
|||||||
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
||||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
||||||
SpecialPowers.addPermission("browser", true, window.document);
|
SpecialPowers.addPermission("browser", true, window.document);
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||||
runNextTest();
|
runNextTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ function setUp() {
|
|||||||
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true);
|
||||||
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
SpecialPowers.setBoolPref("dom.ipc.browser_frames.oop_by_default", true);
|
||||||
SpecialPowers.addPermission("browser", true, window.document);
|
SpecialPowers.addPermission("browser", true, window.document);
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||||
|
|
||||||
let appId = gAppsService.getAppLocalIdByManifestURL(APP_MANIFEST);
|
let appId = gAppsService.getAppLocalIdByManifestURL(APP_MANIFEST);
|
||||||
SpecialPowers.addPermission("foobar", true, { url: APP_URL,
|
SpecialPowers.addPermission("foobar", true, { url: APP_URL,
|
||||||
|
@ -115,13 +115,13 @@ MOCHITEST_FILES = \
|
|||||||
file_browserElement_SecurityChange.html \
|
file_browserElement_SecurityChange.html \
|
||||||
browserElement_BackForward.js \
|
browserElement_BackForward.js \
|
||||||
test_browserElement_inproc_BackForward.html \
|
test_browserElement_inproc_BackForward.html \
|
||||||
file_bug741717.sjs \
|
file_bug741717.sjs \
|
||||||
browserElement_Reload.js \
|
browserElement_Reload.js \
|
||||||
file_bug709759.sjs \
|
file_bug709759.sjs \
|
||||||
browserElement_Stop.js \
|
browserElement_Stop.js \
|
||||||
test_browserElement_inproc_Stop.html \
|
test_browserElement_inproc_Stop.html \
|
||||||
browserElement_ContextmenuEvents.js \
|
browserElement_ContextmenuEvents.js \
|
||||||
test_browserElement_inproc_ContextmenuEvents.html \
|
test_browserElement_inproc_ContextmenuEvents.html \
|
||||||
browserElement_SendEvent.js \
|
browserElement_SendEvent.js \
|
||||||
test_browserElement_inproc_SendEvent.html \
|
test_browserElement_inproc_SendEvent.html \
|
||||||
browserElement_ScrollEvent.js \
|
browserElement_ScrollEvent.js \
|
||||||
@ -133,6 +133,9 @@ MOCHITEST_FILES = \
|
|||||||
test_browserElement_inproc_RemoveBrowserElement.html \
|
test_browserElement_inproc_RemoveBrowserElement.html \
|
||||||
browserElement_DOMRequestError.js \
|
browserElement_DOMRequestError.js \
|
||||||
test_browserElement_inproc_DOMRequestError.html \
|
test_browserElement_inproc_DOMRequestError.html \
|
||||||
|
file_browserElement_AppFramePermission.html \
|
||||||
|
browserElement_AppFramePermission.js \
|
||||||
|
test_browserElement_inproc_AppFramePermission.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
# Disabled due to https://bugzilla.mozilla.org/show_bug.cgi?id=774100
|
||||||
@ -187,12 +190,13 @@ MOCHITEST_FILES += \
|
|||||||
test_browserElement_oop_BackForward.html \
|
test_browserElement_oop_BackForward.html \
|
||||||
test_browserElement_oop_Reload.html \
|
test_browserElement_oop_Reload.html \
|
||||||
test_browserElement_oop_Stop.html \
|
test_browserElement_oop_Stop.html \
|
||||||
test_browserElement_oop_ContextmenuEvents.html \
|
test_browserElement_oop_ContextmenuEvents.html \
|
||||||
test_browserElement_oop_SendEvent.html \
|
test_browserElement_oop_SendEvent.html \
|
||||||
test_browserElement_oop_ScrollEvent.html \
|
test_browserElement_oop_ScrollEvent.html \
|
||||||
test_browserElement_oop_Auth.html \
|
test_browserElement_oop_Auth.html \
|
||||||
test_browserElement_oop_RemoveBrowserElement.html \
|
test_browserElement_oop_RemoveBrowserElement.html \
|
||||||
test_browserElement_oop_DOMRequestError.html \
|
test_browserElement_oop_DOMRequestError.html \
|
||||||
|
test_browserElement_oop_AppFramePermission.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif #}
|
endif #}
|
||||||
endif #}
|
endif #}
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
/* Any copyright is dedicated to the public domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
// Bug 777384 - Test mozapp permission.
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
function makeAllAppsLaunchable() {
|
||||||
|
var Webapps = {};
|
||||||
|
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/Webapps.jsm", Webapps);
|
||||||
|
var appRegistry = SpecialPowers.wrap(Webapps.DOMApplicationRegistry);
|
||||||
|
|
||||||
|
var originalValue = appRegistry.allAppsLaunchable;
|
||||||
|
appRegistry.allAppsLaunchable = true;
|
||||||
|
|
||||||
|
// Clean up after ourselves once tests are done so the test page is unloaded.
|
||||||
|
window.addEventListener("unload", function restoreAllAppsLaunchable(event) {
|
||||||
|
if (event.target == window.document) {
|
||||||
|
window.removeEventListener("unload", restoreAllAppsLaunchable, false);
|
||||||
|
appRegistry.allAppsLaunchable = originalValue;
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
makeAllAppsLaunchable();
|
||||||
|
|
||||||
|
function testAppElement(expectAnApp, callback) {
|
||||||
|
var iframe = document.createElement('iframe');
|
||||||
|
iframe.mozbrowser = true;
|
||||||
|
iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
|
||||||
|
iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
|
||||||
|
is(e.detail.message == 'app', expectAnApp, e.detail.message);
|
||||||
|
SimpleTest.executeSoon(callback);
|
||||||
|
});
|
||||||
|
document.body.appendChild(iframe);
|
||||||
|
iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_browserElement_AppFramePermission.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTest() {
|
||||||
|
browserElementTestHelpers.setEnabledPref(true);
|
||||||
|
browserElementTestHelpers.addPermission();
|
||||||
|
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, document);
|
||||||
|
testAppElement(true, function() {
|
||||||
|
SpecialPowers.removePermission("embed-apps", document);
|
||||||
|
testAppElement(false, function() {
|
||||||
|
SimpleTest.finish();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
runTest();
|
@ -9,6 +9,8 @@ SimpleTest.waitForExplicitFinish();
|
|||||||
function runTest() {
|
function runTest() {
|
||||||
browserElementTestHelpers.setEnabledPref(true);
|
browserElementTestHelpers.setEnabledPref(true);
|
||||||
browserElementTestHelpers.addPermission();
|
browserElementTestHelpers.addPermission();
|
||||||
|
// Permission to embed an app.
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, document);
|
||||||
|
|
||||||
var iframe1 = document.createElement('iframe');
|
var iframe1 = document.createElement('iframe');
|
||||||
iframe1.mozbrowser = true;
|
iframe1.mozbrowser = true;
|
||||||
@ -29,6 +31,7 @@ function runTest() {
|
|||||||
|
|
||||||
iframe2.addEventListener('mozbrowseropenwindow', function(e) {
|
iframe2.addEventListener('mozbrowseropenwindow', function(e) {
|
||||||
ok(true, "Got second mozbrowseropenwindow event.");
|
ok(true, "Got second mozbrowseropenwindow event.");
|
||||||
|
SpecialPowers.removePermission("embed-apps", document);
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript">
|
||||||
|
addEventListener('load', function(e) {
|
||||||
|
navigator.mozApps.getSelf().onsuccess = function onGetSelf() {
|
||||||
|
if (this.result) {
|
||||||
|
alert('app');
|
||||||
|
} else {
|
||||||
|
alert('notapp');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 777384</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="application/javascript;version=1.7" src="browserElement_AppFramePermission.js">
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 777384</title>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="browserElementTestHelpers.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="application/javascript;version=1.7" src="browserElement_AppFramePermission.js">
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -25,6 +25,7 @@ try {
|
|||||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
||||||
|
|
||||||
SpecialPowers.addPermission("browser", true, window.document);
|
SpecialPowers.addPermission("browser", true, window.document);
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||||
|
|
||||||
var gData = [
|
var gData = [
|
||||||
// APP 1
|
// APP 1
|
||||||
@ -107,6 +108,7 @@ function runTest()
|
|||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
|
|
||||||
SpecialPowers.removePermission("browser", window.document);
|
SpecialPowers.removePermission("browser", window.document);
|
||||||
|
SpecialPowers.removePermission("embed-apps", window.document);
|
||||||
|
|
||||||
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
|
if (previousPrefs.mozBrowserFramesEnabled !== undefined) {
|
||||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
|
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', previousPrefs.mozBrowserFramesEnabled);
|
||||||
|
@ -34,6 +34,7 @@ try {
|
|||||||
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
SpecialPowers.setBoolPref('dom.mozBrowserFramesEnabled', true);
|
||||||
|
|
||||||
SpecialPowers.addPermission("browser", true, window.document);
|
SpecialPowers.addPermission("browser", true, window.document);
|
||||||
|
SpecialPowers.addPermission("embed-apps", true, window.document);
|
||||||
|
|
||||||
var gData = [
|
var gData = [
|
||||||
// APP 1
|
// APP 1
|
||||||
@ -105,6 +106,7 @@ function runTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SpecialPowers.removePermission("browser", window.document);
|
SpecialPowers.removePermission("browser", window.document);
|
||||||
|
SpecialPowers.removePermission("embed-apps", window.document);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
} else {
|
} else {
|
||||||
|
@ -127,6 +127,7 @@
|
|||||||
"docshell/test/test_bug637644.html": "",
|
"docshell/test/test_bug637644.html": "",
|
||||||
"docshell/test/test_bug668513.html": "RANDOM",
|
"docshell/test/test_bug668513.html": "RANDOM",
|
||||||
"dom/browser-element/mochitest/test_browserElement_oop_SecurityChange.html": "TIMED_OUT, bug 766586",
|
"dom/browser-element/mochitest/test_browserElement_oop_SecurityChange.html": "TIMED_OUT, bug 766586",
|
||||||
|
"dom/browser-element/mochitest/test_browserElement_inproc_AppFramePermission.html": "",
|
||||||
"dom/browser-element/mochitest/test_browserElement_inproc_AppWindowNamespace.html": "TIMED_OUT, bug 783509",
|
"dom/browser-element/mochitest/test_browserElement_inproc_AppWindowNamespace.html": "TIMED_OUT, bug 783509",
|
||||||
"dom/browser-element/mochitest/test_browserElement_inproc_SecurityChange.html": "TIMED_OUT, bug 766586",
|
"dom/browser-element/mochitest/test_browserElement_inproc_SecurityChange.html": "TIMED_OUT, bug 766586",
|
||||||
"dom/devicestorage": "bug 781789 & bug 782275",
|
"dom/devicestorage": "bug 781789 & bug 782275",
|
||||||
|
Loading…
Reference in New Issue
Block a user