Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

New Test Application for the PermissionSettings API #6861

Merged
merged 1 commit into from Dec 11, 2012

Conversation

Projects
None yet
2 participants

@arcturus arcturus commented on an outdated diff Dec 7, 2012

test_apps/testpermission/js/permissiontest.js
+ 'power', 'sms', 'contacts', 'telephony', 'browser',
+ 'mozApps', 'mobileconnection', 'mozFM', 'systemXHR', 'background',
+ 'backgroundservice', 'settings', 'alarm', 'camera', 'fmradio', 'voicemail',
+ 'wifi-manage', 'wifi', 'networkstats-manage', 'geolocation',
+ 'webapps-manage', 'permissions', 'desktop-notification',
+ 'device-storage:pictures', 'device-storage:music', 'device-storage:videos',
+ 'device-storage:apps', 'alarms', 'attention', 'content-camera',
+ 'tcp-socket', 'bluetooth', 'storage', 'time', 'networkstats-manager',
+ 'idle', 'network-events', 'embed-apps',
+ // Just don't.
+ 'deprecated-hwvideo'
+ ];
+
+ var mozPerms = navigator.mozPermissionSettings;
+ if (!mozPerms) {
+ createElementAt(outputElement,"p","","WTF! I can't access mozPermissionSettings!");
@arcturus

arcturus Dec 7, 2012

Contributor

nit: wording ;P

@arcturus arcturus commented on an outdated diff Dec 7, 2012

test_apps/testpermission/js/permissiontest.js
+ createElementAt(outputElement,"p","","WTF! I can't access mozPermissionSettings!");
+ return;
+ }
+
+ navigator.mozApps.mgmt.getAll().onsuccess = function mozAppGotAll(evt) {
+ var apps = evt.target.result;
+
+ apps.sort(function alphabeticalSort(app, otherApp) {
+ return app.manifest.name > otherApp.manifest.name;
+ });
+
+
+ // We display permissions declared in the manifest
+ // and any other granted permission. I should see how forEach works some time.
+ // Some OTHER time
+ createElementAt(outputElement,"p","","List of application permissions below. Click on any permission to toggle its value.");
@arcturus

arcturus Dec 7, 2012

Contributor

This excess the 80 chars limit, you can pass the linter with

make lint

(and be aware of your changes)

@arcturus arcturus commented on an outdated diff Dec 7, 2012

test_apps/testpermission/js/permissiontest.js
+ var li=createElementAt(ulPerm,"li",app.manifest.name+":"+perm,perm+": "+value);
+ li.onclick=function() {
+ togglePermission(arguments[0],arguments[1],arguments[2]);
+ }.bind(undefined,app,perm,li);
+ }
+ }
+ }
+ };
+}
+
+function togglePermission(app,perm,item) {
+
+ var mozPerms = navigator.mozPermissionSettings;
+ var value = mozPerms.get(perm, app.manifestURL, app.origin, false);
+
+// console.log("Trying to change permission for "+app.manifest.name+" perm: "+perm+" Current Value: "+value);
@arcturus

arcturus Dec 7, 2012

Contributor

nit: dead code is dead

Contributor

arcturus commented Dec 11, 2012

a=r=me

@arcturus arcturus added a commit that referenced this pull request Dec 11, 2012

@arcturus arcturus Merge pull request #6861 from AntonioMA/master
New Test Application for the PermissionSettings API
944c91b

@arcturus arcturus merged commit 944c91b into mozilla-b2g:master Dec 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment