From 33c4cdb4efbacb73151c982549151ea4e545eff8 Mon Sep 17 00:00:00 2001 From: tonikitoo Date: Mon, 8 Aug 2016 10:52:51 -0700 Subject: Add support to Document::URL property getter. As per the PDF specification at [1] " This property specifies the document's URL. ". IE/Acrobat supports it, and getting it implemented would be one step forward in order to support Acrobat JS script as the one in [2]. [1] http://partners.adobe.com/public/developer/en/acrobat/sdk/5186AcroJS.pdf [2] https://bugs.chromium.org/p/pdfium/issues/detail?id=492 BUG=492 Review-Url: https://codereview.chromium.org/2219183002 --- fpdfsdk/javascript/Document.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'fpdfsdk/javascript/Document.cpp') diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 9c680de906..161a5d09e9 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -91,6 +91,7 @@ JS_STATIC_PROP_ENTRY(path) JS_STATIC_PROP_ENTRY(producer) JS_STATIC_PROP_ENTRY(subject) JS_STATIC_PROP_ENTRY(title) +JS_STATIC_PROP_ENTRY(URL) JS_STATIC_PROP_ENTRY(zoom) JS_STATIC_PROP_ENTRY(zoomType) END_JS_STATIC_PROP() @@ -904,6 +905,18 @@ FX_BOOL Document::mouseY(IJS_Context* cc, return TRUE; } +FX_BOOL Document::URL(IJS_Context* cc, + CJS_PropValue& vp, + CFX_WideString& sError) { + if (vp.IsSetting()) { + CJS_Context* pContext = static_cast(cc); + sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); + return FALSE; + } + vp << m_pDocument->GetPath(); + return TRUE; +} + FX_BOOL Document::baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { -- cgit v1.2.3