[Pkg-javascript-commits] [dojo] 02/88: merge [29467], [29470], [29471] to 1.8/ branch, refs #13101 !strict

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 17:39:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.8.5
in repository dojo.

commit 51f3161d88725e8b791e354fe9d6717976f5cd70
Author: Bill Keese <bill at dojotoolkit.org>
Date:   Sat Aug 11 00:36:08 2012 +0000

    merge [29467], [29470], [29471] to 1.8/ branch, refs #13101 !strict
    
    git-svn-id: http://svn.dojotoolkit.org/src/branches/1.8/dojo@29472 560b804f-0ae3-0310-86f3-f6aa0a117693
---
 json.js                         | 86 +++++++++++++++++++++++------------------
 store/Cache.js                  | 10 ++---
 store/DataStore.js              |  2 +-
 store/JsonRest.js               |  2 +-
 store/Memory.js                 |  8 ++--
 store/api/Store.js              | 20 +++++-----
 store/util/SimpleQueryEngine.js |  2 +-
 7 files changed, 70 insertions(+), 60 deletions(-)

diff --git a/json.js b/json.js
index 2e11813..0fb8585 100644
--- a/json.js
+++ b/json.js
@@ -3,7 +3,54 @@ define(["./has"], function(has){
 	var hasJSON = typeof JSON != "undefined";
 	has.add("json-parse", hasJSON); // all the parsers work fine
 		// Firefox 3.5/Gecko 1.9 fails to use replacer in stringify properly https://bugzilla.mozilla.org/show_bug.cgi?id=509184
-	has.add("json-stringify", hasJSON && JSON.stringify({a:0}, function(k,v){return v||1;}) == '{"a":1}'); 
+	has.add("json-stringify", hasJSON && JSON.stringify({a:0}, function(k,v){return v||1;}) == '{"a":1}');
+
+	/*=====
+	return {
+		// summary:
+		//		Functions to parse and serialize JSON
+
+		parse: function(str, strict){
+			// summary:
+			//		Parses a [JSON](http://json.org) string to return a JavaScript object.
+			// description:
+			//		This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
+			//		Throws for invalid JSON strings. This delegates to eval() if native JSON
+			//		support is not available. By default this will evaluate any valid JS expression.
+			//		With the strict parameter set to true, the parser will ensure that only
+			//		valid JSON strings are parsed (otherwise throwing an error). Without the strict
+			//		parameter, the content passed to this method must come
+			//		from a trusted source.
+			// str:
+			//		a string literal of a JSON item, for instance:
+			//		`'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
+			// strict:
+			//		When set to true, this will ensure that only valid, secure JSON is ever parsed.
+			//		Make sure this is set to true for untrusted content. Note that on browsers/engines
+			//		without native JSON support, setting this to true will run slower.
+		},
+		stringify: function(value, replacer, spacer){
+			// summary:
+			//		Returns a [JSON](http://json.org) serialization of an object.
+			// description:
+			//		Returns a [JSON](http://json.org) serialization of an object.
+			//		This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
+			//		Note that this doesn't check for infinite recursion, so don't do that!
+			// value:
+			//		A value to be serialized.
+			// replacer:
+			//		A replacer function that is called for each value and can return a replacement
+			// spacer:
+			//		A spacer string to be used for pretty printing of JSON
+			// example:
+			//		simple serialization of a trivial object
+			//	|	define(["dojo/json"], function(JSON){
+			// 	|		var jsonStr = JSON.stringify({ howdy: "stranger!", isStrange: true });
+			//	|		doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
+		}
+	};
+	=====*/
+
 	if(has("json-stringify")){
 		return JSON;
 	}else{
@@ -17,50 +64,13 @@ define(["./has"], function(has){
 				replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string
 		};
 		return {
-			// summary:
-			//		Functions to parse and serialize JSON
-
 			parse: has("json-parse") ? JSON.parse : function(str, strict){
-				// summary:
-				//		Parses a [JSON](http://json.org) string to return a JavaScript object.
-				// description:
-				//		This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
-				//		Throws for invalid JSON strings. This delegates to eval() if native JSON
-				//		support is not available. By default this will evaluate any valid JS expression.
-				//		With the strict parameter set to true, the parser will ensure that only
-				//		valid JSON strings are parsed (otherwise throwing an error). Without the strict
-				//		parameter, the content passed to this method must come
-				//		from a trusted source.
-				// str:
-				//		a string literal of a JSON item, for instance:
-				//		`'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
-				// strict:
-				//		When set to true, this will ensure that only valid, secure JSON is ever parsed.
-				//		Make sure this is set to true for untrusted content. Note that on browsers/engines
-				//		without native JSON support, setting this to true will run slower.
 				if(strict && !/^([\s\[\{]*(?:"(?:\\.|[^"])+"|-?\d[\d\.]*(?:[Ee][+-]?\d+)?|null|true|false|)[\s\]\}]*(?:,|:|$))+$/.test(str)){
 					throw new SyntaxError("Invalid characters in JSON");
 				}
 				return eval('(' + str + ')');
 			},
 			stringify: function(value, replacer, spacer){
-				// summary:
-				//		Returns a [JSON](http://json.org) serialization of an object.
-				// description:
-				//		Returns a [JSON](http://json.org) serialization of an object.
-				//		This function follows [native JSON API](https://developer.mozilla.org/en/JSON)
-				//		Note that this doesn't check for infinite recursion, so don't do that!
-				// value:
-				//		A value to be serialized. 
-				// replacer:
-				//		A replacer function that is called for each value and can return a replacement
-				// spacer:
-				//		A spacer string to be used for pretty printing of JSON
-				// example:
-				//		simple serialization of a trivial object
-				//	|	define(["dojo/json"], function(JSON){
-				// 	|		var jsonStr = JSON.stringify({ howdy: "stranger!", isStrange: true });
-				//	|		doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
 				var undef;
 				if(typeof replacer == "string"){
 					spacer = replacer;
diff --git a/store/Cache.js b/store/Cache.js
index 7177ad6..7f162c0 100644
--- a/store/Cache.js
+++ b/store/Cache.js
@@ -91,9 +91,9 @@ Cache = declare(Store, {
 		//		Query the underlying master store and cache any results.
 		// query: Object|String
 		//		The object or string containing query information. Dependent on the query engine used.
-		// directives: Store.QueryOptions?
+		// directives: dojo/store/api/Store.QueryOptions?
 		//		An optional keyword arguments object with additional parameters describing the query.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		A QueryResults object that can be used to iterate over.
 	},
 	get: function(id, directives){
@@ -103,7 +103,7 @@ Cache = declare(Store, {
 		//		The identifier for the object in question.
 		// directives: Object?
 		//		Any additional parameters needed to describe how the get should be performed.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		A QueryResults object.
 	},
 	add: function(object, directives){
@@ -111,7 +111,7 @@ Cache = declare(Store, {
 		//		Add the given object to the store.
 		// object: Object
 		//		The object to add to the store.
-		// directives: Store.AddOptions?
+		// directives: dojo/store/api/Store.AddOptions?
 		//		Any additional parameters needed to describe how the add should be performed.
 		// returns: Number
 		//		The new id for the object.
@@ -121,7 +121,7 @@ Cache = declare(Store, {
 		//		Put the object into the store (similar to an HTTP PUT).
 		// object: Object
 		//		The object to put to the store.
-		// directives: Store.PutDirectives?
+		// directives: dojo/store/api/Store.PutDirectives?
 		//		Any additional parameters needed to describe how the put should be performed.
 		// returns: Number
 		//		The new id for the object.
diff --git a/store/DataStore.js b/store/DataStore.js
index d5e2287..3381eff 100644
--- a/store/DataStore.js
+++ b/store/DataStore.js
@@ -169,7 +169,7 @@ return declare("dojo.store.DataStore", base, {
 		//		The query to use for retrieving objects from the store
 		// options: Object?
 		//		Optional options object as used by the underlying dojo.data Store.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		A query results object that can be used to iterate over results.
 		var fetchHandle;
 		var deferred = new Deferred(function(){ fetchHandle.abort && fetchHandle.abort(); });
diff --git a/store/JsonRest.js b/store/JsonRest.js
index 004b1b6..e123da0 100644
--- a/store/JsonRest.js
+++ b/store/JsonRest.js
@@ -145,7 +145,7 @@ return declare("dojo.store.JsonRest", base, {
 		//		The query to use for retrieving objects from the store.
 		// options: __QueryOptions?
 		//		The optional arguments to apply to the resultset.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		The results of the query, extended with iterative methods.
 		options = options || {};
 
diff --git a/store/Memory.js b/store/Memory.js
index 0e0f738..e135a4e 100644
--- a/store/Memory.js
+++ b/store/Memory.js
@@ -60,7 +60,7 @@ return declare("dojo.store.Memory", base, {
 		//		Stores an object
 		// object: Object
 		//		The object to store.
-		// options: Store.PutDirectives??
+		// options: dojo/store/api/Store.PutDirectives?
 		//		Additional metadata for storing the data.  Includes an "id"
 		//		property if a specific id is to be used.
 		// returns: Number
@@ -86,7 +86,7 @@ return declare("dojo.store.Memory", base, {
 		//		Creates an object, throws an error if the object already exists
 		// object: Object
 		//		The object to store.
-		// options: Store.PutDirectives??
+		// options: dojo/store/api/Store.PutDirectives?
 		//		Additional metadata for storing the data.  Includes an "id"
 		//		property if a specific id is to be used.
 		// returns: Number
@@ -115,9 +115,9 @@ return declare("dojo.store.Memory", base, {
 		//		Queries the store for objects.
 		// query: Object
 		//		The query to use for retrieving objects from the store.
-		// options: Store.QueryOptions?
+		// options: dojo/store/api/Store.QueryOptions?
 		//		The optional arguments to apply to the resultset.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		The results of the query, extended with iterative methods.
 		//
 		// example:
diff --git a/store/api/Store.js b/store/api/Store.js
index bda503e..4704669 100644
--- a/store/api/Store.js
+++ b/store/api/Store.js
@@ -54,7 +54,7 @@ var Store = declare(null, {
 		//		Stores an object
 		// object: Object
 		//		The object to store.
-		// directives: Store.PutDirectives?
+		// directives: dojo/store/api/Store.PutDirectives?
 		//		Additional directives for storing objects.
 		// returns: Number|String
 	},
@@ -63,7 +63,7 @@ var Store = declare(null, {
 		//		Creates an object, throws an error if the object already exists
 		// object: Object
 		//		The object to store.
-		// directives: Store.PutDirectives?
+		// directives: dojo/store/api/Store.PutDirectives?
 		//		Additional directives for creating objects.
 		// returns: Number|String
 	},
@@ -88,9 +88,9 @@ var Store = declare(null, {
 		//		set of data from the store.
 		// query: String|Object|Function
 		//		The query to use for retrieving objects from the store.
-		// options: Store.QueryOptions
+		// options: dojo/store/api/Store.QueryOptions
 		//		The optional arguments to apply to the resultset.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		The results of the query, extended with iterative methods.
 		//
 		// example:
@@ -108,7 +108,7 @@ var Store = declare(null, {
 		//		Note that a store user might not call transaction() prior to using put,
 		//		delete, etc. in which case these operations effectively could be thought of
 		//		as "auto-commit" style actions.
-		// returns: Store.Transaction
+		// returns: dojo/store/api/Store.Transaction
 		//		This represents the new current transaction.
 	},
 	getChildren: function(parent, options){
@@ -116,9 +116,9 @@ var Store = declare(null, {
 		//		Retrieves the children of an object.
 		// parent: Object
 		//		The object to find the children of.
-		// options: Store.QueryOptions?
+		// options: dojo/store/api/Store.QueryOptions?
 		//		Additional options to apply to the retrieval of the children.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 		//		A result set of the children of the parent object.
 	},
 	getMetadata: function(object){
@@ -167,7 +167,7 @@ Store.SortInformation = declare(null, {
 Store.QueryOptions = declare(null, {
 	// summary:
 	//		Optional object with additional parameters for query results.
-	// sort: Store.SortInformation[]?
+	// sort: dojo/store/api/Store.SortInformation[]?
 	//		A list of attributes to sort on, as well as direction
 	//		For example:
 	//		| [{attribute:"price, descending: true}].
@@ -206,7 +206,7 @@ Store.QueryResults = declare(null, {
 		//		Function that is called for each object in the query results
 		// thisObject:
 		//		The object to use as |this| in the callback.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 	},
 	map: function(callback, thisObject){
 		// summary:
@@ -218,7 +218,7 @@ Store.QueryResults = declare(null, {
 		//		Function that is called for each object in the query results
 		// thisObject:
 		//		The object to use as |this| in the callback.
-		// returns: Store.QueryResults
+		// returns: dojo/store/api/Store.QueryResults
 	},
 	then: function(callback, errorHandler){
 		// summary:
diff --git a/store/util/SimpleQueryEngine.js b/store/util/SimpleQueryEngine.js
index 5f3ea0a..57d67b4 100644
--- a/store/util/SimpleQueryEngine.js
+++ b/store/util/SimpleQueryEngine.js
@@ -28,7 +28,7 @@ return function(query, options){
 	//		used to match strings by more complex expressions
 	//		(and then the regex's or object's test() method will be used to match values).
 	//
-	// options: Store.QueryOptions?
+	// options: dojo/store/api/Store.QueryOptions?
 	//		An object that contains optional information such as sort, start, and count.
 	//
 	// returns: Function

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list