Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#16656 closed defect (fixed)

dojox/mvc/StoreRefController is not working on Android 3.x

Reported by: cjolif Owned by: Ed Chatelain
Priority: undecided Milestone: 1.9
Component: DojoX MVC Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by cjolif)

Run the following code on Android 3.x (at least Samsung Galaxy Tab 10.1 tablet):

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<script type="text/javascript">
			dojoConfig = {
				isDebug: 1,
				parseOnLoad: 0,
				async: 1,
				mvc: {debugBindings: 1}
			};
		</script>
		<script type="text/javascript" src="../../../dojo/dojo.js"></script>
		<script>
		require(["dojox/mvc/StoreRefListController", "dojo/store/DataStore", "dojo/data/ItemFileWriteStore"],
			function(StoreRefListController, DataStore, ItemFileWriteStore){
			var ctrl = new StoreRefListController({store: new DataStore({store: new ItemFileWriteStore({url: "lists.json"})})});
			ctrl.queryStore();
		});
		</script>
		<script type="text/javascript">
		</script>
	</head>
	<body>
	</body>
</html>

You will get an exception.

This seems to be coming from the fact StoreRefController is adding new properties on a Deferred promise while the promise has been frozen (Object.freeze). Other browsers seems not enforce that but Android 3.x does.

Attachments (1)

StoreRefController.diff (546 bytes) - added by Akira Sudoh 6 years ago.
Patch to fix this issue.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 6 years ago by cjolif

Description: modified (diff)

comment:2 Changed 6 years ago by cjolif

Owner: changed from Ed Chatelain to cjolif
Status: newassigned

comment:3 Changed 6 years ago by cjolif

Description: modified (diff)

comment:4 Changed 6 years ago by cjolif

Owner: changed from cjolif to Ed Chatelain

comment:5 Changed 6 years ago by Akira Sudoh

IIRC module named dojox/mvc/StoreRefListController does not exist... So tried slightly modified HTML like below:

<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<script type="text/javascript">
			dojoConfig = {
				isDebug: 1,
				parseOnLoad: 0,
				async: 1,
				mvc: {debugBindings: 1}
			};
		</script>
		<script type="text/javascript" src="/path/to/dojotoolkit/dojo/dojo.js"></script>
		<script type="text/javascript">
			(function(){
				require([
					"dojo/json",
					"dojo/when",
					"dojo/store/DataStore",
					"dojo/data/ItemFileWriteStore",
					"dojox/mvc/EditStoreRefListController"
				], function(json, when, DataStore, ItemFileWriteStore, EditStoreRefListController){
					var ctrl = new EditStoreRefListController({store: new DataStore({store: new ItemFileWriteStore({url: require.toUrl("dojo/tests/data/countries.json")})})}),
						promise = ctrl.queryStore();
					when(promise, function(data){
						console.log("Obtained: " + json.stringify(data));
					});
				});
			})();
		</script>
	</head>
	<body>
	</body>
</html>

And got the following (without an error) with Android 3.0 browser:

Obtained: [{"abbr":"ec","name":"Ecuador","capital":"Quito","id":"ec"},{"abbr":"eg","name":"Egypt","capital":"Cairo","id":"eg"},{"abbr":"sv","name":"El Salvador","capital":"San Salvador","id":"sv"},{"abbr":"gq","name":"Equatorial Guinea","capital":"Malabo","id":"gq"},{"abbr":"er","name":"Eritrea","capital":"Asmara","id":"er"},{"abbr":"ee","name":"Estonia","capital":"Tallinn","id":"ee"},{"abbr":"et","name":"Ethiopia","capital":"Addis Ababa","id":"et"}]

I haven't worked much with Android, so wondering why you thought it's an issue with accessing frozen object? Was it from console or something?

comment:6 Changed 6 years ago by cjolif

Sorry for the typo. I only have one Android 3 device (the one listed above), so maybe this is specific to this one. I say this is coming from the frozen objects for two reasons:

  • because a TypeError: object is immutable error is indeed shown in the console (and this happens in StoreRefController.queryStore when we copy new properties into the promise)
  • and because if I change Deferred code to not freeze the promise I don't have anymore the problem ;)

comment:7 Changed 6 years ago by cjolif

Also I tested 3.1 and 3.2 not 3.0.

Changed 6 years ago by Akira Sudoh

Attachment: StoreRefController.diff added

Patch to fix this issue.

comment:8 Changed 6 years ago by Ed Chatelain

Resolution: fixed
Status: assignedclosed

In [30552]:

fixes #16656. dojox/mvc/StoreRefController is not working on Android 3.x. !strict Thanks Akira Sudoh (IBM, CCLA).

comment:9 Changed 6 years ago by Ed Chatelain

Milestone: tbd1.9
Note: See TracTickets for help on using tickets.