Skip to content

Commit cfa2ec1

Browse files
committed
JS: Remove fake JSONType from es5.js externs
1 parent e7166c2 commit cfa2ec1

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

javascript/externs/es/es5.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -236,20 +236,13 @@ Date.prototype.toISOString = function() {};
236236
Date.prototype.toJSON = function(opt_ignoredKey) {};
237237

238238

239-
/**
240-
* A fake type to model the JSON object.
241-
* @constructor
242-
*/
243-
function JSONType() {}
244-
245-
246239
/**
247240
* @param {string} jsonStr The string to parse.
248241
* @param {(function(string, *) : *)=} opt_reviver
249242
* @return {*} The JSON object.
250243
* @throws {Error}
251244
*/
252-
JSONType.prototype.parse = function(jsonStr, opt_reviver) {};
245+
JSON.parse = function(jsonStr, opt_reviver) {};
253246

254247

255248
/**
@@ -259,11 +252,4 @@ JSONType.prototype.parse = function(jsonStr, opt_reviver) {};
259252
* @return {string} JSON string which represents jsonObj.
260253
* @throws {Error}
261254
*/
262-
JSONType.prototype.stringify = function(jsonObj, opt_replacer, opt_space) {};
263-
264-
265-
/**
266-
* @type {!JSONType}
267-
* @suppress {duplicate}
268-
*/
269-
var JSON;
255+
JSON.stringify = function(jsonObj, opt_replacer, opt_space) {};

javascript/ql/src/semmle/javascript/GlobalAccessPaths.qll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ module GlobalAccessPath {
116116
// Note: Avoid unneeded materialization of DataFlow::Node.getFile()
117117
rhs.getAstNode().getFile() = file
118118
)
119-
or
120-
// Hard-code JSON methods from the externs file, since they aren't explicitly assigned.
121-
(accessPath = "JSON.parse" or accessPath = "JSON.stringify") and
122-
file.getBaseName() = "es5.js" and
123-
any(TopLevel tl | tl.getFile() = file).isExterns()
124119
}
125120

126121
/**

0 commit comments

Comments
 (0)