summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-04-13Fix integer overflow in CPDF_Font::FallbackFontFromCharcodeNicolas Pena
Bug: chromium:831583 Change-Id: Idc980ef47cdd942bddc75d9b7fe4a56bdeacdc1a Reviewed-on: https://pdfium-review.googlesource.com/30670 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-13Add test for circular CPDF_Function::Load().Henrique Nakashima
Bug: chromium:830221 Change-Id: Ia96086a1b930600a4fb9054123c867d1c8b301eb Reviewed-on: https://pdfium-review.googlesource.com/30671 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-04-13Add CPDF_ColorState::SetPattern().Lei Zhang
A common helper method for patterns, just like SetColor(). Change-Id: Iba6a9b33143d2d1278d05bbc2ce7e26b0ae5d197 Reviewed-on: https://pdfium-review.googlesource.com/30591 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-13Get rid of CPDF_Color::GetColorSpace().Lei Zhang
Replace it with more narrowly focused methods to get specific bits from the colorspace. Change-Id: Ifd2980f0fd06230d4d94d28eddf72219d2e9e6eb Reviewed-on: https://pdfium-review.googlesource.com/30590 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-13Add CPDF_Metadata unittestsdan sinclair
Add unittests for the CPDF_Metadata class. Change-Id: I1afeb0ab1434a1ebeb4f92bb91032a0f662e750d Reviewed-on: https://pdfium-review.googlesource.com/30630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Hide XML parsing inside CXFA_XMLLocaledan sinclair
This CL moves the parsing of the XML document into a static method of CXFA_XMLLocale. This removes the need for CXFA_LocaleMgr to care about the XML parser used. Change-Id: I04d14d78f458bfb37f0370fac2eb752e9840bfd6 Reviewed-on: https://pdfium-review.googlesource.com/30390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-04-13Move SharedForm check to CPDF_Metadata classdan sinclair
This CL moves code related to shared form detection into the CPDF_Metadata class. This allows us to hide the usage of CXML inside CPDF_Metadata. Change-Id: I547471a2bcc119221565c415a58211c1500cbb3c Reviewed-on: https://pdfium-review.googlesource.com/30370 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-13Rename the other CPDF_Color::SetValue() variant.Lei Zhang
Rename it to SetValueForNonePattern() and combine the components parameters into a std::vector. Fix the callers to use std::vector as well. Change-Id: I0edd7e7876e47b56821e63cc5073fc21fd4098ee Reviewed-on: https://pdfium-review.googlesource.com/30470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-13Make CFX_XMLInstruction a subclass of CFX_XMLNodedan sinclair
The CFX_XMLInstruction handles the <?blah?> blocks at the top of an XML file. It was inheriting from CFX_XMLAttributeNode in order to store the tag name. This CL moves the tag name into CFX_XMLInstruction and subclasses from CFX_XMLNode. Change-Id: I8f7ff0dde19ed43b46d095b0d45df4bf06875af5 Reviewed-on: https://pdfium-review.googlesource.com/30490 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-12Add AsSpan() convenience method to fxcrt strings.Tom Sepez
Make consistent with StringView methods. Change-Id: Idf336895053a327262de924b6a525052e22a25da Reviewed-on: https://pdfium-review.googlesource.com/30491 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-12Rename one CPDF_Color::SetValue() variant.Lei Zhang
Rename it to SetValueForPattern() and combine the components parameters into a std::vector. Fix the callers to use std::vector as well. Change-Id: Ib3426e0ffdb164f0fbb10d462ad251bf91165925 Reviewed-on: https://pdfium-review.googlesource.com/30450 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-12Add index parameter to quadpoints getter and setter.Ralf Sippl
This is needed for working with multiline text markup annotations. Based on https://pdfium-review.googlesource.com/12012. Bug: pdfium:1045 Change-Id: Ifb105996b8b950bb2d5fceaf754b4f571155aef4 Reviewed-on: https://pdfium-review.googlesource.com/29150 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-12Make some CPDF_StreamContentParser methods const.Lei Zhang
Change-Id: Idd1d865741bb487647fa823846ea5751245ed86a Reviewed-on: https://pdfium-review.googlesource.com/30453 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-12More CPDF_Color improvements.Lei Zhang
Make Copy() take a const-ref parameter. As is, the parameter is a pointer and it is dereferenced without any checks, and there are no crash reports as a result of that. Also mention GetPattern() should only be called when IsPattern() returns true. Change-Id: Ice3b7c941532d5a312fdd8f0c032e08d1ee1c6b5 Reviewed-on: https://pdfium-review.googlesource.com/30430 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-12Slightly simplify CPDF_Color::SetColorSpace().Lei Zhang
All the callers pass in a valid colorspace. SetColorSpace() is the only caller to CPDF_ColorSpace::GetDefaultColor(). Also adjust that method to make it harder to use incorrectly. Change-Id: I5cf7b6d2abef630e1b9443043b13d1c2b5bed18a Reviewed-on: https://pdfium-review.googlesource.com/30351 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-12Return pdfium::span<char> from ByteString::GetBuffer().Tom Sepez
Get bounds checking "for free". Change-Id: I7b14cacbc7130ced7b5cb1869b82c96ccff8e642 Reviewed-on: https://pdfium-review.googlesource.com/30451 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-12Return pdfium::span<wchar_t> from WideString::GetBuffer().Tom Sepez
Adds bounds checking "for free", but beware of span outliving a ReleaseBuffer() call. Scoping as such avoids the possibility of using an invalid span (and it is flagged as a lifetime issue). Change-Id: Ica63f4b1429823d0254ec6951aeaeb08160cb93c Reviewed-on: https://pdfium-review.googlesource.com/30310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-12Tidy up types in CBC_PDF417HighLevelEncoderRyan Harrison
Follow up to request in https://pdfium-review.googlesource.com/c/pdfium/+/30190 BUG=chromium:802242 Change-Id: I8fddd78d235a195c9782c3f6ced428de965e85eb Reviewed-on: https://pdfium-review.googlesource.com/30250 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-12Fail decode if continuing to get insufficient size errorRyan Harrison
In the case that the low level LZW decoder has indicated insufficient destination size, if another call to decode returns this status after adjusting the destination size, consider it an error. Subsequent iterations will not return a larger destination size, since the expected row size doesn't change, so the code will just loop infinitely, trying to decode a too large row. BUG=pdfium:1059 Change-Id: I14c8cee721fa77d8aab5e99deff9406490f01468 Reviewed-on: https://pdfium-review.googlesource.com/30452 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-12Make the input data to CPDF_ColorSpace::GetRGB() const.Lei Zhang
Make a copy of the input data when clamping it in CPDF_Function::Call(). Change-Id: I1d2b3d080977f0f9a4c3ccaf111780867668991a Reviewed-on: https://pdfium-review.googlesource.com/30350 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-12Change CPDF{XFA}_Page::PageToDevice() to take a CFX_PointF.Lei Zhang
Instead of taking two doubles. The doubles get casted to floats anyway. Change-Id: Ie16dc60fa5d6412026a5fda08c8c64d4fa2d56c4 Reviewed-on: https://pdfium-review.googlesource.com/30410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Add return value to FPDF_DeviceToPage().Lei Zhang
Do the same for FPDF_PageToDevice(). Clean up the internal implementation as well. Change-Id: Ia207bfa779d144cb9f0310e768750ab10e603b8f Reviewed-on: https://pdfium-review.googlesource.com/17370 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-12Add CPDF_Page::DeviceToPage() / PageToDevice().Lei Zhang
Just like CPDFXFA_Page. Also mark the methods const. Change-Id: I6717b4b61a29663780f45bf872f76fe8e671df75 Reviewed-on: https://pdfium-review.googlesource.com/30132 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-12Change some CPDFXFA_Page methods to take rects and points.Lei Zhang
Instead of many int in-parameters. Change-Id: I58b493ac0155f6b45f52963c0f61159633d88e28 Reviewed-on: https://pdfium-review.googlesource.com/30056 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-12Change GetDisplayMatrix methods to take FX_RECT.Lei Zhang
Change-Id: I079bc3bf1242fd28fdd51930d9deb6efa34d7509 Reviewed-on: https://pdfium-review.googlesource.com/30055 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-12Make CFX_Font take FX_RECT out params by pointer.Lei Zhang
Change-Id: I6643aaf66bf3e9d53d5afab5c99a5cb7deab3661 Reviewed-on: https://pdfium-review.googlesource.com/30054 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-12Clean up some CFX_RenderDevice code.Lei Zhang
- Pass matrices by const-ref instead of by pointers. - Mark one SetClip_Rect() variant as XFA-only. - Pass std::vector into DrawFillArea(). - Simplify the only DrawFillArea() caller. Change-Id: I8f7497e4d46345d50ac4cc8f3e7eef135644e7a7 Reviewed-on: https://pdfium-review.googlesource.com/30131 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-12Bounds check in CPDF_CMap::GetNextChar.Tom Sepez
These were kicked loose when we converted to span<>, and there isn't any reason to believe that the remaining string is long enough to complete a multibyte sequence. Bug: 831100 Change-Id: Iae4363f72b4d7ff088a73994d0fe5dab4077ee9e Reviewed-on: https://pdfium-review.googlesource.com/30291 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Remove CXFA_DocumentParser::m_bDocumentParser flagDan Sinclair
This CL removes the import data behaviour as it was never called and cleans up the m_bDocumentParser flag as it will always be used in the true case. Change-Id: If90a0a55cc76f406e9987aa71580e90edeaa01ba Reviewed-on: https://pdfium-review.googlesource.com/30292 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Fixup CFX_XMLParser::GetStatus returnDan Sinclair
This CL fixes the return type of CFX_XMLParser::GetStatus to correctly return bool instead of int32_t. Change-Id: Ifa0d24b8aad55c4cf63ddf7cfc8eee48bf8431bf Reviewed-on: https://pdfium-review.googlesource.com/30290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Remove CFX_XMLDoc and call the parser directlyDan Sinclair
This CL removes the CFX_XMLDoc and calls the CFX_XMLParser directly from CXFA_DocumentParser. Change-Id: I4d715cca90cd15b5e1d79827e0bb2781e873e371 Reviewed-on: https://pdfium-review.googlesource.com/30251 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Cleanup CXFA_FFDocDan Sinclair
This CL changes CXFA_FFDoc to no longer use the CXFA_FFApp to create the document, it does it directly. The stream data is not stored in the FFDoc anymore as it is only used once. Change-Id: I8247d2fb0324e554250ff0a03c67f067ef46e437 Reviewed-on: https://pdfium-review.googlesource.com/30270 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Rename CXFA_SimpleParser to CXFA_DocumentParserDan Sinclair
The CXFA_SimpleParser is handling the XFA document parsing. This CL renames the class to make it clearer that this is the XFA document parser. Change-Id: Ia290df2671fba9efa221ae997156ee4846749b02 Reviewed-on: https://pdfium-review.googlesource.com/30231 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Fold CXFA_DocumentParser into CXFA_FFDocDan Sinclair
The CXFA_DocumentParser is a thin wrapper around CXFA_SimpleParser. This CL folds CXFA_DocumentParser into a ParseDoc method of CXFA_FFDoc. Change-Id: I7e7073899436f0435c4ebfd548241ae842a2a276 Reviewed-on: https://pdfium-review.googlesource.com/30213 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Retrieve the XML tree in the DocumentParserDan Sinclair
This CL changes the document parser to store the parsed XML tree. That way we no longer need to store the pointer to the CXFA_SimpleParser in the CXFA_DocumentParser. Change-Id: I9272150e73613411cb1bb59c3cf77c7af6cc799d Reviewed-on: https://pdfium-review.googlesource.com/30211 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Allow retrieving the XML tree from the CFX_XMLDocDan Sinclair
This CL allows the CXFA_SimpleParser to retrieve the XML tree from the CFX_XMLDoc. This way, we don't have to keep the doc around and can store the pointer to the tree in the CXFA_SimpleParser. Change-Id: I5b478acbe61e6f1ca5fa04d03133a2b327a0cb1c Reviewed-on: https://pdfium-review.googlesource.com/30210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Merge CFX_XMLParser and CFX_XMLSyntaxParserDan Sinclair
The CFX_XMLParser was a wrapper around the CFX_XMLSyntaxParser. This CL merges the SyntaxParser into protected/private methods if the XMLParser. Change-Id: If1519b5de55866ed14359dffd64dc12c36ee0244 Reviewed-on: https://pdfium-review.googlesource.com/30171 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12Cleanup some CFX_XMLParser codeDan Sinclair
This CL cleans up minor nits in the CFX_XMLParser code. Change-Id: Ie19d12d3dcce16c9ce6088160ecdec3d9855c11f Reviewed-on: https://pdfium-review.googlesource.com/30170 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-12[xfa] Remove form checksum abilitiesDan Sinclair
This CL removes the code for verifying and creating checksums associated with form elements in XFA documents. This was the only code requiring the SAXReader which has also been removed. According to the XFA spec and application can decide which parts of the signatures are supported. This feature is being removed until we determine if/when it is needed. Bug: pdfium:1063 Change-Id: Iec2261282340f8fc72a1225d2e0d3e6ddf05edcb Reviewed-on: https://pdfium-review.googlesource.com/30150 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-04-11Remove CFX_DIBAttribute::m_strAuthorTom Sepez
It is set in a couple of places, but the value is never used for any purpose. Change-Id: I6fc0839bc14b21ee8217fcb3eadf6c252ad67aa7 Reviewed-on: https://pdfium-review.googlesource.com/30330 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-11Fix crash when ColorSpace references itself directly.Henrique Nakashima
Also fixes any problems with cycles between colorspaces. Past fixes have solved problems with CPDF_DocPageData::GetColorSpace() calling itself and CPDF_DocPageData::GetColorSpace() calling CPDF_ColorSpace::Load() and vice versa. They have not solved CPDF_ColorSpace::Load() calling itself. This CL repurposes the |pVisited| set to ensure CPDF_ColorSpace::Load() does not try to load a colorspace as a dependency of itself and creates |pVisitedLocal| to ensure CPDF_DocPageData::GetColorSpace() does not create a similar circular dependency not involving CPDF_ColorSpace::Load(). Bug: chromium:828206 Change-Id: Ib2d0ec494be169135607f3651e0f70627b26ebd7 Reviewed-on: https://pdfium-review.googlesource.com/29810 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-04-11Fix issues with PDFium third_party/base/span.hTom Sepez
Remove stray const in operator[] that was introduced when downgrading from C++14 to C++11 syntax. Add missing Get() in first() that was introduced when converting to UnownedPtr. Prevent ASAN from flagging spans where the UnownedPtr points to byte N+1 of a N byte object, and the span is empty. This is legal in C for ordinary pointers so long as the pointer isn't de-referenced, but is not allowed per the rules for UnownedPtr. Change-Id: Ic143c5ef4e37c1cf86f0a3e5408be6e2076a85e2 Reviewed-on: https://pdfium-review.googlesource.com/30212 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-11Remove use of GetBuffer()/ReleaseBuffer() when c_str() is sufficient.Tom Sepez
Greatly simplify the code which was neither changing allocations nor doing any actual work. Eventually GetBuffer() will return a span, and this makes fewer places to change. Comment AsFPDFWideString() as a place where we may want a redundant copy, and make available outside the .cpp file. Fix one "const" along the way. Change-Id: I187758b69a0ba3501b3622f6c06280793cd5d464 Reviewed-on: https://pdfium-review.googlesource.com/30011 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-11Make cxfa_fmlexer.cpp resilient to null stringsTom Sepez
As currently written, the calculation of m_end will underflow when passed a {nullptr, 0} pair as input, and m_end becomes essentially unbounded. Change-Id: Id3249b201c446555d9aa4fa04e6a3c94a357cd99 Reviewed-on: https://pdfium-review.googlesource.com/30230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-11Fix trailing whitespace handling in CPDF_StreamParser::ReadInlineStream()Tom Sepez
After advancing past whitespace, the buffer may become empty. We were checking too early. Bug: 831498 Test: covered by fuzzers Change-Id: I6796b4723a05c2bcafe495dc7bc648213aa9cc22 Reviewed-on: https://pdfium-review.googlesource.com/30191 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-11Reserve space to reduce memory operations while encoding barcodeRyan Harrison
In the test case from the bug, the majority of the time is being spent resizing Widestring internal buffers, since += is being called in a tight loop. Since the size of the input being mutated and stored is known, this CL reserves the space before hand to lower thrashing. This substantially improves runtime of this test case locally. BUG=chromium:802242 Change-Id: I5176dabc94634b4d6bc3e9425fe6469a5bf35a41 Reviewed-on: https://pdfium-review.googlesource.com/30190 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-04-11Add documentation about Valgrind LLD workaroundRyan Harrison
BUG=chromium:830706 Change-Id: I72ea6373d898953c10e523399655f1f630941b09 Reviewed-on: https://pdfium-review.googlesource.com/30110 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-04-11Avoid stack overflow when loading CPDF_Function.chromium/3395Henrique Nakashima
CPDF_StitchFuncs that reference each other create a Load() loop. Maintaining a set of the visited CPDF_Objects during a Load() call tree prevents that. Bug: chromium:830221 Change-Id: I6f494da16c6d79f05870ff85cff38ff8fe69ecfe Reviewed-on: https://pdfium-review.googlesource.com/30050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-04-10Add static_asserts for FX_RECT and FX_COLORREF.Lei Zhang
Make sure they match their win32 equivalent data types. Change-Id: I395054ce5c5ae110c78dbae30dd985fc498045fb Reviewed-on: https://pdfium-review.googlesource.com/30070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-10Load CIDToGIDMap stream for CID fonts if it exists.Lei Zhang
BUG=chromium:813705 Change-Id: I57265aad11d8f717f6ce33cc09241f4bef6381db Reviewed-on: https://pdfium-review.googlesource.com/29710 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>