Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1505] Ti.JSON.stringify missing from WebView JS context

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:56:21.000+0000
Affected Version/sn/a
Fix Version/sBacklog
ComponentsiOS
Labelsinjection, ios, json, webview
ReporterCarmen Wick
AssigneeReggie Seagraves
Created2011-04-15T02:54:37.000+0000
Updated2011-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.

Comments

  1. Stephen Tramer 2011-04-15

    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"]

  2. Stephen Tramer 2011-04-15

    Forgot to resolve.

  3. Jeff Haynie 2011-04-15

    (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...

JSON Source