diff --git a/build-system/test-configs/dep-check-config.js b/build-system/test-configs/dep-check-config.js index 3762954125ab..535ace9333c3 100644 --- a/build-system/test-configs/dep-check-config.js +++ b/build-system/test-configs/dep-check-config.js @@ -96,7 +96,7 @@ exports.rules = [ '3p/**->src/url.js', '3p/**->src/config.js', '3p/**->src/mode.js', - '3p/**->src/json.js', + '3p/**->src/core/types/object/json.js', '3p/**->src/3p-frame-messaging.js', '3p/**->src/internal-version.js', '3p/polyfills.js->src/polyfills/math-sign.js', diff --git a/src/3p-frame-messaging.js b/src/3p-frame-messaging.js index 7725e8523b0a..aeda16ac0528 100644 --- a/src/3p-frame-messaging.js +++ b/src/3p-frame-messaging.js @@ -17,7 +17,7 @@ import {dev, devAssert} from './log'; import {dict} from './core/types/object'; import {internalListenImplementation} from './event-helper-listen'; -import {parseJson} from './core/types/object/json'; +import {tryParseJson} from './core/types/object/json'; /** @const */ const AMP_MESSAGE_PREFIX = 'amp-'; @@ -120,12 +120,9 @@ export function deserializeMessage(message) { } const startPos = message.indexOf('{'); devAssert(startPos != -1, 'JSON missing in %s', message); - try { - return parseJson(message.substr(startPos)); - } catch (e) { - dev().error('MESSAGING', 'Failed to parse message: ' + message, e); - return null; - } + return tryParseJson(message.substr(startPos), (e) => + dev().error('MESSAGING', 'Failed to parse message: ' + message, e) + ); } /**