pdfium.git
3 years agoDEPS include_rules no longer allows core/ -> fpsdfsk/ inclusion.
Tom Sepez [Fri, 16 Oct 2015 16:38:32 +0000]
DEPS include_rules no longer allows core/ -> fpsdfsk/ inclusion.

Adds the following new violations:
ERROR in core/include/fpdfapi/fpdf_parser.h
  Illegal include: "public/fpdfview.h"
ERROR in core/include/fpdfapi/fpdf_render.h
  Illegal include: "public/fpdf_progressive.h"
ERROR in core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp
  Illegal include: "public/fpdfview.h"

BUG=pdfium:217
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1411493002 .

3 years agoLoosen checking on the bytes following 'stream'
Jun Fang [Fri, 16 Oct 2015 02:45:01 +0000]
Loosen checking on the bytes following 'stream'

PDF specs say that end of line markers shall follow the
keyword "stream". But a white space before end of line
markers follows this keyword in the test pdf files.

BUG=543018
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1401923005 .

3 years agoMove conditionals inside target_defaults.
dan sinclair [Fri, 16 Oct 2015 01:44:11 +0000]
Move conditionals inside target_defaults.

This CL moves the conditionals inside the target_defaults configuration. This
causes the -fPIC to get picked up and allows component=shared_library to build
correctly.

BUG=pdfium:218
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407903002 .

3 years agoAdd some community and testing info to README.md.
dan sinclair [Fri, 16 Oct 2015 00:43:02 +0000]
Add some community and testing info to README.md.

This CL adds some more context to the README on the various test suites and
community mailing lists which are available.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1412453004 .

3 years agoPlug a leak in CPDF_StreamParser::ReadInlineStream
Oliver Chang [Thu, 15 Oct 2015 23:55:21 +0000]
Plug a leak in CPDF_StreamParser::ReadInlineStream

R=thestig@chromium.org, tsepez@chromium.org
BUG=pdfium:212

Review URL: https://codereview.chromium.org/1405203002 .

3 years agoIntroduce CPDFPageFromFPFDPage()
Tom Sepez [Thu, 15 Oct 2015 23:34:32 +0000]
Introduce CPDFPageFromFPFDPage()

Abstracts the way that pages are passed to the embedder
between XFA and master.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1406543004 .

3 years agoReturn result of GetRBG instead of TRUE
dan sinclair [Thu, 15 Oct 2015 23:26:15 +0000]
Return result of GetRBG instead of TRUE

Propagate the return value of GetRBG to the callers instead of forcing the
return of TRUE.

BUG=pdfium:44
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1398633008 .

3 years agoAdd steps for Contributing Code to README.md
Tom Sepez [Thu, 15 Oct 2015 22:54:16 +0000]
Add steps for Contributing Code to README.md

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1413493002 .

3 years agoFix layering violation in CPDF_Document::FromFPDFDocument().
Tom Sepez [Thu, 15 Oct 2015 21:51:42 +0000]
Fix layering violation in CPDF_Document::FromFPDFDocument().

Make this a function in the fpdfsdk/ layer, rather than a method
in the core/ layer. Nothing in core should know about public FPDF
types.

BUG=pdfium:217
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1396283006 .

3 years agoIntroduce CPDF_Document::FromFPDFDocument().
Tom Sepez [Wed, 14 Oct 2015 23:34:46 +0000]
Introduce CPDF_Document::FromFPDFDocument().

This will be used to abstract one major difference between master
and XFA, namely that the CPDF_Document is not a direct cast in XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1395493007 .

3 years agoNext round of master changes to match XFA
Tom Sepez [Wed, 14 Oct 2015 20:54:22 +0000]
Next round of master changes to match XFA

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1401423004 .

3 years agoLand temporary workaround for clang-cl not yet understanding __emul
Nico Weber [Wed, 14 Oct 2015 16:37:50 +0000]
Land temporary workaround for clang-cl not yet understanding __emul

BUG=543182
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1405553003 .

3 years agoAdd unit test for top-level bookmarks.
Tom Sepez [Wed, 14 Oct 2015 16:17:02 +0000]
Add unit test for top-level bookmarks.

Null FPDF_BOOKMARK represents the "root" bookmark, and must
not segv when asking about titles or children.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1404723002 .

3 years agoRoll DEPS for v8 to d3f97a9. Regular weekly roll.
Lei Zhang [Tue, 13 Oct 2015 23:04:01 +0000]
Roll DEPS for v8 to d3f97a9. Regular weekly roll.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1407643002 .

3 years agoRevert "Remove IPDFSDK_AnnotHandler interface."
Tom Sepez [Tue, 13 Oct 2015 22:22:20 +0000]
Revert "Remove IPDFSDK_AnnotHandler interface."

This reverts commit 633f1e436e1cced874a44a797f02c452eb3cf958.
This restores IPDFSDK_AnnotHandler, which is pointless on master
but useful on XFA. The small gain on master isn't worth the noise
when diffing to XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1408513002 .

3 years agoChanges to master to more closely match XFA.
Tom Sepez [Tue, 13 Oct 2015 22:17:46 +0000]
Changes to master to more closely match XFA.

These files should change in master in order to reduce the number of
"noise diffs" between master and XFA as seen in
    https://codereview.chromium.org/1399273003/

This includes: whitespace, matching header ordering, and implementing
a GetPageFromFPDFPage() from XFA.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1407583004 .

3 years agowstring allocations waste up to 7 wasted bytes.
Tom Sepez [Tue, 13 Oct 2015 19:02:11 +0000]
wstring allocations waste up to 7 wasted bytes.

Consequence of having the same code in two places;
fx_basic_bstring.cpp is correct, but fx_basic_wstring.cpp
is missing one small change.

Noticed while working on 542403, but this will not fix that
issue. It is just a space savings.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1399983003 .

3 years agoupgrade openjpeg to commit# cf352af
Jun Fang [Tue, 13 Oct 2015 07:28:55 +0000]
upgrade openjpeg to commit# cf352af

BUG=457480,497355
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1338973005 .

3 years agoSanitize CJBig2_SymbolDict's memory usage.
Lei Zhang [Fri, 9 Oct 2015 20:51:05 +0000]
Sanitize CJBig2_SymbolDict's memory usage.

- Use std::vector<JBig2ArithCtx> instead of storing pointers to arrays.
- Make CJBig2_SymbolDict's members private with accessors.
- Use std::vector<JBig2ArithCtx> in related places.
- Steal Chromium's vector_as_array() and use it as an adaptor as needed.

BUG=514891
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1388203003 .

3 years agoParallelize run_corpus_tests.py.
Lei Zhang [Fri, 9 Oct 2015 20:42:58 +0000]
Parallelize run_corpus_tests.py.

- Use the number of cores as the default -j value
- Fall back to old code for -j 1

R=nparker@chromium.org

Review URL: https://codereview.chromium.org/1398793003 .

3 years agoPass IJS_Runtime, not IJS_Context, to native object constructors.
Tom Sepez [Fri, 9 Oct 2015 20:14:47 +0000]
Pass IJS_Runtime, not IJS_Context, to native object constructors.

This better separates the two IJS_ classes, with the IJS_Context
taking on its proper role of describing an event. There's no need
for the event details for object creation, so this gets much
cleaner.

Move some JS error reporting code from CJS_Context to CJS_Runtime.
Make InitInstance() and ExitInstance() voids, they always return
TRUE and we never check the result anyways.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1389163007 .

3 years agoAllow compiling PDFium without V8.
Tom Sepez [Fri, 9 Oct 2015 19:45:15 +0000]
Allow compiling PDFium without V8.

Original patch from issue 1391843004 at patchset 1
(http://crrev.com/1391843004#ps1)

Introduce a pdf_enable_v8 GYP variable, which controls a
corresponding PDF_ENABLE_V8 #define, and bring in the real
JS library when set. Otherwise, link against a stub JS
runtime.

BUG=pdfium:211
R=dml@google.com, jochen@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1395733006 .

3 years agoFix a bad refactoring error from commit 8a9ce57.
Lei Zhang [Fri, 9 Oct 2015 17:04:37 +0000]
Fix a bad refactoring error from commit 8a9ce57.

BUG=541323
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1400773002 .

3 years agoFix a compiling error on Mac
Jun Fang [Fri, 9 Oct 2015 05:40:38 +0000]
Fix a compiling error on Mac

BUG=497357

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1395493003 .

3 years agoFix heap-buffer-overflow in color_sycc_to_rgb
Jun Fang [Fri, 9 Oct 2015 05:14:54 +0000]
Fix heap-buffer-overflow in color_sycc_to_rgb

It's a bug existing in the conversion from YUV420 to RGB.
For YUV 420 format, four pixels have 4 Y but only one U and
one V. In some cases, there are odd columns or lines in
some images. The pixels on last line or column may have Y
but no U or V data. For this case, We shall extend U or V
using the data on previous column or line.

BUG=497357
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1342683002 .

3 years agoMinimal revert from commit d03ba8d.
Lei Zhang [Thu, 8 Oct 2015 23:45:13 +0000]
Minimal revert from commit d03ba8d.

The values that were changed to size_t can go negative.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1400723002 .

3 years agoFix a bunch of sign mismatch warnings.
Lei Zhang [Thu, 8 Oct 2015 22:51:29 +0000]
Fix a bunch of sign mismatch warnings.

Also remove some gotos and move code into an anonymous namespace.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1356373003 .

3 years agoFix a malloc/delete mismatch introduced in commit 8a9ce57.
Lei Zhang [Thu, 8 Oct 2015 22:27:28 +0000]
Fix a malloc/delete mismatch introduced in commit 8a9ce57.

Just get rid of the malloc altogether and use CJBig2_List instead.

BUG=540873
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1394933002 .

3 years agoVarious changes to JBig2 cache:
David Lattimore [Thu, 8 Oct 2015 21:18:20 +0000]
Various changes to JBig2 cache:
- Makes the cache be per-document
- Keys the cache on ObjNum and stream offset instead of keying on a pointer to the data (which can result in false cache hits).
- Makes it so the cache is only used for the globals stream.
- Reenable the cache.

R=thestig@chromium.org

BUG=pdfium:207

Review URL: https://codereview.chromium.org/1380243004 .

3 years agoPut CJBig2_SymbolDict's images in a CJBig2_List container.
Lei Zhang [Thu, 8 Oct 2015 19:13:10 +0000]
Put CJBig2_SymbolDict's images in a CJBig2_List container.

Also mark it private.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1395613003 .

3 years agoWean CJS_Value off of v8::Isolate.
Tom Sepez [Thu, 8 Oct 2015 19:04:40 +0000]
Wean CJS_Value off of v8::Isolate.

CJS_Values should belong to CJS_Runtimes so that we may
eventually cram much of the v8 dependencies down into fxjs.

This is a first step; the remaining split in this code between
isolate and CJS_Runtime goes away when fxjs provides a CFXJS_Runtime
object, and the CJS_Runtime is-a/has-a CFXJS_Runtime. But that can't
happen until this is resolved.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1394103002 .

3 years agoRelax the check on 0 length streams.
Lei Zhang [Thu, 8 Oct 2015 17:34:28 +0000]
Relax the check on 0 length streams.

CPDF_SyntaxParser::ReadStream() originally created stream objects when
the length is 0. Commit 2526930 tightened the constraint and returned
NULL. This has some adverse affects, as seen in Chromium's print
preview of PDFs.

Instead, relax the constraint a little so when the length is 0, return a
CPDF_Stream with NULL data and size 0.

BUG=531835

Review URL: https://codereview.chromium.org/1394743002 .

3 years agoRemove some dead code from CCodec_Jbig2Module. Variable was only ever set to false.
David Lattimore [Wed, 7 Oct 2015 23:13:44 +0000]
Remove some dead code from CCodec_Jbig2Module. Variable was only ever set to false.

R=thestig@chromium.org

BUG=

Review URL: https://codereview.chromium.org/1393153002 .

3 years agoRename IFXJS_Runtime and IFXJS_Context to IJS_.
Tom Sepez [Wed, 7 Oct 2015 19:52:13 +0000]
Rename IFXJS_Runtime and IFXJS_Context to IJS_.

Nothing but sed.

FXJS is a layer that makes it easier to define objects in V8, but has
no knowledge of PDF-specific native objects.  It could in theory be used
to implement other sets of native objects.

JS is the layer that implements PDF-specific native objects on top of
FXJS.

Therefore, the classes used to interface to JS should be named using
IJS_. IFXJS_ is reserved for someday adding better API for FXJS iteslf.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1386173002 .

3 years agoUpdate README.md to reflect added .png support
Tom Sepez [Wed, 7 Oct 2015 19:33:31 +0000]
Update README.md to reflect added .png support

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1391023004 .

3 years agoStop inlining CJBig2_BitStream.
Lei Zhang [Wed, 7 Oct 2015 18:12:06 +0000]
Stop inlining CJBig2_BitStream.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1393823002 .

3 years agoFix the Windows build after commit 8a9ce57.
Lei Zhang [Wed, 7 Oct 2015 17:44:43 +0000]
Fix the Windows build after commit 8a9ce57.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1396533002 .

3 years agoRemove gotos in JBig2 code.
Lei Zhang [Wed, 7 Oct 2015 17:37:07 +0000]
Remove gotos in JBig2 code.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1382613003 .

3 years agoMove build instructions to README.md
Jochen Eisinger [Wed, 7 Oct 2015 09:20:58 +0000]
Move build instructions to README.md

That way, they'll be automatically displayed on gitiles

BUG=
R=andybons@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1378073003 .

3 years agoRoll DEPS for v8 to 9081ee1.
Lei Zhang [Tue, 6 Oct 2015 22:44:31 +0000]
Roll DEPS for v8 to 9081ee1.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1391733002 .

3 years agoFix include paths for fx_system.h
David Lattimore [Tue, 6 Oct 2015 22:20:13 +0000]
Fix include paths for fx_system.h

R=thestig@chromium.org

BUG=

Review URL: https://codereview.chromium.org/1390863002 .

3 years agoRemove unused global argument from FXJS_CONSTRUCTOR.
Tom Sepez [Tue, 6 Oct 2015 18:47:51 +0000]
Remove unused global argument from FXJS_CONSTRUCTOR.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1389003003 .

3 years agoStore object definition ID in each js_class.
Tom Sepez [Tue, 6 Oct 2015 18:10:52 +0000]
Store object definition ID in each js_class.

Avoids doing a lookup via FXJS_V8 for something already
known in CJS layer.

Also:
Consolidate repeated code in JS macros.
Remove knowledge that Document is global from FXJS layer

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1382263002 .

3 years agoRun FXJS_V8 embedder tests against a shared isolate.
Tom Sepez [Tue, 6 Oct 2015 15:53:13 +0000]
Run FXJS_V8 embedder tests against a shared isolate.

Start to back-fill some tests for the recent isolate work.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1377293004 .

3 years agoMake the vast majority of JS headers private to src/javascript.
Tom Sepez [Tue, 6 Oct 2015 14:50:47 +0000]
Make the vast majority of JS headers private to src/javascript.

The fpdfsdk/include/javascript/IJavascript.h is the sole API.
This required moving a creaton method to it from JS_Runtime.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1389783002 .

3 years agoFix regression in JBIG2 decoding from commit ce37d73.
Lei Zhang [Tue, 6 Oct 2015 06:02:25 +0000]
Fix regression in JBIG2 decoding from commit ce37d73.

many callers can tolerate CJBig2_ArithIntDecoder::decode() OOB failure.

BUG=539749, pdfium:209
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1384663007 .

3 years agoRemove JavaScript.h
Tom Sepez [Mon, 5 Oct 2015 23:18:28 +0000]
Remove JavaScript.h

It merely includes a bunch of other .h files which are handled
better since we fixed IWYU.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1385983002 .

3 years agoOriginal patch by forshaw.
Tom Sepez [Mon, 5 Oct 2015 19:57:17 +0000]
Original patch by forshaw.

Added a fallback Win32 font information class for win32k lockdown.
This is to support running PDFIUM within the Win32k lockdown by
removing dependancies on USER32/GDI for the font information code.
It falls back to using a freetype/directory enumeration implementation
if it detects the win32k system calls have been disabled by policy.

BUG=523278
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1306883002 .

3 years agoDisable JBIG2 cache; prevent data corruption - try 2.
Lei Zhang [Mon, 5 Oct 2015 17:16:20 +0000]
Disable JBIG2 cache; prevent data corruption - try 2.

Also change CJBig2_SymbolDict::DeepCopy() to return a unique_ptr to
prevent a potential leak if the cache size was 0.

BUG=pdfium:207
R=tsepez@chromium.org, jbreiden@google.com

Review URL: https://codereview.chromium.org/1374633004 .

3 years agoFix a leak with g_DefaultGlobalObjectTemplate.
Lei Zhang [Mon, 5 Oct 2015 03:42:33 +0000]
Fix a leak with g_DefaultGlobalObjectTemplate.

As seen when running FXJSV8Embeddertest.Getters.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1380993003 .

3 years agoRemove pointless CPDFSDK_PageView usage in CJS_Object / CJS_EmbedObj.
Lei Zhang [Mon, 5 Oct 2015 03:41:53 +0000]
Remove pointless CPDFSDK_PageView usage in CJS_Object / CJS_EmbedObj.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1374723004 .

3 years agoOnly call DefineJSObjects() once for the global V8 isolate.
Lei Zhang [Mon, 5 Oct 2015 03:40:15 +0000]
Only call DefineJSObjects() once for the global V8 isolate.

BUG=539106
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1386823002 .

3 years agoCJS_Timer should observe CJS_Runtime destruction.
Lei Zhang [Sun, 4 Oct 2015 23:01:52 +0000]
CJS_Timer should observe CJS_Runtime destruction.

Also remove dead CJS_EmbedObj::{Begin,End}Timer code.

BUG=539107
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1384883002 .

3 years agoFix NULL pointer dereference in CPDF_InterForm.
Lei Zhang [Sat, 3 Oct 2015 17:06:25 +0000]
Fix NULL pointer dereference in CPDF_InterForm.

BUG=537772
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1387703002 .

3 years agoRefcount external V8 isolate initialization / release.
Lei Zhang [Sat, 3 Oct 2015 17:00:24 +0000]
Refcount external V8 isolate initialization / release.

BUG=531339
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1377463005 .

3 years agoPass v8::Isolate to PDFium at init time.
Tom Sepez [Fri, 2 Oct 2015 23:43:15 +0000]
Pass v8::Isolate to PDFium at init time.

Move the external isolate and embedder slot from the
IPDF_JSPlatforms struct supplied at the
FPDFDOC_InitFormFillEnvironment() call time to arguments to
the FPDF_InitLibraryWithConfig() call.

This has several benefits:
-- Avoids the crash that could happen if multiple
FPDFDOC_InitFormFillEnvironmen() calls should happen to be
made by an embedder with different slot values.
-- Down the road, for XFA, there may be XFA but no FormFill
environment.

We support both forms for the time being, until the chrome
side catches up, at which point we will deprecate the old
way.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1367033002 .

3 years agoDo not call into formfiller code with a NULL PageView.
Lei Zhang [Fri, 2 Oct 2015 21:01:37 +0000]
Do not call into formfiller code with a NULL PageView.

BUG=537173
R=jun_fang@foxitsoftware.com, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1376093002 .

3 years agoGet rid of gotos in CPDF_SyntaxParser and FlateUncompress().
Lei Zhang [Fri, 2 Oct 2015 18:26:58 +0000]
Get rid of gotos in CPDF_SyntaxParser and FlateUncompress().

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1360103002 .

3 years agoPrevent divide by zeros in CJBig2_GSIDProc::decode_MMR().
Lei Zhang [Fri, 2 Oct 2015 17:58:42 +0000]
Prevent divide by zeros in CJBig2_GSIDProc::decode_MMR().

Check the image size before attempting to decode.

BUG=538103
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1377493005 .

3 years agoFix a leak in PDF_DataDecode() on failure.
Lei Zhang [Fri, 2 Oct 2015 17:56:30 +0000]
Fix a leak in PDF_DataDecode() on failure.

Found using the test examples from https://crbug.com/537780

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1376413003 .

3 years agoTurn a couple functions that always return true to return void.
Lei Zhang [Fri, 2 Oct 2015 17:29:50 +0000]
Turn a couple functions that always return true to return void.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1386463003 .

3 years agoFix PNG decoding divide by zero error due to zero row count.
Lei Zhang [Fri, 2 Oct 2015 17:27:44 +0000]
Fix PNG decoding divide by zero error due to zero row count.

BUG=537790
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1379243002 .

3 years agoCorrect mistakes in test case for 507316
Tom Sepez [Fri, 2 Oct 2015 16:05:53 +0000]
Correct mistakes in test case for 507316

Original patch by chamalsl.

Trailer size in bug_507316 was wrong.

embedder_test.cpp's GetPageTrampoline passed null parameter.
It will affect future test cases even if it does not affect
this.

BUG=507316
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1377403003 .

3 years agoFix static initializer in fxjs_v8.cpp
Tom Sepez [Fri, 2 Oct 2015 00:40:14 +0000]
Fix static initializer in fxjs_v8.cpp

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1372103004 .

3 years agoDisable JBIG2 cache; prevent data corruption
Lei Zhang [Thu, 1 Oct 2015 22:12:49 +0000]
Disable JBIG2 cache; prevent data corruption

BUG=pdfium:207

Original author: jbreiden@google.com
Original CL: http://codereview.chromium.org/1362133003/

R=jbreiden@google.com

Review URL: https://codereview.chromium.org/1382073002 .

3 years agoClean up some image decoder classes:
Lei Zhang [Thu, 1 Oct 2015 20:49:28 +0000]
Clean up some image decoder classes:

- Use std::vector<uint8_t> instead of raw uint8_t*
- Make ICodec_ScanlineDecoder::GetScanline() return const uint8_t*
- Add FxFreeDeleter, use it in CCodec_ImageDataCache.
- Make CCodec_ImageDataCache encapsulate its data members.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1361053002 .

3 years agoCleanup JBig2_ArithIntDecoder.
Lei Zhang [Thu, 1 Oct 2015 20:16:29 +0000]
Cleanup JBig2_ArithIntDecoder.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1359013003 .

3 years agoRevert "Leak per-isolate data in pdfium"
Raymes Khoury [Thu, 1 Oct 2015 05:12:08 +0000]
Revert "Leak per-isolate data in pdfium"

This reverts commit 3e144b8c23d7c52ed36329e87f0cb01f38ec1ed7.

This may be causing the failures seen in crbug.com/537799.

BUG=537799

Review URL: https://codereview.chromium.org/1382433003 .

3 years agoAdd signatures to FXJS_V8.
Tom Sepez [Wed, 30 Sep 2015 22:39:57 +0000]
Add signatures to FXJS_V8.

BUG=chromium:529012
R=jochen@chromium.org, krasin@google.com

Review URL: https://codereview.chromium.org/1353193004 .

3 years agoLeak per-isolate data in pdfium
Raymes Khoury [Wed, 30 Sep 2015 09:46:41 +0000]
Leak per-isolate data in pdfium

Right now we're freeing per-isolate data everytime a document is destroyed even
though it may be in use by other documents. For now we leak the per-isolate
data until crbug.com/531339 is fixed.

BUG=531339
R=jochen@chromium.org

Review URL: https://codereview.chromium.org/1372353002 .

Patch from Raymes Khoury <raymes@chromium.org>.

3 years agoCleanup CJBig2_ArithDecoder.
Lei Zhang [Wed, 30 Sep 2015 04:14:58 +0000]
Cleanup CJBig2_ArithDecoder.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1368153003 .

3 years agoRoll DEPS for v8 to d7f813b.
Lei Zhang [Tue, 29 Sep 2015 22:28:43 +0000]
Roll DEPS for v8 to d7f813b.

TBR=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1380663003 .

3 years agoRefactor some common code for bounding boxes.
Lei Zhang [Tue, 29 Sep 2015 21:34:22 +0000]
Refactor some common code for bounding boxes.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1373333002 .

3 years agoFix blank page issue caused by too strict correction on bpc
Jun Fang [Tue, 29 Sep 2015 02:24:54 +0000]
Fix blank page issue caused by too strict correction on bpc

For bit per component (bpc), PDF spec mentions that a RunLengthDecode or DCTDecode filter shall always deliver 8-bit samples. However, some PDF files don't follow this rule. We can find that filter is RunLengthDecode but bpc is 1 in the provided test file. In this case, pdfium will correct bpc to 8 but the actual bpc is 1. It causes a failure because the data is much more than the expected. To handle this case, pdfium doesn't correct bpc to 8 when the original bpc is 1.

BUG=512557
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1328213002 .

3 years agoCleanup some fx_codec_fax.cpp code.
Lei Zhang [Mon, 28 Sep 2015 18:52:19 +0000]
Cleanup some fx_codec_fax.cpp code.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1367633005 .

3 years agoFix test diff caused by v8 version update
Tom Sepez [Mon, 28 Sep 2015 17:20:16 +0000]
Fix test diff caused by v8 version update

Also changes DEPS to specify a specific v8 version, this will
require us to manually update this version from time to time,
but also solves a longstanding problem where going back to an
older version (say for bisecting) wouldn't always work.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1372963003 .

3 years agoIntroduce kPerIsolateDataIndex and tidy JS_Define.h
Tom Sepez [Mon, 28 Sep 2015 16:44:56 +0000]
Introduce kPerIsolateDataIndex and tidy JS_Define.h

Follow-up from https://codereview.chromium.org/1366053003/

- use kPerIsolateDataIndex rather than magic constant 1.
- make a helper function for common code in JS_Define.h
- remove dead prototypes missed in earlier CL.
- fxjs_v8 can't include generic fpdfsdk includes (layering).

R=jochen@chromium.org

Review URL: https://codereview.chromium.org/1367813003 .

3 years agoAdd Mac-specific pixel test expectations.
Lei Zhang [Sat, 26 Sep 2015 05:18:23 +0000]
Add Mac-specific pixel test expectations.

The font is slightly different from Linux/Windows.

BUG=524043
R=jun_fang@foxitsoftware.com

Review URL: https://codereview.chromium.org/1366363002 .

3 years agoRevert "Revert "Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files""
Jun Fang [Sat, 26 Sep 2015 05:03:26 +0000]
Revert "Revert "Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files""

This reverts commit fa9756f77ad6145940d3dc697814b84f5755ae17.

TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1307353005/

3 years agoRevert "Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files"
Jun Fang [Sat, 26 Sep 2015 04:12:51 +0000]
Revert "Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files"

This reverts commit 9bd18183ba8210c91d71c3060146235750a4c71c.

3 years agoFix the issue that pdfium swallows 'fi' or 'ff' in some pdf files
Jun Fang [Sat, 26 Sep 2015 03:32:46 +0000]
Fix the issue that pdfium swallows 'fi' or 'ff' in some pdf files

Pdfium swallows 'fi' or 'ff' in some tested files because it doesn't load the embedded font file correctly. The root cause is that there is incorrect keyword like 'ngendstream' in the stream of the embedded font file. Pdfium tries to find another correct keyword but uses wrong offset rather than accumulated offset.

BUG=524043
R=thestig@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1307353005 .

3 years agoRevert "Revert "Merge to master: contention over isolate data slots""
Tom Sepez [Fri, 25 Sep 2015 16:29:47 +0000]
Revert "Revert "Merge to master: contention over isolate data slots""

This reverts commit 3b4382a847b5a7439a3107512dbe54c317108579.
The difference between this CL and the one that failed is
fxjs_v8.cpp:271. In master, we pass the runtime information
as:
  v8::isolate -> v8::Context -> FXJS Runtime,

but in XFA:
  V8::Isolate -> PerIsolate struct -> FXJS Runtime.

The master way is more correct, in that FXJS_Runtime is 1:1
with v8 contexts and many:1 (in theory) with isolates.
It looks like the XFA branch missed a patch along the way.
I'll do that next.

Having made this change, the only data in the per-isolate
struct will be the ptr array (on master); it will also
include the XFA context (on XFA). I've kept the struct on
master for the sake of similarity.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1365733003 .

3 years agoFix a leak in CJBig2_Context.
Lei Zhang [Thu, 24 Sep 2015 19:56:29 +0000]
Fix a leak in CJBig2_Context.

- Remove dead code
- Use unique_ptr

BUG=pdfium:202
R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1365903002 .

3 years agoSplit up JBig2_GeneralDecoder.cpp.
Lei Zhang [Thu, 24 Sep 2015 08:09:57 +0000]
Split up JBig2_GeneralDecoder.cpp.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1359233002 .

3 years agoFix a leak in CJBig2_CachePair.
Lei Zhang [Wed, 23 Sep 2015 23:50:51 +0000]
Fix a leak in CJBig2_CachePair.

R=jbreiden@google.com

Review URL: https://codereview.chromium.org/1346043003 .

3 years agoFlip conditionals to positive logic in pdfium_test.
Lei Zhang [Wed, 23 Sep 2015 22:10:05 +0000]
Flip conditionals to positive logic in pdfium_test.

Also merge a check for failed document loads from XFA.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1362143002 .

3 years agoFix a couple potential file handle leaks in pdfium_test.
Lei Zhang [Wed, 23 Sep 2015 21:26:51 +0000]
Fix a couple potential file handle leaks in pdfium_test.

Fix lint issues / git cl format.

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1357423006 .

3 years agoChange nonstd::unique_ptr to take a custom deleter.
Lei Zhang [Wed, 23 Sep 2015 02:15:49 +0000]
Change nonstd::unique_ptr to take a custom deleter.

Code is mostly stolen from Chromium's scoped_ptr.

- Add unit tests.
- Use this to fix a leak.

BUG=chromium:531408
R=jyasskin@chromium.org, tsepez@chromium.org

Review URL: https://codereview.chromium.org/1351383004 .

3 years agoRevert "Merge to master: contention over isolate data slots"
Tom Sepez [Tue, 22 Sep 2015 22:54:26 +0000]
Revert "Merge to master: contention over isolate data slots"

Reason for revert: embeddertests failed.
This reverts commit 70bc04b16646c92f221c5aa56831b01d6ec7c1ca.

TBR=thestig@chromium.org

Review URL: https://codereview.chromium.org/1358263004 .

3 years agoMerge to master: contention over isolate data slots
Tom Sepez [Tue, 22 Sep 2015 22:49:14 +0000]
Merge to master: contention over isolate data slots

Work on this was first performed on the XFA branch, since
it has additional requirements (FXJSE layer) that needed
to be accomodated by the solution.

(cherry picked from commit ed7b2b50aa1744e0bc5a60bef12c61fa91d863b7)
Original Review URL: https://codereview.chromium.org/1351173002 .

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1354593004 .

3 years agoUse std::set<> to track active event handlers.
Tom Sepez [Tue, 22 Sep 2015 22:39:15 +0000]
Use std::set<> to track active event handlers.

This avoids some custom linked-list code. Also note that
we use a local copy to be sure we removed the same thing
that was added no matter how our callees may muck with the
handler.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1352393003 .

3 years agoAdd nonstd::unique_ptr move assigment operator.
Tom Sepez [Tue, 22 Sep 2015 22:06:59 +0000]
Add nonstd::unique_ptr move assigment operator.

std::unique_ptr supports move assignment as in:
  ptr2 = std::move(ptr1);

R=jyasskin@chromium.org

Review URL: https://codereview.chromium.org/1358163002 .

3 years agoAdd missing 'return' keyword.
Lei Zhang [Tue, 22 Sep 2015 20:45:00 +0000]
Add missing 'return' keyword.

Discovered with experimental Clang plugin that flags temporary objects
that are immediately destroyed.

patch from issue 1359063003 at patchset 1 (http://crrev.com/1359063003#ps1)

A=mdempsky@chromium.org
R=mdempsky@chromium.org

Review URL: https://codereview.chromium.org/1359103002 .

3 years ago[Docs] Add wiki content to Markdown docs
Tom Sepez [Tue, 22 Sep 2015 15:50:20 +0000]
[Docs] Add wiki content to Markdown docs

BUG=none
R=tsepez@chromium.org, jam@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/1356323002 .

3 years agoRemove CJS_RuntimeFactory
Tom Sepez [Mon, 21 Sep 2015 23:29:20 +0000]
Remove CJS_RuntimeFactory

The Factory Design Pattern isn't buying us anything here over just new'ing
the object we want.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1360523004 .

3 years agoMore tidy of CJS_Object, kill implicit cast operator
Tom Sepez [Mon, 21 Sep 2015 16:01:56 +0000]
More tidy of CJS_Object, kill implicit cast operator

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1349423006 .

3 years agoDon't pass null isolates to FXJS_ when we have a real isolate.
Tom Sepez [Thu, 17 Sep 2015 22:30:14 +0000]
Don't pass null isolates to FXJS_ when we have a real isolate.

Kill some now unused functions as a result.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1350703003 .

3 years agoFix a #include in fpdf_page_func.cpp.
David Lattimore [Thu, 17 Sep 2015 21:39:39 +0000]
Fix a #include in fpdf_page_func.cpp.

Not sure why building with gyp was working despite the missing '../' but
it wasn't working in stricter build systems.

BUG=
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1321293003.

3 years agoRemove several dead functions from fxjs_v8.{cpp,h}.
Tom Sepez [Wed, 16 Sep 2015 22:16:42 +0000]
Remove several dead functions from fxjs_v8.{cpp,h}.

Re-arrange things in the header so function overloads are
next to each other, and related things are near each other.

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1348693003 .

3 years agoMake pdfium_embeddertests link in debug component builds.
Nico Weber [Wed, 16 Sep 2015 20:53:42 +0000]
Make pdfium_embeddertests link in debug component builds.

Target v8 has:

          'direct_dependent_settings': {
            'defines': [
              'V8_SHARED',
              'USING_V8_SHARED',
            ],
          },

For this to work, targets using v8 headers have to depend on v8
directly, else the V8_EXPORT macro won't work. Add a direct
dependency on v8.

BUG=none
TEST=do a debug component build of pdfium_embeddertests on Win,
should work without linker errors

R=tsepez@chromium.org

Review URL: https://codereview.chromium.org/1349843002 .