1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 12:42:26 +01:00

use native JSON

This commit is contained in:
Martin Stubenschrott
2008-06-03 17:34:45 +00:00
parent dac706634c
commit 5d272fea03

View File

@@ -35,9 +35,6 @@ liberator.Completion = function () //{{{
// the completion substrings, used for showing the longest common match // the completion substrings, used for showing the longest common match
var substrings = []; var substrings = [];
// import JSON module, needed for secure JSON parsing
Components.utils.import("resource://gre/modules/JSON.jsm");
// function uses smartcase // function uses smartcase
// list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ] // list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ]
function buildLongestCommonSubstring(list, filter) function buildLongestCommonSubstring(list, filter)
@@ -210,7 +207,9 @@ liberator.Completion = function () //{{{
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open("GET", queryURI, false); xhr.open("GET", queryURI, false);
xhr.send(null); xhr.send(null);
var results = JSON.fromString(xhr.responseText)[1];
var json = Components.classes["@mozilla.org/dom/json;1"].createInstance(Components.interfaces.nsIJSON);
var results = json.decode(xhr.responseText)[1];
if (!results) if (!results)
return; return;