[TIMOB-1505] Ti.JSON.stringify missing from WebView JS context
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:56:21.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Backlog |
Components | iOS |
Labels | injection, ios, json, webview |
Reporter | Carmen Wick |
Assignee | Reggie Seagraves |
Created | 2011-04-15T02:54:37.000+0000 |
Updated | 2011-04-17T01:56:21.000+0000 |
Description
Ti.JSON.stringify used to be injected into all WebView Javascript contexts. See this commit from last year: http://github.com/appcelerator/titanium_mobile/commit/9510dc89620677ba615a8a70904b51c4ab711959"> http://github.com/appcelerator/titanium_mobile/commit/9510dc89620677ba615a8a70904b51c4ab711959
But now, it's missing. We were able to fix it by adding the following JS code to our web view:
Ti.JSON = { stringify: function(x) { return Ti.App._JSON(x, 0); }};
It looks like this line should be added to the
kTitaniumJavascript
constant in
iphone/Classes/TiUIWebView.m and probably to
iphone/Classes/bridge.txt. It looks like
kTitaniumJavascript
is being generated from
bridge.txt, but we couldn't find anything in the build process that
would do this.
Tested 1.6.0RC1, resolved. Updated KS local HTML test to include a check for this.
UPDATE TO KS QA PASS:
- Base UI->Views->Web Views->Local URL - Check log; should contain
JSON injection: ["foo", "bar"]
Forgot to resolve.
(from [6d6769cbe0f46e8a761db66d7fb74c42a6b78b7a]) [#1505] Addition of KS test for JSON injection into webviews https://github.com/appcelerator/titanium_mobile/commit/6d6769cbe0f46e8a761db66d7fb74c42a6b78b7a"> https://github.com/appcelerator/titanium_mobile/commit/6d6769cbe0f4...