Bug 1188639 - Fix typo in BrowserElement.webidl and add tests for it. r=yoshi,bz

This commit is contained in:
Kan-Ru Chen 2015-07-31 12:28:06 +08:00
parent bb1294bc8c
commit 37be5dc5be
6 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,30 @@
/* Any copyright is dedicated to the public domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Bug 1188639 - Check permission to use setNFCFocus
"use strict";
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
function hasSetNFCFocus() {
return new Promise((resolve, reject) => {
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', 'true');
iframe.addEventListener('mozbrowserloadend', e => {
is(iframe.setNFCFocus !== undefined, true,
"has permission to use setNFCFocus");
resolve();
});
document.body.appendChild(iframe);
});
}
function runTest() {
SpecialPowers.pushPermissions(
[{ 'type': 'nfc-manager', 'allow': 1, 'context': document }],
() => hasSetNFCFocus().then(SimpleTest.finish));
}
addEventListener('testready', runTest);

View File

@ -113,3 +113,4 @@ disabled = bug 924771
disabled = bug 924771
[test_browserElement_oop_GetContentDimensions.html]
[test_browserElement_oop_AudioChannel.html]
[test_browserElement_oop_SetNFCFocus.html]

View File

@ -61,6 +61,7 @@ support-files =
browserElement_SendEvent.js
browserElement_SelectionStateBlur.js
browserElement_SetInputMethodActive.js
browserElement_SetNFCFocus.js
browserElement_SetVisible.js
browserElement_SetVisibleFrames.js
browserElement_SetVisibleFrames2.js
@ -230,3 +231,4 @@ skip-if = (toolkit == 'android' && processor == 'x86') #x86 only bug 936226
disabled = bug 774100
[test_browserElement_inproc_GetContentDimensions.html]
[test_browserElement_inproc_AudioChannel.html]
[test_browserElement_inproc_SetNFCFocus.html]

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1188639</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_SetNFCFocus.js">
</script>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1188639</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_SetNFCFocus.js">
</script>
</body>
</html>

View File

@ -151,7 +151,7 @@ interface BrowserElementPrivileged {
[Throws,
Pref="dom.mozBrowserFramesEnabled",
CheckAllPermissions="browser setNFCFocus"]
CheckAllPermissions="browser nfc-manager"]
void setNFCFocus(boolean isFocus);
[Throws,