Browse Source

browser-omni: update permission API usage after bug 1170200 is landed in goanna3 side

master
roytam1 7 months ago
parent
commit
ba00a3872b
  1. 11
      browser-omni/chrome/kmeleon/content/browser/preferences/permissions.js
  2. 11
      browser-omni/chrome/kmeleon/content/kmprefs/kmprefs/permissions.js
  3. 11
      k-meleon/chrome/kmprefs/content/kmprefs/permissions.js
  4. 11
      k-meleon/components/kmprefs/kmprefs/permissions.js
  5. 11
      k-meleon/components/preferences/permissions.js
  6. 6
      k-meleon/components/preferences/tests/browser_chunk_permissions.js

11
browser-omni/chrome/kmeleon/content/browser/preferences/permissions.js

@ -2,6 +2,8 @@
* 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/. */
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const nsICookiePermission = Components.interfaces.nsICookiePermission;
@ -81,9 +83,7 @@ var gPermissionManager = {
var textbox = document.getElementById("url");
var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme
try {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI("http://"+host, null, null);
var uri = NetUtil.newURI("http://" + host);
host = uri.host;
} catch(ex) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
@ -110,7 +110,7 @@ var gPermissionManager = {
if (!exists) {
host = (host.charAt(0) == ".") ? host.substring(1,host.length) : host;
var uri = ioService.newURI("http://" + host, null, null);
var uri = NetUtil.newURI("http://" + host);
this._pm.add(uri, this._type, aCapability);
}
textbox.value = "";
@ -279,7 +279,8 @@ var gPermissionManager = {
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
this._pm.remove(p.host, p.type);
let uri = NetUtil.newURI("http://" + p.host);
this._pm.remove(uri, p.type);
}
document.getElementById("removePermission").disabled = !this._permissions.length;
document.getElementById("removeAllPermissions").disabled = !this._permissions.length;

11
browser-omni/chrome/kmeleon/content/kmprefs/kmprefs/permissions.js

@ -1,4 +1,6 @@
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const nsICookiePermission = Components.interfaces.nsICookiePermission;
@ -74,9 +76,7 @@ var gPermissionManager = {
var textbox = document.getElementById('url');
var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ''); // trim any leading space and scheme
try {
var ioService = Components.classes['@mozilla.org/network/io-service;1']
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI('http://' + host, null, null);
var uri = NetUtil.newURI("http://" + host);
host = uri.host;
} catch (ex) {
var message = this._bundle.getString('invalidURI');
@ -98,7 +98,7 @@ var gPermissionManager = {
}
if (!exists) {
host = (host.charAt(0) == '.') ? host.substring(1, host.length) : host;
var uri = ioService.newURI('http://' + host, null, null);
var uri = NetUtil.newURI("http://" + host);
Services.perms.add(uri, this._type, aCapability);
}
textbox.value = '';
@ -225,7 +225,8 @@ var gPermissionManager = {
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
Services.perms.remove(p.host, p.type);
let uri = NetUtil.newURI("http://" + p.host);
Services.perms.remove(uri, p.type);
}
document.getElementById('removePermission').disabled = !this._permissions.length;
document.getElementById('removeAllPermissions').disabled = !this._permissions.length;

11
k-meleon/chrome/kmprefs/content/kmprefs/permissions.js

@ -1,4 +1,6 @@
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const nsICookiePermission = Components.interfaces.nsICookiePermission;
@ -74,9 +76,7 @@ var gPermissionManager = {
var textbox = document.getElementById('url');
var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ''); // trim any leading space and scheme
try {
var ioService = Components.classes['@mozilla.org/network/io-service;1']
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI('http://' + host, null, null);
var uri = NetUtil.newURI("http://" + host);
host = uri.host;
} catch (ex) {
var message = this._bundle.getString('invalidURI');
@ -98,7 +98,7 @@ var gPermissionManager = {
}
if (!exists) {
host = (host.charAt(0) == '.') ? host.substring(1, host.length) : host;
var uri = ioService.newURI('http://' + host, null, null);
var uri = NetUtil.newURI("http://" + host);
Services.perms.add(uri, this._type, aCapability);
}
textbox.value = '';
@ -225,7 +225,8 @@ var gPermissionManager = {
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
Services.perms.remove(p.host, p.type);
let uri = NetUtil.newURI("http://" + p.host);
Services.perms.remove(uri, p.type);
}
document.getElementById('removePermission').disabled = !this._permissions.length;
document.getElementById('removeAllPermissions').disabled = !this._permissions.length;

11
k-meleon/components/kmprefs/kmprefs/permissions.js

@ -1,4 +1,6 @@
Components.utils.import('resource://gre/modules/Services.jsm');
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const nsICookiePermission = Components.interfaces.nsICookiePermission;
@ -74,9 +76,7 @@ var gPermissionManager = {
var textbox = document.getElementById('url');
var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ''); // trim any leading space and scheme
try {
var ioService = Components.classes['@mozilla.org/network/io-service;1']
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI('http://' + host, null, null);
var uri = NetUtil.newURI("http://" + host);
host = uri.host;
} catch (ex) {
var message = this._bundle.getString('invalidURI');
@ -98,7 +98,7 @@ var gPermissionManager = {
}
if (!exists) {
host = (host.charAt(0) == '.') ? host.substring(1, host.length) : host;
var uri = ioService.newURI('http://' + host, null, null);
var uri = NetUtil.newURI("http://" + host);
Services.perms.add(uri, this._type, aCapability);
}
textbox.value = '';
@ -225,7 +225,8 @@ var gPermissionManager = {
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
Services.perms.remove(p.host, p.type);
let uri = NetUtil.newURI("http://" + p.host);
Services.perms.remove(uri, p.type);
}
document.getElementById('removePermission').disabled = !this._permissions.length;
document.getElementById('removeAllPermissions').disabled = !this._permissions.length;

11
k-meleon/components/preferences/permissions.js

@ -3,6 +3,8 @@
* 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/. */
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const nsICookiePermission = Components.interfaces.nsICookiePermission;
@ -82,9 +84,7 @@ var gPermissionManager = {
var textbox = document.getElementById("url");
var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme
try {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI("http://"+host, null, null);
var uri = NetUtil.newURI("http://" + host);
host = uri.host;
} catch(ex) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
@ -111,7 +111,7 @@ var gPermissionManager = {
if (!exists) {
host = (host.charAt(0) == ".") ? host.substring(1,host.length) : host;
var uri = ioService.newURI("http://" + host, null, null);
var uri = NetUtil.newURI("http://" + host);
this._pm.add(uri, this._type, aCapability);
}
textbox.value = "";
@ -254,7 +254,8 @@ var gPermissionManager = {
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
this._pm.remove(p.host, p.type);
let uri = NetUtil.newURI("http://" + p.host);
this._pm.remove(uri, p.type);
}
document.getElementById("removePermission").disabled = !this._permissions.length;
document.getElementById("removeAllPermissions").disabled = !this._permissions.length;

6
k-meleon/components/preferences/tests/browser_chunk_permissions.js

@ -55,9 +55,9 @@ function setup(aCallback) {
function cleanUp() {
for (let type in TEST_PERMS) {
if (type != "password") {
Services.perms.remove(TEST_URI_1.host, type);
Services.perms.remove(TEST_URI_2.host, type);
Services.perms.remove(TEST_URI_3.host, type);
Services.perms.remove(TEST_URI_1, type);
Services.perms.remove(TEST_URI_2, type);
Services.perms.remove(TEST_URI_3, type);
}
}
}

Loading…
Cancel
Save