Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: xfa/fxfa/fm2js/xfa_fm2jscontext.cpp

Issue 2053583003: xfa_fm2jscontext method cleanup - pt IX of IX (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" 7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h"
8 8
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 5500 matching lines...) Expand 10 before | Expand all | Expand 10 after
5511 args.GetReturnValue()->SetInteger((first == 0.0) ? 1 : 0); 5511 args.GetReturnValue()->SetInteger((first == 0.0) ? 1 : 0);
5512 } 5512 }
5513 5513
5514 // static 5514 // static
5515 void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, 5515 void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis,
5516 const CFX_ByteStringC& szFuncName, 5516 const CFX_ByteStringC& szFuncName,
5517 CFXJSE_Arguments& args) { 5517 CFXJSE_Arguments& args) {
5518 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 5518 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5519 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); 5519 v8::Isolate* pIsolate = pContext->GetScriptRuntime();
5520 int32_t argc = args.GetLength(); 5520 int32_t argc = args.GetLength();
5521 if ((argc == 4) || (argc == 5)) { 5521 if (argc < 4 || argc > 5) {
5522 FX_BOOL bIsStar = TRUE; 5522 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5523 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); 5523 return;
5524 CFX_ByteString bsAccessorName = args.GetUTF8String(1); 5524 }
5525 CFX_ByteString szName = args.GetUTF8String(2);
5526 int32_t iIndexFlags = args.GetInt32(3);
5527 int32_t iIndexValue = 0;
5528 if (argc > 4) {
5529 bIsStar = FALSE;
5530 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(4);
5531 iIndexValue = ValueToInteger(pThis, argIndex.get());
5532 }
5533 CFX_ByteString szSomExp;
5534 GenerateSomExpression(szName.AsStringC(), iIndexFlags, iIndexValue, bIsStar,
5535 szSomExp);
5536 if (argAccessor->IsArray()) {
5537 std::unique_ptr<CFXJSE_Value> pLengthValue(new CFXJSE_Value(pIsolate));
5538 argAccessor->GetObjectProperty("length", pLengthValue.get());
5539 int32_t iLength = pLengthValue->ToInteger();
5540 int32_t iCounter = 0;
5541 CFXJSE_Value*** hResolveValues = FX_Alloc(CFXJSE_Value**, iLength - 2);
5542 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2);
5543 for (int32_t i = 0; i < (iLength - 2); i++) {
5544 iSizes[i] = 0;
5545 }
5546 std::unique_ptr<CFXJSE_Value> hJSObjValue(new CFXJSE_Value(pIsolate));
5547 FX_BOOL bAttribute = FALSE;
5548 for (int32_t i = 2; i < iLength; i++) {
5549 argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
5550 XFA_RESOLVENODE_RS resoveNodeRS;
5551 int32_t iRet =
5552 ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(),
5553 resoveNodeRS, TRUE, szName.IsEmpty());
5554 if (iRet > 0) {
5555 ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
5556 hResolveValues[i - 2], iSizes[i - 2], bAttribute);
5557 iCounter += iSizes[i - 2];
5558 }
5559 }
5560 if (iCounter > 0) {
5561 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iCounter + 2);
5562 for (int32_t i = 0; i < (iCounter + 2); i++)
5563 rgValues[i] = new CFXJSE_Value(pIsolate);
5564 5525
5565 rgValues[0]->SetInteger(1); 5526 bool bIsStar = true;
5566 if (bAttribute) { 5527 int32_t iIndexValue = 0;
5567 rgValues[1]->SetString(szName.AsStringC()); 5528 if (argc > 4) {
5568 } else { 5529 bIsStar = false;
5569 rgValues[1]->SetNull(); 5530 iIndexValue = ValueToInteger(pThis, args.GetValue(4).get());
5570 } 5531 }
5571 int32_t iIndex = 2;
5572 for (int32_t i = 0; i < iLength - 2; i++) {
5573 for (int32_t j = 0; j < iSizes[i]; j++) {
5574 rgValues[iIndex]->Assign(hResolveValues[i][j]);
5575 iIndex++;
5576 }
5577 }
5578 args.GetReturnValue()->SetArray(iCounter + 2, rgValues);
5579 for (int32_t i = 0; i < (iCounter + 2); i++)
5580 delete rgValues[i];
5581 5532
5582 FX_Free(rgValues); 5533 CFX_ByteString szName = args.GetUTF8String(2);
5583 } else { 5534 CFX_ByteString szSomExp;
5584 CFX_WideString wsPropertyName = 5535 GenerateSomExpression(szName.AsStringC(), args.GetInt32(3), iIndexValue,
5585 CFX_WideString::FromUTF8(szName.AsStringC()); 5536 bIsStar, szSomExp);
5586 CFX_WideString wsSomExpression =
5587 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5588 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5589 wsPropertyName.c_str(),
5590 wsSomExpression.c_str());
5591 }
5592 for (int32_t i = 0; i < iLength - 2; i++) {
5593 for (int32_t j = 0; j < iSizes[i]; j++)
5594 delete hResolveValues[i][j];
5595 5537
5596 if (iSizes[i] > 0) { 5538 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
5597 FX_Free(hResolveValues[i]); 5539 if (argAccessor->IsArray()) {
5598 } 5540 std::unique_ptr<CFXJSE_Value> pLengthValue(new CFXJSE_Value(pIsolate));
5599 } 5541 argAccessor->GetObjectProperty("length", pLengthValue.get());
5600 FX_Free(hResolveValues); 5542 int32_t iLength = pLengthValue->ToInteger();
5601 FX_Free(iSizes); 5543 CFXJSE_Value*** hResolveValues = FX_Alloc(CFXJSE_Value**, iLength - 2);
5602 } else { 5544 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2);
5545 for (int32_t i = 0; i < (iLength - 2); i++)
5546 iSizes[i] = 0;
5547
5548 std::unique_ptr<CFXJSE_Value> hJSObjValue(new CFXJSE_Value(pIsolate));
5549 FX_BOOL bAttribute = FALSE;
5550 int32_t iCounter = 0;
5551 for (int32_t i = 2; i < iLength; i++) {
5552 argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
5553
5603 XFA_RESOLVENODE_RS resoveNodeRS; 5554 XFA_RESOLVENODE_RS resoveNodeRS;
5604 int32_t iRet = 0; 5555 if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(),
5605 if (argAccessor->IsObject() || 5556 resoveNodeRS, TRUE, szName.IsEmpty()) > 0) {
5606 (argAccessor->IsNull() && bsAccessorName.IsEmpty())) { 5557 ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
5607 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(), 5558 hResolveValues[i - 2], iSizes[i - 2], bAttribute);
5608 resoveNodeRS, TRUE, szName.IsEmpty()); 5559 iCounter += iSizes[i - 2];
5609 } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty()) {
5610 FX_BOOL bGetObject = GetObjectByName(pThis, argAccessor.get(),
5611 bsAccessorName.AsStringC());
5612 if (bGetObject) {
5613 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
5614 resoveNodeRS, TRUE, szName.IsEmpty());
5615 }
5616 }
5617 if (iRet > 0) {
5618 CFXJSE_Value** hResolveValues;
5619 int32_t iSize = 0;
5620 FX_BOOL bAttribute = FALSE;
5621 ParseResolveResult(pThis, resoveNodeRS, argAccessor.get(),
5622 hResolveValues, iSize, bAttribute);
5623 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iSize + 2);
5624 for (int32_t i = 0; i < (iSize + 2); i++)
5625 rgValues[i] = new CFXJSE_Value(pIsolate);
5626
5627 rgValues[0]->SetInteger(1);
5628 if (bAttribute) {
5629 rgValues[1]->SetString(szName.AsStringC());
5630 } else {
5631 rgValues[1]->SetNull();
5632 }
5633 for (int32_t i = 0; i < iSize; i++) {
5634 rgValues[i + 2]->Assign(hResolveValues[i]);
5635 }
5636 args.GetReturnValue()->SetArray(iSize + 2, rgValues);
5637 for (int32_t i = 0; i < (iSize + 2); i++)
5638 delete rgValues[i];
5639
5640 FX_Free(rgValues);
5641 for (int32_t i = 0; i < iSize; i++)
5642 delete hResolveValues[i];
5643
5644 FX_Free(hResolveValues);
5645 } else {
5646 CFX_WideString wsPropertyName =
5647 CFX_WideString::FromUTF8(szName.AsStringC());
5648 CFX_WideString wsSomExpression =
5649 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5650 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5651 wsPropertyName.c_str(),
5652 wsSomExpression.c_str());
5653 } 5560 }
5654 } 5561 }
5655 } else { 5562 if (iCounter < 1) {
5656 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); 5563 CFX_WideString wsPropertyName =
5564 CFX_WideString::FromUTF8(szName.AsStringC());
5565 CFX_WideString wsSomExpression =
5566 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5567 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5568 wsPropertyName.c_str(), wsSomExpression.c_str());
5569 return;
5570 }
5571
5572 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iCounter + 2);
5573 for (int32_t i = 0; i < (iCounter + 2); i++)
5574 rgValues[i] = new CFXJSE_Value(pIsolate);
5575
5576 rgValues[0]->SetInteger(1);
5577 if (bAttribute)
5578 rgValues[1]->SetString(szName.AsStringC());
5579 else
5580 rgValues[1]->SetNull();
5581
5582 int32_t iIndex = 2;
5583 for (int32_t i = 0; i < iLength - 2; i++) {
5584 for (int32_t j = 0; j < iSizes[i]; j++) {
5585 rgValues[iIndex]->Assign(hResolveValues[i][j]);
5586 iIndex++;
5587 }
5588 }
5589 args.GetReturnValue()->SetArray(iCounter + 2, rgValues);
5590
5591 for (int32_t i = 0; i < (iCounter + 2); i++)
5592 delete rgValues[i];
5593 FX_Free(rgValues);
5594
5595 for (int32_t i = 0; i < iLength - 2; i++) {
5596 for (int32_t j = 0; j < iSizes[i]; j++)
5597 delete hResolveValues[i][j];
5598
5599 if (iSizes[i] > 0)
5600 FX_Free(hResolveValues[i]);
5601 }
5602 FX_Free(hResolveValues);
5603 FX_Free(iSizes);
5604
5605 return;
5657 } 5606 }
5607
5608 XFA_RESOLVENODE_RS resoveNodeRS;
5609 int32_t iRet = 0;
5610 CFX_ByteString bsAccessorName = args.GetUTF8String(1);
5611 if (argAccessor->IsObject() ||
5612 (argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
5613 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
5614 resoveNodeRS, TRUE, szName.IsEmpty());
5615 } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() &&
5616 GetObjectByName(pThis, argAccessor.get(),
5617 bsAccessorName.AsStringC())) {
5618 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
5619 resoveNodeRS, TRUE, szName.IsEmpty());
5620 }
5621 if (iRet < 1) {
5622 CFX_WideString wsPropertyName =
5623 CFX_WideString::FromUTF8(szName.AsStringC());
5624 CFX_WideString wsSomExpression =
5625 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5626 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5627 wsPropertyName.c_str(), wsSomExpression.c_str());
5628 return;
5629 }
5630
5631 CFXJSE_Value** hResolveValues;
5632 int32_t iSize = 0;
5633 FX_BOOL bAttribute = FALSE;
5634 ParseResolveResult(pThis, resoveNodeRS, argAccessor.get(), hResolveValues,
5635 iSize, bAttribute);
5636 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iSize + 2);
5637 for (int32_t i = 0; i < (iSize + 2); i++)
5638 rgValues[i] = new CFXJSE_Value(pIsolate);
5639
5640 rgValues[0]->SetInteger(1);
5641 if (bAttribute)
5642 rgValues[1]->SetString(szName.AsStringC());
5643 else
5644 rgValues[1]->SetNull();
5645
5646 for (int32_t i = 0; i < iSize; i++)
5647 rgValues[i + 2]->Assign(hResolveValues[i]);
5648
5649 args.GetReturnValue()->SetArray(iSize + 2, rgValues);
5650 for (int32_t i = 0; i < (iSize + 2); i++)
5651 delete rgValues[i];
5652 FX_Free(rgValues);
5653
5654 for (int32_t i = 0; i < iSize; i++)
5655 delete hResolveValues[i];
5656 FX_Free(hResolveValues);
5658 } 5657 }
5659 5658
5660 // static 5659 // static
5661 void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, 5660 void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis,
5662 const CFX_ByteStringC& szFuncName, 5661 const CFX_ByteStringC& szFuncName,
5663 CFXJSE_Arguments& args) { 5662 CFXJSE_Arguments& args) {
5664 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 5663 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5665 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); 5664 v8::Isolate* pIsolate = pContext->GetScriptRuntime();
5666 int32_t argc = args.GetLength(); 5665 int32_t argc = args.GetLength();
5667 if ((argc == 4) || (argc == 5)) { 5666 if (argc < 4 || argc > 5) {
5668 FX_BOOL bIsStar = TRUE; 5667 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5669 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0); 5668 return;
5670 CFX_ByteString bsAccessorName = args.GetUTF8String(1); 5669 }
5671 CFX_ByteString szName = args.GetUTF8String(2);
5672 int32_t iIndexFlags = args.GetInt32(3);
5673 int32_t iIndexValue = 0;
5674 if (argc > 4) {
5675 bIsStar = FALSE;
5676 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(4);
5677 iIndexValue = ValueToInteger(pThis, argIndex.get());
5678 }
5679 CFX_ByteString szSomExp;
5680 GenerateSomExpression(szName.AsStringC(), iIndexFlags, iIndexValue, bIsStar,
5681 szSomExp);
5682 if (argAccessor->IsArray()) {
5683 std::unique_ptr<CFXJSE_Value> pLengthValue(new CFXJSE_Value(pIsolate));
5684 argAccessor->GetObjectProperty("length", pLengthValue.get());
5685 int32_t iLength = pLengthValue->ToInteger();
5686 int32_t iCounter = 0;
5687 CFXJSE_Value*** hResolveValues = FX_Alloc(CFXJSE_Value**, iLength - 2);
5688 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2);
5689 std::unique_ptr<CFXJSE_Value> hJSObjValue(new CFXJSE_Value(pIsolate));
5690 FX_BOOL bAttribute = FALSE;
5691 for (int32_t i = 2; i < iLength; i++) {
5692 argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
5693 XFA_RESOLVENODE_RS resoveNodeRS;
5694 int32_t iRet =
5695 ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(),
5696 resoveNodeRS, FALSE);
5697 if (iRet > 0) {
5698 ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
5699 hResolveValues[i - 2], iSizes[i - 2], bAttribute);
5700 iCounter += iSizes[i - 2];
5701 }
5702 }
5703 if (iCounter > 0) {
5704 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iCounter + 2);
5705 for (int32_t i = 0; i < (iCounter + 2); i++)
5706 rgValues[i] = new CFXJSE_Value(pIsolate);
5707 5670
5708 rgValues[0]->SetInteger(1); 5671 bool bIsStar = true;
5709 if (bAttribute) { 5672 int32_t iIndexValue = 0;
5710 rgValues[1]->SetString(szName.AsStringC()); 5673 if (argc > 4) {
5711 } else { 5674 bIsStar = false;
5712 rgValues[1]->SetNull(); 5675 iIndexValue = ValueToInteger(pThis, args.GetValue(4).get());
5713 } 5676 }
5714 int32_t iIndex = 2;
5715 for (int32_t i = 0; i < iLength - 2; i++) {
5716 for (int32_t j = 0; j < iSizes[i]; j++) {
5717 rgValues[iIndex]->Assign(hResolveValues[i][j]);
5718 iIndex++;
5719 }
5720 }
5721 args.GetReturnValue()->SetArray(iCounter + 2, rgValues);
5722 for (int32_t i = 0; i < (iCounter + 2); i++)
5723 delete rgValues[i];
5724 5677
5725 FX_Free(rgValues); 5678 CFX_ByteString szSomExp;
5726 } else { 5679 CFX_ByteString szName = args.GetUTF8String(2);
5727 CFX_WideString wsPropertyName = 5680 GenerateSomExpression(szName.AsStringC(), args.GetInt32(3), iIndexValue,
5728 CFX_WideString::FromUTF8(szName.AsStringC()); 5681 bIsStar, szSomExp);
5729 CFX_WideString wsSomExpression =
5730 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5731 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5732 wsPropertyName.c_str(),
5733 wsSomExpression.c_str());
5734 }
5735 for (int32_t i = 0; i < iLength - 2; i++) {
5736 for (int32_t j = 0; j < iSizes[i]; j++)
5737 delete hResolveValues[i][j];
5738 5682
5739 FX_Free(hResolveValues[i]); 5683 std::unique_ptr<CFXJSE_Value> argAccessor = args.GetValue(0);
5740 } 5684 if (argAccessor->IsArray()) {
5741 FX_Free(hResolveValues); 5685 std::unique_ptr<CFXJSE_Value> pLengthValue(new CFXJSE_Value(pIsolate));
5742 FX_Free(iSizes); 5686 argAccessor->GetObjectProperty("length", pLengthValue.get());
5743 } else { 5687 int32_t iLength = pLengthValue->ToInteger();
5688 int32_t iCounter = 0;
5689
5690 CFXJSE_Value*** hResolveValues = FX_Alloc(CFXJSE_Value**, iLength - 2);
5691 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2);
5692 std::unique_ptr<CFXJSE_Value> hJSObjValue(new CFXJSE_Value(pIsolate));
5693 FX_BOOL bAttribute = FALSE;
5694 for (int32_t i = 2; i < iLength; i++) {
5695 argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get());
5744 XFA_RESOLVENODE_RS resoveNodeRS; 5696 XFA_RESOLVENODE_RS resoveNodeRS;
5745 int32_t iRet = 0; 5697 if (ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(),
5746 if (argAccessor->IsObject() || 5698 resoveNodeRS, FALSE) > 0) {
5747 (argAccessor->IsNull() && bsAccessorName.IsEmpty())) { 5699 ParseResolveResult(pThis, resoveNodeRS, hJSObjValue.get(),
5748 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(), 5700 hResolveValues[i - 2], iSizes[i - 2], bAttribute);
5749 resoveNodeRS, FALSE); 5701 iCounter += iSizes[i - 2];
5750 } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty()) {
5751 FX_BOOL bGetObject = GetObjectByName(pThis, argAccessor.get(),
5752 bsAccessorName.AsStringC());
5753 if (bGetObject) {
5754 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
5755 resoveNodeRS, FALSE);
5756 }
5757 }
5758 if (iRet > 0) {
5759 CFXJSE_Value** hResolveValues;
5760 int32_t iSize = 0;
5761 FX_BOOL bAttribute = FALSE;
5762 ParseResolveResult(pThis, resoveNodeRS, argAccessor.get(),
5763 hResolveValues, iSize, bAttribute);
5764 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iSize + 2);
5765 for (int32_t i = 0; i < (iSize + 2); i++)
5766 rgValues[i] = new CFXJSE_Value(pIsolate);
5767
5768 rgValues[0]->SetInteger(1);
5769 if (bAttribute) {
5770 rgValues[1]->SetString(szName.AsStringC());
5771 } else {
5772 rgValues[1]->SetNull();
5773 }
5774 for (int32_t i = 0; i < iSize; i++) {
5775 rgValues[i + 2]->Assign(hResolveValues[i]);
5776 }
5777 args.GetReturnValue()->SetArray(iSize + 2, rgValues);
5778 for (int32_t i = 0; i < (iSize + 2); i++)
5779 delete rgValues[i];
5780
5781 FX_Free(rgValues);
5782 for (int32_t i = 0; i < iSize; i++)
5783 delete hResolveValues[i];
5784
5785 FX_Free(hResolveValues);
5786 } else {
5787 CFX_WideString wsPropertyName =
5788 CFX_WideString::FromUTF8(szName.AsStringC());
5789 CFX_WideString wsSomExpression =
5790 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5791 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5792 wsPropertyName.c_str(),
5793 wsSomExpression.c_str());
5794 } 5702 }
5795 } 5703 }
5796 } else { 5704 if (iCounter < 1) {
5797 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); 5705 CFX_WideString wsPropertyName =
5706 CFX_WideString::FromUTF8(szName.AsStringC());
5707 CFX_WideString wsSomExpression =
5708 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5709 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5710 wsPropertyName.c_str(), wsSomExpression.c_str());
5711 return;
5712 }
5713
5714 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iCounter + 2);
5715 for (int32_t i = 0; i < (iCounter + 2); i++)
5716 rgValues[i] = new CFXJSE_Value(pIsolate);
5717
5718 rgValues[0]->SetInteger(1);
5719 if (bAttribute)
5720 rgValues[1]->SetString(szName.AsStringC());
5721 else
5722 rgValues[1]->SetNull();
5723
5724 int32_t iIndex = 2;
5725 for (int32_t i = 0; i < iLength - 2; i++) {
5726 for (int32_t j = 0; j < iSizes[i]; j++) {
5727 rgValues[iIndex]->Assign(hResolveValues[i][j]);
5728 iIndex++;
5729 }
5730 }
5731 args.GetReturnValue()->SetArray(iCounter + 2, rgValues);
5732 for (int32_t i = 0; i < (iCounter + 2); i++)
5733 delete rgValues[i];
5734 FX_Free(rgValues);
5735
5736 for (int32_t i = 0; i < iLength - 2; i++) {
5737 for (int32_t j = 0; j < iSizes[i]; j++)
5738 delete hResolveValues[i][j];
5739 FX_Free(hResolveValues[i]);
5740 }
5741 FX_Free(hResolveValues);
5742 FX_Free(iSizes);
5743 return;
5798 } 5744 }
5745
5746 XFA_RESOLVENODE_RS resoveNodeRS;
5747 int32_t iRet = 0;
5748 CFX_ByteString bsAccessorName = args.GetUTF8String(1);
5749 if (argAccessor->IsObject() ||
5750 (argAccessor->IsNull() && bsAccessorName.IsEmpty())) {
5751 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
5752 resoveNodeRS, FALSE);
5753 } else if (!argAccessor->IsObject() && !bsAccessorName.IsEmpty() &&
5754 GetObjectByName(pThis, argAccessor.get(),
5755 bsAccessorName.AsStringC())) {
5756 iRet = ResolveObjects(pThis, argAccessor.get(), szSomExp.AsStringC(),
5757 resoveNodeRS, FALSE);
5758 }
5759 if (iRet < 1) {
5760 CFX_WideString wsPropertyName =
5761 CFX_WideString::FromUTF8(szName.AsStringC());
5762 CFX_WideString wsSomExpression =
5763 CFX_WideString::FromUTF8(szSomExp.AsStringC());
5764 pContext->ThrowException(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT,
5765 wsPropertyName.c_str(), wsSomExpression.c_str());
5766 return;
5767 }
5768
5769 CFXJSE_Value** hResolveValues;
5770 int32_t iSize = 0;
5771 FX_BOOL bAttribute = FALSE;
5772 ParseResolveResult(pThis, resoveNodeRS, argAccessor.get(), hResolveValues,
5773 iSize, bAttribute);
5774 CFXJSE_Value** rgValues = FX_Alloc(CFXJSE_Value*, iSize + 2);
5775 for (int32_t i = 0; i < (iSize + 2); i++)
5776 rgValues[i] = new CFXJSE_Value(pIsolate);
5777
5778 rgValues[0]->SetInteger(1);
5779 if (bAttribute)
5780 rgValues[1]->SetString(szName.AsStringC());
5781 else
5782 rgValues[1]->SetNull();
5783
5784 for (int32_t i = 0; i < iSize; i++)
5785 rgValues[i + 2]->Assign(hResolveValues[i]);
5786
5787 args.GetReturnValue()->SetArray(iSize + 2, rgValues);
5788
5789 for (int32_t i = 0; i < (iSize + 2); i++)
5790 delete rgValues[i];
5791 FX_Free(rgValues);
5792
5793 for (int32_t i = 0; i < iSize; i++)
5794 delete hResolveValues[i];
5795 FX_Free(hResolveValues);
5799 } 5796 }
5800 5797
5801 // static 5798 // static
5802 void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, 5799 void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis,
5803 const CFX_ByteStringC& szFuncName, 5800 const CFX_ByteStringC& szFuncName,
5804 CFXJSE_Arguments& args) { 5801 CFXJSE_Arguments& args) {
5805 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 5802 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5806 if (args.GetLength() == 1) { 5803 if (args.GetLength() != 1) {
5807 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
5808 CFX_ByteString argString;
5809 ValueToUTF8String(argOne.get(), argString);
5810 if (argString.IsEmpty()) {
5811 pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
5812 } else {
5813 CFX_WideString scriptString =
5814 CFX_WideString::FromUTF8(argString.AsStringC());
5815 CFX_WideTextBuf wsJavaScriptBuf;
5816 CFX_WideString wsError;
5817 CXFA_FM2JSContext::Translate(scriptString.AsStringC(), wsJavaScriptBuf,
5818 wsError);
5819 if (wsError.IsEmpty()) {
5820 CFX_WideString javaScript = wsJavaScriptBuf.MakeString();
5821 args.GetReturnValue()->SetString(
5822 FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength())
5823 .AsStringC());
5824 } else {
5825 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5826 }
5827 }
5828 } else {
5829 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Eval"); 5804 pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Eval");
5805 return;
5830 } 5806 }
5807
5808 std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0);
5809 CFX_ByteString argString;
5810 ValueToUTF8String(argOne.get(), argString);
5811 if (argString.IsEmpty()) {
5812 pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH);
5813 return;
5814 }
5815
5816 CFX_WideString scriptString = CFX_WideString::FromUTF8(argString.AsStringC());
5817 CFX_WideTextBuf wsJavaScriptBuf;
5818 CFX_WideString wsError;
5819 CXFA_FM2JSContext::Translate(scriptString.AsStringC(), wsJavaScriptBuf,
5820 wsError);
5821 if (!wsError.IsEmpty()) {
5822 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5823 return;
5824 }
5825
5826 CFX_WideString javaScript = wsJavaScriptBuf.MakeString();
5827 args.GetReturnValue()->SetString(
5828 FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).AsStringC());
5831 } 5829 }
5832 5830
5833 // static 5831 // static
5834 void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis, 5832 void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis,
5835 const CFX_ByteStringC& szFuncName, 5833 const CFX_ByteStringC& szFuncName,
5836 CFXJSE_Arguments& args) { 5834 CFXJSE_Arguments& args) {
5837 if (args.GetLength() == 1) { 5835 if (args.GetLength() != 1) {
5838 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5839 args.GetReturnValue()->SetBoolean(argOne->IsObject());
5840 } else {
5841 args.GetReturnValue()->SetBoolean(FALSE); 5836 args.GetReturnValue()->SetBoolean(FALSE);
5837 return;
5842 } 5838 }
5839
5840 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5841 args.GetReturnValue()->SetBoolean(argOne->IsObject());
5843 } 5842 }
5844 5843
5845 // static 5844 // static
5846 void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, 5845 void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis,
5847 const CFX_ByteStringC& szFuncName, 5846 const CFX_ByteStringC& szFuncName,
5848 CFXJSE_Arguments& args) { 5847 CFXJSE_Arguments& args) {
5849 if (args.GetLength() == 1) { 5848 if (args.GetLength() != 1) {
5850 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5851 args.GetReturnValue()->SetBoolean(argOne->IsArray());
5852 } else {
5853 args.GetReturnValue()->SetBoolean(FALSE); 5849 args.GetReturnValue()->SetBoolean(FALSE);
5850 return;
5854 } 5851 }
5852
5853 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5854 args.GetReturnValue()->SetBoolean(argOne->IsArray());
5855 } 5855 }
5856 5856
5857 // static 5857 // static
5858 void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, 5858 void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis,
5859 const CFX_ByteStringC& szFuncName, 5859 const CFX_ByteStringC& szFuncName,
5860 CFXJSE_Arguments& args) { 5860 CFXJSE_Arguments& args) {
5861 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 5861 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5862 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); 5862 if (args.GetLength() != 1) {
5863 if (args.GetLength() == 1) { 5863 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5864 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); 5864 return;
5865 if (argOne->IsArray()) { 5865 }
5866 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 5866
5867 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 5867 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5868 argOne->GetObjectPropertyByIdx(1, propertyValue.get()); 5868 if (argOne->IsArray()) {
5869 argOne->GetObjectPropertyByIdx(2, jsObjectValue.get()); 5869 v8::Isolate* pIsolate = pContext->GetScriptRuntime();
5870 if (propertyValue->IsNull()) { 5870 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
5871 GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue()); 5871 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
5872 } else { 5872 argOne->GetObjectPropertyByIdx(1, propertyValue.get());
5873 CFX_ByteString propertyStr; 5873 argOne->GetObjectPropertyByIdx(2, jsObjectValue.get());
5874 propertyValue->ToString(propertyStr); 5874 if (propertyValue->IsNull()) {
5875 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), 5875 GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue());
5876 args.GetReturnValue()); 5876 return;
5877 }
5878 } else if (argOne->IsObject()) {
5879 GetObjectDefaultValue(argOne.get(), args.GetReturnValue());
5880 } else {
5881 args.GetReturnValue()->Assign(argOne.get());
5882 } 5877 }
5883 } else { 5878
5884 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); 5879 CFX_ByteString propertyStr;
5880 propertyValue->ToString(propertyStr);
5881 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
5882 args.GetReturnValue());
5883 return;
5885 } 5884 }
5885
5886 if (argOne->IsObject()) {
5887 GetObjectDefaultValue(argOne.get(), args.GetReturnValue());
5888 return;
5889 }
5890
5891 args.GetReturnValue()->Assign(argOne.get());
5886 } 5892 }
5887 5893
5888 // static 5894 // static
5889 void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, 5895 void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis,
5890 const CFX_ByteStringC& szFuncName, 5896 const CFX_ByteStringC& szFuncName,
5891 CFXJSE_Arguments& args) { 5897 CFXJSE_Arguments& args) {
5892 if (args.GetLength() == 1) { 5898 if (args.GetLength() != 1) {
5893 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); 5899 ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR);
5894 if (argOne->IsArray()) { 5900 return;
5901 }
5902
5903 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5904 if (!argOne->IsArray()) {
5905 args.GetReturnValue()->Assign(argOne.get());
5906 return;
5907 }
5908
5895 #ifndef NDEBUG 5909 #ifndef NDEBUG
5896 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 5910 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5897 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); 5911 v8::Isolate* pIsolate = pContext->GetScriptRuntime();
5898 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 5912 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
5899 argOne->GetObjectProperty("length", lengthValue.get()); 5913 argOne->GetObjectProperty("length", lengthValue.get());
5900 ASSERT(lengthValue->ToInteger() >= 3); 5914 ASSERT(lengthValue->ToInteger() >= 3);
5901 #endif 5915 #endif
5902 argOne->GetObjectPropertyByIdx(2, args.GetReturnValue()); 5916
5903 } else { 5917 argOne->GetObjectPropertyByIdx(2, args.GetReturnValue());
5904 args.GetReturnValue()->Assign(argOne.get());
5905 }
5906 } else {
5907 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5908 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5909 }
5910 } 5918 }
5911 5919
5912 // static 5920 // static
5913 void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, 5921 void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis,
5914 const CFX_ByteStringC& szFuncName, 5922 const CFX_ByteStringC& szFuncName,
5915 CFXJSE_Arguments& args) { 5923 CFXJSE_Arguments& args) {
5916 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 5924 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
5925 if (args.GetLength() != 1) {
5926 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5927 return;
5928 }
5929
5917 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); 5930 v8::Isolate* pIsolate = pContext->GetScriptRuntime();
5918 if (args.GetLength() == 1) { 5931 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
5919 std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); 5932 if (!argOne->IsArray()) {
5920 if (argOne->IsArray()) { 5933 std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, args, 0);
5934 args.GetReturnValue()->Assign(simpleValue.get());
5935 return;
5936 }
5937
5921 #ifndef NDEBUG 5938 #ifndef NDEBUG
5922 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 5939 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
5923 argOne->GetObjectProperty("length", lengthValue.get()); 5940 argOne->GetObjectProperty("length", lengthValue.get());
5924 ASSERT(lengthValue->ToInteger() >= 3); 5941 ASSERT(lengthValue->ToInteger() >= 3);
5925 #endif 5942 #endif
5926 std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate));
5927 argOne->GetObjectPropertyByIdx(0, flagsValue.get());
5928 int32_t iFlags = flagsValue->ToInteger();
5929 if (iFlags == 4) {
5930 CFXJSE_Value* rgValues[3];
5931 for (int32_t i = 0; i < 3; i++)
5932 rgValues[i] = new CFXJSE_Value(pIsolate);
5933 5943
5934 rgValues[0]->SetInteger(3); 5944 std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate));
5935 rgValues[1]->SetNull(); 5945 argOne->GetObjectPropertyByIdx(0, flagsValue.get());
5936 rgValues[2]->SetNull(); 5946 int32_t iFlags = flagsValue->ToInteger();
5937 args.GetReturnValue()->SetArray(3, rgValues); 5947 if (iFlags != 3 && iFlags != 4) {
5938 for (int32_t i = 0; i < 3; i++) 5948 std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, args, 0);
5939 delete rgValues[i]; 5949 args.GetReturnValue()->Assign(simpleValue.get());
5940 } else if (iFlags == 3) { 5950 return;
5941 std::unique_ptr<CFXJSE_Value> objectValue(new CFXJSE_Value(pIsolate)); 5951 }
5942 argOne->GetObjectPropertyByIdx(2, objectValue.get()); 5952
5943 if (!objectValue->IsNull()) { 5953 if (iFlags == 4) {
5944 args.GetReturnValue()->Assign(argOne.get()); 5954 CFXJSE_Value* rgValues[3];
5945 } else { 5955 for (int32_t i = 0; i < 3; i++)
5946 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); 5956 rgValues[i] = new CFXJSE_Value(pIsolate);
5947 } 5957
5948 } else { 5958 rgValues[0]->SetInteger(3);
5949 std::unique_ptr<CFXJSE_Value> simpleValue = 5959 rgValues[1]->SetNull();
5950 GetSimpleValue(pThis, args, 0); 5960 rgValues[2]->SetNull();
5951 args.GetReturnValue()->Assign(simpleValue.get()); 5961 args.GetReturnValue()->SetArray(3, rgValues);
5952 } 5962 for (int32_t i = 0; i < 3; i++)
5953 } else { 5963 delete rgValues[i];
5954 std::unique_ptr<CFXJSE_Value> simpleValue = 5964
5955 GetSimpleValue(pThis, args, 0); 5965 return;
5956 args.GetReturnValue()->Assign(simpleValue.get()); 5966 }
5957 } 5967
5958 } else { 5968 std::unique_ptr<CFXJSE_Value> objectValue(new CFXJSE_Value(pIsolate));
5969 argOne->GetObjectPropertyByIdx(2, objectValue.get());
5970 if (objectValue->IsNull()) {
5959 pContext->ThrowException(XFA_IDS_COMPILER_ERROR); 5971 pContext->ThrowException(XFA_IDS_COMPILER_ERROR);
5972 return;
5960 } 5973 }
5974 args.GetReturnValue()->Assign(argOne.get());
5961 } 5975 }
5962 5976
5963 // static 5977 // static
5964 void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, 5978 void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis,
5965 const CFX_ByteStringC& szFuncName, 5979 const CFX_ByteStringC& szFuncName,
5966 CFXJSE_Arguments& args) { 5980 CFXJSE_Arguments& args) {
5967 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 5981 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
5968 uint32_t iLength = 0; 5982 uint32_t iLength = 0;
5969 int32_t argc = args.GetLength(); 5983 int32_t argc = args.GetLength();
5970 std::vector<std::unique_ptr<CFXJSE_Value>> argValues; 5984 std::vector<std::unique_ptr<CFXJSE_Value>> argValues;
5971 for (int32_t i = 0; i < argc; i++) { 5985 for (int32_t i = 0; i < argc; i++) {
5972 argValues.push_back(args.GetValue(i)); 5986 argValues.push_back(args.GetValue(i));
5973 if (argValues[i]->IsArray()) { 5987 if (argValues[i]->IsArray()) {
5974 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 5988 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
5975 argValues[i]->GetObjectProperty("length", lengthValue.get()); 5989 argValues[i]->GetObjectProperty("length", lengthValue.get());
5976 int32_t length = lengthValue->ToInteger(); 5990 int32_t length = lengthValue->ToInteger();
5977 iLength = iLength + ((length > 2) ? (length - 2) : 0); 5991 iLength = iLength + ((length > 2) ? (length - 2) : 0);
5978 } 5992 }
5979 iLength += 1; 5993 iLength += 1;
5980 } 5994 }
5995
5981 CFXJSE_Value** returnValues = FX_Alloc(CFXJSE_Value*, iLength); 5996 CFXJSE_Value** returnValues = FX_Alloc(CFXJSE_Value*, iLength);
5982 for (int32_t i = 0; i < (int32_t)iLength; i++) 5997 for (int32_t i = 0; i < (int32_t)iLength; i++)
5983 returnValues[i] = new CFXJSE_Value(pIsolate); 5998 returnValues[i] = new CFXJSE_Value(pIsolate);
5984 5999
5985 int32_t index = 0; 6000 int32_t index = 0;
5986 for (int32_t i = 0; i < argc; i++) { 6001 for (int32_t i = 0; i < argc; i++) {
5987 if (argValues[i]->IsArray()) { 6002 if (argValues[i]->IsArray()) {
5988 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 6003 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
5989 argValues[i]->GetObjectProperty("length", lengthValue.get()); 6004 argValues[i]->GetObjectProperty("length", lengthValue.get());
5990 int32_t length = lengthValue->ToInteger(); 6005 int32_t length = lengthValue->ToInteger();
(...skipping 12 matching lines...) Expand all
6003 FX_Free(returnValues); 6018 FX_Free(returnValues);
6004 } 6019 }
6005 6020
6006 // static 6021 // static
6007 std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( 6022 std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue(
6008 CFXJSE_Value* pThis, 6023 CFXJSE_Value* pThis,
6009 CFXJSE_Arguments& args, 6024 CFXJSE_Arguments& args,
6010 uint32_t index) { 6025 uint32_t index) {
6011 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6026 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6012 ASSERT(index < (uint32_t)args.GetLength()); 6027 ASSERT(index < (uint32_t)args.GetLength());
6028
6013 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); 6029 std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index);
6030 if (!argIndex->IsArray() && !argIndex->IsObject())
6031 return argIndex;
6032
6014 if (argIndex->IsArray()) { 6033 if (argIndex->IsArray()) {
6015 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 6034 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
6016 argIndex->GetObjectProperty("length", lengthValue.get()); 6035 argIndex->GetObjectProperty("length", lengthValue.get());
6017 int32_t iLength = lengthValue->ToInteger(); 6036 int32_t iLength = lengthValue->ToInteger();
6018 std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate)); 6037 std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate));
6019 if (iLength > 2) { 6038 if (iLength < 3) {
6020 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6021 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6022 argIndex->GetObjectPropertyByIdx(1, propertyValue.get());
6023 argIndex->GetObjectPropertyByIdx(2, jsObjectValue.get());
6024 if (propertyValue->IsNull()) {
6025 GetObjectDefaultValue(jsObjectValue.get(), simpleValue.get());
6026 } else {
6027 CFX_ByteString propertyStr;
6028 propertyValue->ToString(propertyStr);
6029 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6030 simpleValue.get());
6031 }
6032 } else {
6033 simpleValue.get()->SetUndefined(); 6039 simpleValue.get()->SetUndefined();
6040 return simpleValue;
6034 } 6041 }
6042
6043 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6044 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6045 argIndex->GetObjectPropertyByIdx(1, propertyValue.get());
6046 argIndex->GetObjectPropertyByIdx(2, jsObjectValue.get());
6047 if (propertyValue->IsNull()) {
6048 GetObjectDefaultValue(jsObjectValue.get(), simpleValue.get());
6049 return simpleValue;
6050 }
6051
6052 CFX_ByteString propertyStr;
6053 propertyValue->ToString(propertyStr);
6054 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6055 simpleValue.get());
6035 return simpleValue; 6056 return simpleValue;
6036 } else if (argIndex->IsObject()) {
6037 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate));
6038 GetObjectDefaultValue(argIndex.get(), defaultValue.get());
6039 return defaultValue;
6040 } else {
6041 return argIndex;
6042 } 6057 }
6058
6059 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate));
6060 GetObjectDefaultValue(argIndex.get(), defaultValue.get());
6061 return defaultValue;
6043 } 6062 }
6044 6063
6045 // static 6064 // static
6046 FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { 6065 FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) {
6066 if (!arg || arg->IsNull())
6067 return TRUE;
6068
6069 if (!arg->IsArray() && !arg->IsObject())
6070 return FALSE;
6071
6047 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6072 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6048 FX_BOOL isNull = FALSE; 6073 if (arg->IsArray()) {
6049 if (!arg || arg->IsNull()) {
6050 isNull = TRUE;
6051 } else if (arg->IsArray()) {
6052 int32_t iLength = hvalue_get_array_length(pThis, arg); 6074 int32_t iLength = hvalue_get_array_length(pThis, arg);
6053 if (iLength > 2) { 6075 if (iLength < 3)
6054 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 6076 return TRUE;
6055 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 6077
6056 arg->GetObjectPropertyByIdx(1, propertyValue.get()); 6078 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6057 arg->GetObjectPropertyByIdx(2, jsObjectValue.get()); 6079 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6058 if (propertyValue->IsNull()) { 6080 arg->GetObjectPropertyByIdx(1, propertyValue.get());
6059 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); 6081 arg->GetObjectPropertyByIdx(2, jsObjectValue.get());
6060 GetObjectDefaultValue(jsObjectValue.get(), defaultValue.get()); 6082 if (propertyValue->IsNull()) {
6061 if (defaultValue->IsNull()) { 6083 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate));
6062 isNull = TRUE; 6084 GetObjectDefaultValue(jsObjectValue.get(), defaultValue.get());
6063 } 6085 return defaultValue->IsNull();
6064 } else {
6065 CFX_ByteString propertyStr;
6066 propertyValue->ToString(propertyStr);
6067 std::unique_ptr<CFXJSE_Value> newPropertyValue(
6068 new CFXJSE_Value(pIsolate));
6069 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6070 newPropertyValue.get());
6071 if (newPropertyValue->IsNull()) {
6072 isNull = TRUE;
6073 }
6074 }
6075 } else {
6076 isNull = TRUE;
6077 } 6086 }
6078 } else if (arg->IsObject()) { 6087
6079 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); 6088 CFX_ByteString propertyStr;
6080 GetObjectDefaultValue(arg, defaultValue.get()); 6089 propertyValue->ToString(propertyStr);
6081 if (defaultValue->IsNull()) { 6090 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6082 isNull = TRUE; 6091 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6083 } 6092 newPropertyValue.get());
6093 return newPropertyValue->IsNull();
6084 } 6094 }
6085 return isNull; 6095
6096 std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate));
6097 GetObjectDefaultValue(arg, defaultValue.get());
6098 return defaultValue->IsNull();
6086 } 6099 }
6087 6100
6088 // static 6101 // static
6089 int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, 6102 int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis,
6090 CFXJSE_Value* arg) { 6103 CFXJSE_Value* arg) {
6091 if (!arg || !arg->IsArray()) 6104 if (!arg || !arg->IsArray())
6092 return 0; 6105 return 0;
6093 6106
6094 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6107 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6095 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 6108 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
6096 arg->GetObjectProperty("length", lengthValue.get()); 6109 arg->GetObjectProperty("length", lengthValue.get());
6097 return lengthValue->ToInteger(); 6110 return lengthValue->ToInteger();
6098 } 6111 }
6099 6112
6100 // static 6113 // static
6101 FX_BOOL CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis, 6114 FX_BOOL CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis,
6102 CFXJSE_Value* firstValue, 6115 CFXJSE_Value* firstValue,
6103 CFXJSE_Value* secondValue) { 6116 CFXJSE_Value* secondValue) {
6104 if (!firstValue) 6117 if (!firstValue)
6105 return FALSE; 6118 return FALSE;
6106 6119
6107 FX_BOOL bReturn = FALSE;
6108 if (firstValue->IsString()) { 6120 if (firstValue->IsString()) {
6109 CFX_ByteString firstString, secondString; 6121 CFX_ByteString firstString, secondString;
6110 ValueToUTF8String(firstValue, firstString); 6122 ValueToUTF8String(firstValue, firstString);
6111 ValueToUTF8String(secondValue, secondString); 6123 ValueToUTF8String(secondValue, secondString);
6112 bReturn = firstString == secondString; 6124 return firstString == secondString;
6113 } else if (firstValue->IsNumber()) { 6125 }
6126 if (firstValue->IsNumber()) {
6114 FX_FLOAT first = ValueToFloat(pThis, firstValue); 6127 FX_FLOAT first = ValueToFloat(pThis, firstValue);
6115 FX_FLOAT second = ValueToFloat(pThis, secondValue); 6128 FX_FLOAT second = ValueToFloat(pThis, secondValue);
6116 bReturn = (first == second); 6129 return (first == second);
6117 } else if (firstValue->IsBoolean()) {
6118 bReturn = (firstValue->ToBoolean() == secondValue->ToBoolean());
6119 } else if (firstValue->IsNull() && secondValue && secondValue->IsNull()) {
6120 bReturn = TRUE;
6121 } 6130 }
6122 return bReturn; 6131 if (firstValue->IsBoolean())
6132 return (firstValue->ToBoolean() == secondValue->ToBoolean());
6133
6134 return firstValue->IsNull() && secondValue && secondValue->IsNull();
6123 } 6135 }
6124 6136
6125 // static 6137 // static
6126 void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, 6138 void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis,
6127 CFXJSE_Arguments& args, 6139 CFXJSE_Arguments& args,
6128 CFXJSE_Value**& resultValues, 6140 CFXJSE_Value**& resultValues,
6129 int32_t& iCount, 6141 int32_t& iCount,
6130 int32_t iStart) { 6142 int32_t iStart) {
6143 iCount = 0;
6144
6131 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6145 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6132 iCount = 0;
6133 int32_t argc = args.GetLength(); 6146 int32_t argc = args.GetLength();
6134 std::vector<std::unique_ptr<CFXJSE_Value>> argsValue; 6147 std::vector<std::unique_ptr<CFXJSE_Value>> argsValue;
6135 for (int32_t i = 0; i < argc - iStart; i++) { 6148 for (int32_t i = 0; i < argc - iStart; i++) {
6136 argsValue.push_back(args.GetValue(i + iStart)); 6149 argsValue.push_back(args.GetValue(i + iStart));
6137 if (argsValue[i]->IsArray()) { 6150 if (argsValue[i]->IsArray()) {
6138 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 6151 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
6139 argsValue[i]->GetObjectProperty("length", lengthValue.get()); 6152 argsValue[i]->GetObjectProperty("length", lengthValue.get());
6140 int32_t iLength = lengthValue->ToInteger(); 6153 int32_t iLength = lengthValue->ToInteger();
6141 iCount += ((iLength > 2) ? (iLength - 2) : 0); 6154 iCount += ((iLength > 2) ? (iLength - 2) : 0);
6142 } else { 6155 } else {
6143 iCount += 1; 6156 iCount += 1;
6144 } 6157 }
6145 } 6158 }
6146 resultValues = FX_Alloc(CFXJSE_Value*, iCount); 6159 resultValues = FX_Alloc(CFXJSE_Value*, iCount);
6147 for (int32_t i = 0; i < iCount; i++) 6160 for (int32_t i = 0; i < iCount; i++)
6148 resultValues[i] = new CFXJSE_Value(pIsolate); 6161 resultValues[i] = new CFXJSE_Value(pIsolate);
6149 6162
6150 int32_t index = 0; 6163 int32_t index = 0;
6151 for (int32_t i = 0; i < argc - iStart; i++) { 6164 for (int32_t i = 0; i < argc - iStart; i++) {
6152 if (argsValue[i]->IsArray()) { 6165 if (argsValue[i]->IsArray()) {
6153 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 6166 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
6154 argsValue[i]->GetObjectProperty("length", lengthValue.get()); 6167 argsValue[i]->GetObjectProperty("length", lengthValue.get());
6155 int32_t iLength = lengthValue->ToInteger(); 6168 int32_t iLength = lengthValue->ToInteger();
6156 if (iLength > 2) { 6169 if (iLength < 3)
6157 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 6170 continue;
6158 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 6171
6159 argsValue[i]->GetObjectPropertyByIdx(1, propertyValue.get()); 6172 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6160 if (propertyValue->IsNull()) { 6173 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6161 for (int32_t j = 2; j < iLength; j++) { 6174 argsValue[i]->GetObjectPropertyByIdx(1, propertyValue.get());
6162 argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get()); 6175 if (propertyValue->IsNull()) {
6163 GetObjectDefaultValue(jsObjectValue.get(), resultValues[index]); 6176 for (int32_t j = 2; j < iLength; j++) {
6164 index++; 6177 argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get());
6165 } 6178 GetObjectDefaultValue(jsObjectValue.get(), resultValues[index]);
6166 } else { 6179 index++;
6167 CFX_ByteString propertyString; 6180 }
6168 propertyValue->ToString(propertyString); 6181 } else {
6169 for (int32_t j = 2; j < iLength; j++) { 6182 CFX_ByteString propertyString;
6170 argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get()); 6183 propertyValue->ToString(propertyString);
6171 jsObjectValue->GetObjectProperty(propertyString.AsStringC(), 6184 for (int32_t j = 2; j < iLength; j++) {
6172 resultValues[index]); 6185 argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get());
6173 index++; 6186 jsObjectValue->GetObjectProperty(propertyString.AsStringC(),
6174 } 6187 resultValues[index]);
6188 index++;
6175 } 6189 }
6176 } 6190 }
6177 } else if (argsValue[i]->IsObject()) { 6191 } else if (argsValue[i]->IsObject()) {
6178 GetObjectDefaultValue(argsValue[i].get(), resultValues[index]); 6192 GetObjectDefaultValue(argsValue[i].get(), resultValues[index]);
6179 index++; 6193 index++;
6180 } else { 6194 } else {
6181 resultValues[index]->Assign(argsValue[i].get()); 6195 resultValues[index]->Assign(argsValue[i].get());
6182 index++; 6196 index++;
6183 } 6197 }
6184 } 6198 }
(...skipping 18 matching lines...) Expand all
6203 return FALSE; 6217 return FALSE;
6204 6218
6205 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1); 6219 pNode->Script_Som_DefaultValue(hNewValue, TRUE, (XFA_ATTRIBUTE)-1);
6206 return TRUE; 6220 return TRUE;
6207 } 6221 }
6208 6222
6209 // static 6223 // static
6210 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName, 6224 void CXFA_FM2JSContext::GenerateSomExpression(const CFX_ByteStringC& szName,
6211 int32_t iIndexFlags, 6225 int32_t iIndexFlags,
6212 int32_t iIndexValue, 6226 int32_t iIndexValue,
6213 FX_BOOL bIsStar, 6227 bool bIsStar,
6214 CFX_ByteString& szSomExp) { 6228 CFX_ByteString& szSomExp) {
6215 if (bIsStar) { 6229 if (bIsStar) {
6216 szSomExp = szName + "[*]"; 6230 szSomExp = szName + "[*]";
6217 return; 6231 return;
6218 } 6232 }
6219 if (iIndexFlags == 0) { 6233 if (iIndexFlags == 0) {
6220 szSomExp = szName; 6234 szSomExp = szName;
6221 return; 6235 return;
6222 } 6236 }
6223 if (iIndexFlags == 1 || iIndexValue == 0) { 6237 if (iIndexFlags == 1 || iIndexValue == 0) {
(...skipping 11 matching lines...) Expand all
6235 szSomExp += CFX_ByteString::FormatInteger(iIndexValue); 6249 szSomExp += CFX_ByteString::FormatInteger(iIndexValue);
6236 szSomExp += "]"; 6250 szSomExp += "]";
6237 } 6251 }
6238 } 6252 }
6239 6253
6240 // static 6254 // static
6241 FX_BOOL CXFA_FM2JSContext::GetObjectByName( 6255 FX_BOOL CXFA_FM2JSContext::GetObjectByName(
6242 CFXJSE_Value* pThis, 6256 CFXJSE_Value* pThis,
6243 CFXJSE_Value* accessorValue, 6257 CFXJSE_Value* accessorValue,
6244 const CFX_ByteStringC& szAccessorName) { 6258 const CFX_ByteStringC& szAccessorName) {
6245 FX_BOOL bFlags = FALSE;
6246 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument(); 6259 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
6247 if (!pDoc) { 6260 if (!pDoc)
6248 return bFlags; 6261 return FALSE;
6249 } 6262
6250 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); 6263 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext();
6251 XFA_RESOLVENODE_RS resoveNodeRS; 6264 XFA_RESOLVENODE_RS resoveNodeRS;
6252 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | 6265 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
6253 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; 6266 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
6254 int32_t iRet = pScriptContext->ResolveObjects( 6267 int32_t iRet = pScriptContext->ResolveObjects(
6255 pScriptContext->GetThisObject(), 6268 pScriptContext->GetThisObject(),
6256 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, 6269 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS,
6257 dwFlags); 6270 dwFlags);
6258 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 6271 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
6259 accessorValue->Assign( 6272 accessorValue->Assign(
6260 pScriptContext->GetJSValueFromMap(resoveNodeRS.nodes.GetAt(0))); 6273 pScriptContext->GetJSValueFromMap(resoveNodeRS.nodes.GetAt(0)));
6261 bFlags = TRUE; 6274 return TRUE;
6262 } 6275 }
6263 return bFlags; 6276 return FALSE;
6264 } 6277 }
6265 6278
6266 // static 6279 // static
6267 int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis, 6280 int32_t CXFA_FM2JSContext::ResolveObjects(CFXJSE_Value* pThis,
6268 CFXJSE_Value* pRefValue, 6281 CFXJSE_Value* pRefValue,
6269 const CFX_ByteStringC& bsSomExp, 6282 const CFX_ByteStringC& bsSomExp,
6270 XFA_RESOLVENODE_RS& resoveNodeRS, 6283 XFA_RESOLVENODE_RS& resoveNodeRS,
6271 FX_BOOL bdotAccessor, 6284 FX_BOOL bdotAccessor,
6272 FX_BOOL bHasNoResolveName) { 6285 FX_BOOL bHasNoResolveName) {
6286 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
6287 if (!pDoc)
6288 return -1;
6289
6273 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp); 6290 CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(bsSomExp);
6274 int32_t iRet = -1;
6275 CXFA_Document* pDoc = ToJSContext(pThis, nullptr)->GetDocument();
6276 if (!pDoc) {
6277 return iRet;
6278 }
6279 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); 6291 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext();
6280 CXFA_Object* pNode = nullptr; 6292 CXFA_Object* pNode = nullptr;
6281 uint32_t dFlags = 0UL; 6293 uint32_t dFlags = 0UL;
6282 if (bdotAccessor) { 6294 if (bdotAccessor) {
6283 if (pRefValue && pRefValue->IsNull()) { 6295 if (pRefValue && pRefValue->IsNull()) {
6284 pNode = pScriptContext->GetThisObject(); 6296 pNode = pScriptContext->GetThisObject();
6285 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; 6297 dFlags = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
6286 } else { 6298 } else {
6287 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); 6299 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr);
6288 ASSERT(pNode); 6300 ASSERT(pNode);
6289 if (bHasNoResolveName) { 6301 if (bHasNoResolveName) {
6290 CFX_WideString wsName; 6302 CFX_WideString wsName;
6291 if (CXFA_Node* pXFANode = pNode->AsNode()) { 6303 if (CXFA_Node* pXFANode = pNode->AsNode())
6292 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 6304 pXFANode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
6293 } 6305
6294 if (wsName.IsEmpty()) { 6306 if (wsName.IsEmpty()) {
6295 CFX_WideStringC className; 6307 CFX_WideStringC className;
6296 pNode->GetClassName(className); 6308 pNode->GetClassName(className);
6297 wsName = FX_WSTRC(L"#") + className; 6309 wsName = FX_WSTRC(L"#") + className;
6298 } 6310 }
6299 wsSomExpression = wsName + wsSomExpression; 6311 wsSomExpression = wsName + wsSomExpression;
6300 dFlags = XFA_RESOLVENODE_Siblings; 6312 dFlags = XFA_RESOLVENODE_Siblings;
6301 } else { 6313 } else {
6302 dFlags = (bsSomExp == "*") 6314 dFlags = (bsSomExp == "*")
6303 ? (XFA_RESOLVENODE_Children) 6315 ? (XFA_RESOLVENODE_Children)
6304 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | 6316 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes |
6305 XFA_RESOLVENODE_Properties); 6317 XFA_RESOLVENODE_Properties);
6306 } 6318 }
6307 } 6319 }
6308 } else { 6320 } else {
6309 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr); 6321 pNode = CXFA_ScriptContext::ToObject(pRefValue, nullptr);
6310 dFlags = XFA_RESOLVENODE_AnyChild; 6322 dFlags = XFA_RESOLVENODE_AnyChild;
6311 } 6323 }
6312 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), 6324 return pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(),
6313 resoveNodeRS, dFlags); 6325 resoveNodeRS, dFlags);
6314 return iRet;
6315 } 6326 }
6316 6327
6317 // static 6328 // static
6318 void CXFA_FM2JSContext::ParseResolveResult( 6329 void CXFA_FM2JSContext::ParseResolveResult(
6319 CFXJSE_Value* pThis, 6330 CFXJSE_Value* pThis,
6320 const XFA_RESOLVENODE_RS& resoveNodeRS, 6331 const XFA_RESOLVENODE_RS& resoveNodeRS,
6321 CFXJSE_Value* pParentValue, 6332 CFXJSE_Value* pParentValue,
6322 CFXJSE_Value**& resultValues, 6333 CFXJSE_Value**& resultValues,
6323 int32_t& iSize, 6334 int32_t& iSize,
6324 FX_BOOL& bAttribute) { 6335 FX_BOOL& bAttribute) {
6336 iSize = 0;
6337 resultValues = nullptr;
6338
6325 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); 6339 CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr);
6326 v8::Isolate* pIsolate = pContext->GetScriptRuntime(); 6340 v8::Isolate* pIsolate = pContext->GetScriptRuntime();
6327 iSize = 0;
6328 resultValues = nullptr;
6329 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 6341 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
6330 bAttribute = FALSE; 6342 bAttribute = FALSE;
6331 iSize = resoveNodeRS.nodes.GetSize(); 6343 iSize = resoveNodeRS.nodes.GetSize();
6332 resultValues = FX_Alloc(CFXJSE_Value*, iSize); 6344 resultValues = FX_Alloc(CFXJSE_Value*, iSize);
6333 for (int32_t i = 0; i < iSize; i++) { 6345 for (int32_t i = 0; i < iSize; i++) {
6334 resultValues[i] = new CFXJSE_Value(pIsolate); 6346 resultValues[i] = new CFXJSE_Value(pIsolate);
6335 resultValues[i]->Assign( 6347 resultValues[i]->Assign(
6336 pContext->GetDocument()->GetScriptContext()->GetJSValueFromMap( 6348 pContext->GetDocument()->GetScriptContext()->GetJSValueFromMap(
6337 resoveNodeRS.nodes.GetAt(i))); 6349 resoveNodeRS.nodes.GetAt(i)));
6338 } 6350 }
6339 } else { 6351 return;
6340 CXFA_ValueArray objectProperties(pIsolate); 6352 }
6341 int32_t iRet = resoveNodeRS.GetAttributeResult(objectProperties); 6353
6342 bAttribute = (iRet == 0); 6354 CXFA_ValueArray objectProperties(pIsolate);
6343 if (bAttribute) { 6355 int32_t iRet = resoveNodeRS.GetAttributeResult(objectProperties);
6344 if (pParentValue && pParentValue->IsObject()) { 6356 bAttribute = (iRet == 0);
6345 iSize = 1; 6357 if (!bAttribute) {
6346 resultValues = FX_Alloc(CFXJSE_Value*, 1); 6358 iSize = iRet;
6347 resultValues[0] = new CFXJSE_Value(pIsolate); 6359 resultValues = FX_Alloc(CFXJSE_Value*, iSize);
6348 resultValues[0]->Assign(pParentValue); 6360 for (int32_t i = 0; i < iSize; i++) {
6349 } 6361 resultValues[i] = new CFXJSE_Value(pIsolate);
6350 } else { 6362 resultValues[i]->Assign(objectProperties[i]);
6351 iSize = iRet;
6352 resultValues = FX_Alloc(CFXJSE_Value*, iSize);
6353 for (int32_t i = 0; i < iSize; i++) {
6354 resultValues[i] = new CFXJSE_Value(pIsolate);
6355 resultValues[i]->Assign(objectProperties[i]);
6356 }
6357 } 6363 }
6364 return;
6358 } 6365 }
6366
6367 if (!pParentValue || !pParentValue->IsObject())
6368 return;
6369
6370 iSize = 1;
6371 resultValues = FX_Alloc(CFXJSE_Value*, 1);
6372 resultValues[0] = new CFXJSE_Value(pIsolate);
6373 resultValues[0]->Assign(pParentValue);
6359 } 6374 }
6360 6375
6361 // static 6376 // static
6362 int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, 6377 int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis,
6363 CFXJSE_Value* pValue) { 6378 CFXJSE_Value* pValue) {
6364 if (!pValue) 6379 if (!pValue)
6365 return 0; 6380 return 0;
6366 6381
6367 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6382 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6368 int32_t iValue = 0;
6369 if (pValue->IsArray()) { 6383 if (pValue->IsArray()) {
6370 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 6384 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6371 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 6385 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6372 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6386 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6373 pValue->GetObjectPropertyByIdx(1, propertyValue.get()); 6387 pValue->GetObjectPropertyByIdx(1, propertyValue.get());
6374 pValue->GetObjectPropertyByIdx(2, jsObjectValue.get()); 6388 pValue->GetObjectPropertyByIdx(2, jsObjectValue.get());
6375 if (propertyValue->IsNull()) { 6389 if (propertyValue->IsNull()) {
6376 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); 6390 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
6377 } else { 6391 return ValueToInteger(pThis, newPropertyValue.get());
6378 CFX_ByteString propertyStr;
6379 propertyValue->ToString(propertyStr);
6380 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6381 newPropertyValue.get());
6382 } 6392 }
6383 iValue = ValueToInteger(pThis, newPropertyValue.get()); 6393
6384 return iValue; 6394 CFX_ByteString propertyStr;
6385 } else if (pValue->IsObject()) { 6395 propertyValue->ToString(propertyStr);
6396 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6397 newPropertyValue.get());
6398 return ValueToInteger(pThis, newPropertyValue.get());
6399 }
6400 if (pValue->IsObject()) {
6386 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6401 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6387 GetObjectDefaultValue(pValue, newPropertyValue.get()); 6402 GetObjectDefaultValue(pValue, newPropertyValue.get());
6388 iValue = ValueToInteger(pThis, newPropertyValue.get()); 6403 return ValueToInteger(pThis, newPropertyValue.get());
6389 return iValue; 6404 }
6390 } else if (pValue->IsString()) { 6405 if (pValue->IsString()) {
6391 CFX_ByteString szValue; 6406 CFX_ByteString szValue;
6392 pValue->ToString(szValue); 6407 pValue->ToString(szValue);
6393 iValue = FXSYS_atoi(szValue.c_str()); 6408 return FXSYS_atoi(szValue.c_str());
6394 } else {
6395 iValue = pValue->ToInteger();
6396 } 6409 }
6397 return iValue; 6410 return pValue->ToInteger();
6398 } 6411 }
6399 6412
6400 // static 6413 // static
6401 FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, 6414 FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis,
6402 CFXJSE_Value* arg) { 6415 CFXJSE_Value* arg) {
6403 if (!arg) 6416 if (!arg)
6404 return 0.0f; 6417 return 0.0f;
6405 6418
6406 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6419 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6407 FX_FLOAT fRet = 0.0f;
6408 if (arg->IsArray()) { 6420 if (arg->IsArray()) {
6409 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 6421 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6410 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 6422 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6411 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6423 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6412 arg->GetObjectPropertyByIdx(1, propertyValue.get()); 6424 arg->GetObjectPropertyByIdx(1, propertyValue.get());
6413 arg->GetObjectPropertyByIdx(2, jsObjectValue.get()); 6425 arg->GetObjectPropertyByIdx(2, jsObjectValue.get());
6414 if (propertyValue->IsNull()) { 6426 if (propertyValue->IsNull()) {
6415 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); 6427 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
6416 } else { 6428 return ValueToFloat(pThis, newPropertyValue.get());
6417 CFX_ByteString propertyStr;
6418 propertyValue->ToString(propertyStr);
6419 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6420 newPropertyValue.get());
6421 } 6429 }
6422 fRet = ValueToFloat(pThis, newPropertyValue.get()); 6430 CFX_ByteString propertyStr;
6423 } else if (arg->IsObject()) { 6431 propertyValue->ToString(propertyStr);
6432 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6433 newPropertyValue.get());
6434 return ValueToFloat(pThis, newPropertyValue.get());
6435 }
6436 if (arg->IsObject()) {
6424 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6437 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6425 GetObjectDefaultValue(arg, newPropertyValue.get()); 6438 GetObjectDefaultValue(arg, newPropertyValue.get());
6426 fRet = ValueToFloat(pThis, newPropertyValue.get()); 6439 return ValueToFloat(pThis, newPropertyValue.get());
6427 } else if (arg->IsString()) { 6440 }
6441 if (arg->IsString()) {
6428 CFX_ByteString bsOutput; 6442 CFX_ByteString bsOutput;
6429 arg->ToString(bsOutput); 6443 arg->ToString(bsOutput);
6430 fRet = (FX_FLOAT)XFA_ByteStringToDouble(bsOutput.AsStringC()); 6444 return (FX_FLOAT)XFA_ByteStringToDouble(bsOutput.AsStringC());
6431 } else if (arg->IsUndefined()) {
6432 fRet = 0;
6433 } else {
6434 fRet = arg->ToFloat();
6435 } 6445 }
6436 return fRet; 6446 if (arg->IsUndefined())
6447 return 0;
6448
6449 return arg->ToFloat();
6437 } 6450 }
6438 6451
6439 // static 6452 // static
6440 FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, 6453 FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis,
6441 CFXJSE_Value* arg) { 6454 CFXJSE_Value* arg) {
6442 if (!arg) 6455 if (!arg)
6443 return 0; 6456 return 0;
6444 6457
6445 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime(); 6458 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6446 FX_DOUBLE dRet = 0;
6447 if (arg->IsArray()) { 6459 if (arg->IsArray()) {
6448 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 6460 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6449 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 6461 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6450 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6462 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6451 arg->GetObjectPropertyByIdx(1, propertyValue.get()); 6463 arg->GetObjectPropertyByIdx(1, propertyValue.get());
6452 arg->GetObjectPropertyByIdx(2, jsObjectValue.get()); 6464 arg->GetObjectPropertyByIdx(2, jsObjectValue.get());
6453 if (propertyValue->IsNull()) { 6465 if (propertyValue->IsNull()) {
6454 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); 6466 GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
6455 } else { 6467 return ValueToDouble(pThis, newPropertyValue.get());
6456 CFX_ByteString propertyStr;
6457 propertyValue->ToString(propertyStr);
6458 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6459 newPropertyValue.get());
6460 } 6468 }
6461 dRet = ValueToDouble(pThis, newPropertyValue.get()); 6469 CFX_ByteString propertyStr;
6462 } else if (arg->IsObject()) { 6470 propertyValue->ToString(propertyStr);
6471 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6472 newPropertyValue.get());
6473 return ValueToDouble(pThis, newPropertyValue.get());
6474 }
6475 if (arg->IsObject()) {
6463 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6476 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6464 GetObjectDefaultValue(arg, newPropertyValue.get()); 6477 GetObjectDefaultValue(arg, newPropertyValue.get());
6465 dRet = ValueToDouble(pThis, newPropertyValue.get()); 6478 return ValueToDouble(pThis, newPropertyValue.get());
6466 } else if (arg->IsString()) { 6479 }
6480 if (arg->IsString()) {
6467 CFX_ByteString bsOutput; 6481 CFX_ByteString bsOutput;
6468 arg->ToString(bsOutput); 6482 arg->ToString(bsOutput);
6469 dRet = XFA_ByteStringToDouble(bsOutput.AsStringC()); 6483 return XFA_ByteStringToDouble(bsOutput.AsStringC());
6470 } else if (arg->IsUndefined()) {
6471 dRet = 0;
6472 } else {
6473 dRet = arg->ToDouble();
6474 } 6484 }
6475 return dRet; 6485 if (arg->IsUndefined())
6486 return 0;
6487 return arg->ToDouble();
6476 } 6488 }
6477 6489
6478 // static. 6490 // static.
6479 double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, 6491 double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis,
6480 CFXJSE_Value* src, 6492 CFXJSE_Value* src,
6481 bool* ret) { 6493 bool* ret) {
6482 ASSERT(ret); 6494 ASSERT(ret);
6483
6484 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6485 *ret = true; 6495 *ret = true;
6486 6496
6487 if (!src) 6497 if (!src)
6488 return 0; 6498 return 0;
6489 6499
6490 if (src->IsArray()) { 6500 if (!src->IsArray())
6491 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); 6501 return ValueToDouble(pThis, src);
6492 src->GetObjectProperty("length", lengthValue.get());
6493 int32_t iLength = lengthValue->ToInteger();
6494 if (iLength <= 2) {
6495 *ret = false;
6496 return 0.0;
6497 }
6498 6502
6499 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); 6503 v8::Isolate* pIsolate = ToJSContext(pThis, nullptr)->GetScriptRuntime();
6500 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); 6504 std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate));
6501 src->GetObjectPropertyByIdx(1, propertyValue.get()); 6505 src->GetObjectProperty("length", lengthValue.get());
6502 src->GetObjectPropertyByIdx(2, jsObjectValue.get()); 6506 int32_t iLength = lengthValue->ToInteger();
6503 if (propertyValue->IsNull()) 6507 if (iLength <= 2) {
6504 return ValueToDouble(pThis, jsObjectValue.get()); 6508 *ret = false;
6509 return 0.0;
6510 }
6505 6511
6506 CFX_ByteString propertyStr; 6512 std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate));
6507 propertyValue->ToString(propertyStr); 6513 std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate));
6508 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); 6514 src->GetObjectPropertyByIdx(1, propertyValue.get());
6509 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), 6515 src->GetObjectPropertyByIdx(2, jsObjectValue.get());
6510 newPropertyValue.get()); 6516 if (propertyValue->IsNull())
6511 return ValueToDouble(pThis, newPropertyValue.get()); 6517 return ValueToDouble(pThis, jsObjectValue.get());
6512 } 6518
6513 return ValueToDouble(pThis, src); 6519 CFX_ByteString propertyStr;
6520 propertyValue->ToString(propertyStr);
6521 std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate));
6522 jsObjectValue->GetObjectProperty(propertyStr.AsStringC(),
6523 newPropertyValue.get());
6524 return ValueToDouble(pThis, newPropertyValue.get());
6514 } 6525 }
6515 6526
6516 // static 6527 // static
6517 void CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg, 6528 void CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg,
6518 CFX_ByteString& szOutputString) { 6529 CFX_ByteString& szOutputString) {
6519 if (!arg) 6530 if (!arg)
6520 return; 6531 return;
6521 6532
6522 if (arg->IsNull() || arg->IsUndefined()) { 6533 if (arg->IsNull() || arg->IsUndefined()) {
6523 szOutputString = ""; 6534 szOutputString = "";
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
6578 CFX_WideString wsFormat; 6589 CFX_WideString wsFormat;
6579 pAppProvider->LoadString(iStringID, wsFormat); 6590 pAppProvider->LoadString(iStringID, wsFormat);
6580 CFX_WideString wsMessage; 6591 CFX_WideString wsMessage;
6581 va_list arg_ptr; 6592 va_list arg_ptr;
6582 va_start(arg_ptr, iStringID); 6593 va_start(arg_ptr, iStringID);
6583 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); 6594 wsMessage.FormatV(wsFormat.c_str(), arg_ptr);
6584 va_end(arg_ptr); 6595 va_end(arg_ptr);
6585 FXJSE_ThrowMessage( 6596 FXJSE_ThrowMessage(
6586 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); 6597 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());
6587 } 6598 }
OLDNEW
« no previous file with comments | « xfa/fxfa/fm2js/xfa_fm2jscontext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698