New issue
Advanced search Search tips

Issue 634921 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 623682



Sign in to add a comment

Add a JSON parser to Blink

Project Member Reported by iclell...@chromium.org, Aug 5 2016

Issue description

This is a result of the discussion on blink-dev here:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/yMYbwbgrCPM

There is currently no JSON parser available which takes as input a WTF::String and returns a blink::JSONValue. The only method for constructing JSONValue objects seems to be from V8 objects, in blink::toJSONValue. Other parsers take base::StringPiece, or std::string, or require a running V8 context to use.

The parser which used to exist has been moved to the inspector and has switched to using its own Value types, which have drifted over time away from JSONValue (using unique_ptrs, distinguishing between ints and doubles, for instance).

As we'd like to start using JSON parsing for HTTP headers, (initially for Feature Policy,) the result of that discussion was that we should back-port the inspector's Values and Parser to blink.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 5 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cc67aa8cfc7dd5672a05d85db883946d55c7a05a

commit cc67aa8cfc7dd5672a05d85db883946d55c7a05a
Author: iclelland <iclelland@chromium.org>
Date: Fri Aug 05 15:43:25 2016

Backporting JSONValues from protocol::Values

This commit back-ports the changes made in the inspector's JSON value class into Blink's JSONValue, and updates existing uses of JSONValue to use the new API.

Significant changes:
 - JSONValue (and subclasses) are held in std::unique_ptrs, rather than being refcounted.
 - JSON objects distinguish between Integers and Doubles

This commit does not remove the various JSONArray::push* methods, as they are used extensively as convenience methods, and are consistent with the JSONObject::set* methods.

BUG= 634921 

Review-Url: https://codereview.chromium.org/2218533002
Cr-Commit-Position: refs/heads/master@{#410066}

[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.h
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/frame/FrameView.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/frame/FrameView.h
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/modules/filesystem/DevToolsHostFileSystem.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/modules/nfc/NFC.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/JSONValues.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/JSONValues.h
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.h
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/graphics/LoggingCanvas.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/graphics/LoggingCanvas.h
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
[modify] https://crrev.com/cc67aa8cfc7dd5672a05d85db883946d55c7a05a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.h

Project Member

Comment 2 by bugdroid1@chromium.org, Aug 5 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e0f3188369f42c0ff445a6e698b0ab4171e9ff3c

commit e0f3188369f42c0ff445a6e698b0ab4171e9ff3c
Author: iclelland <iclelland@chromium.org>
Date: Fri Aug 05 16:29:15 2016

Port protocol::Parser to blink::JSONParser

This copies the JSON parser used by the inspector into platform so that it can be used by Blink. The code is almost identical, except that it takes as input WTF::String objects and output blink::JSONValue objects.

BUG= 634921 

Review-Url: https://codereview.chromium.org/2209763004
Cr-Commit-Position: refs/heads/master@{#410074}

[add] https://crrev.com/e0f3188369f42c0ff445a6e698b0ab4171e9ff3c/third_party/WebKit/Source/platform/JSONParser.cpp
[add] https://crrev.com/e0f3188369f42c0ff445a6e698b0ab4171e9ff3c/third_party/WebKit/Source/platform/JSONParser.h
[add] https://crrev.com/e0f3188369f42c0ff445a6e698b0ab4171e9ff3c/third_party/WebKit/Source/platform/JSONParserTest.cpp
[modify] https://crrev.com/e0f3188369f42c0ff445a6e698b0ab4171e9ff3c/third_party/WebKit/Source/platform/blink_platform.gypi

Status: Fixed (was: Started)

Sign in to add a comment