{ "id": "62137", "key": "TIMOB-1505", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11258", "description": "Holding Pen for Triaged Issues", "name": "Backlog", "archived": false, "released": false } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:56:21.000+0000", "created": "2011-04-15T02:54:37.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "injection", "ios", "json", "webview" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:56:21.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

Ti.JSON.stringify used to be injected into all WebView\nJavascript contexts. See this commit from last year: \nhttp://github.com/appcelerator/titanium_mobile/commit/9510dc89620677ba615a8a70904b51c4ab711959

\n

But now, it's missing. We were able to fix it by adding the\nfollowing JS code to our web view:

\n
\nTi.JSON = { stringify: function(x) { return Ti.App._JSON(x, 0); }};\n
\n

It looks like this line should be added to the\nkTitaniumJavascript constant in\niphone/Classes/TiUIWebView.m and probably to\niphone/Classes/bridge.txt. It looks like\nkTitaniumJavascript is being generated from\nbridge.txt, but we couldn't find anything in the build process that\nwould do this.

{html}", "attachment": [], "flagged": false, "summary": "Ti.JSON.stringify missing from WebView JS context", "creator": { "name": "carmenwick", "key": "carmenwick", "displayName": "Carmen Wick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "carmenwick", "key": "carmenwick", "displayName": "Carmen Wick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125876", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested 1.6.0RC1, resolved. Updated KS local HTML test to include\na check for this.

\n

UPDATE TO KS QA PASS:
\n- Base UI->Views->Web Views->Local URL - Check log; should\ncontain JSON injection: [\"foo\", \"bar\"]

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:54:37.000+0000", "updated": "2011-04-15T02:54:37.000+0000" }, { "id": "125877", "author": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Forgot to resolve.

{html}", "updateAuthor": { "name": "stephentramer", "key": "stephentramer", "displayName": "Stephen Tramer", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:54:37.000+0000", "updated": "2011-04-15T02:54:37.000+0000" }, { "id": "125878", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [6d6769cbe0f46e8a761db66d7fb74c42a6b78b7a])\n[#1505] Addition of KS test for JSON injection\ninto webviews \nhttps://github.com/appcelerator/titanium_mobile/commit/6d6769cbe0f4...

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:54:38.000+0000", "updated": "2011-04-15T02:54:38.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }