Package org.chromium.sdk

Examples of org.chromium.sdk.JsValue


  public void reloadBiggerValue(final ReloadValueCallback callback) {
    List<JsValue> jsValueList = new ArrayList<JsValue>(2);
    if (this.value.isTruncated()) {
      jsValueList.add(this.value);
    }
    JsValue detailValue = detailBuilder.getCurrentDetailWrapper().getJsValue();
    if (detailValue != null && detailValue.isTruncated() && !jsValueList.contains(detailValue)) {
      jsValueList.add(detailValue);
    }

    ReloadBiggerValueProcess process = new ReloadBiggerValueProcess(callback);
    process.start(jsValueList);
View Full Code Here


    }
  }

  public JsObjectProperty createObjectProperty(final PropertyDescriptorValue propertyDescriptor,
      final String hostObjectRefId, String name) {
    JsValue jsValue = wrap(propertyDescriptor.value());

    final JsValue getter = wrap(propertyDescriptor.get());

    final JsValue setter = wrap(propertyDescriptor.set());

    return new ObjectPropertyBase(jsValue, name) {
      @Override public boolean isWritable() {
        return propertyDescriptor.writable();
      }
View Full Code Here

    return new VariableImpl(name, wrap(valueData));
  }

  public JsDeclarativeVariable createDeclarativeVariable(RemoteObjectValue valueData, String name,
      final WipContextBuilder.ScopeParams scopeParams) {
    JsValue jsValue = wrap(valueData);
    VariableValueChanger valueChanger = new VariableValueChanger() {
          @Override
          RelayOk setValue(String variableName, JsValue newValue,
              final GenericCallback<JsValue> callback, SyncCallback syncCallback)
                  throws UnsupportedOperationException {
View Full Code Here

      }

      private ArrayProperties buildArrayProperties() throws MethodIsBlockingException {
        ObjectProperties loadedProperties = getLoadedProperties();
        final TreeMap<Long, JsVariable> map = new TreeMap<Long, JsVariable>();
        JsValue lengthValue = null;
        for (JsVariable variable : loadedProperties.properties()) {
          String name = variable.getName();
          Long index = JavaScriptExpressionBuilder.parsePropertyNameAsArrayIndex(name);
          if (index != null) {
            map.put(index, variable);
          } else if ("length".equals(name)) {
            lengthValue = variable.getValue();
          }
        }
        long length;
        try {
          length = Long.parseLong(lengthValue.getValueString());
        } catch (NumberFormatException e) {
          length = -1;
        }
        return new ArrayProperties(length, map);
      }
View Full Code Here

      }

      {
        // Check literals.
        for (LiteralTestCase literal : TEST_LITERALS) {
          JsValue resultValue = evaluateSync(context.getGlobalEvaluateContext(),
              literal.javaScriptExpression);
          if (resultValue.getType() != literal.expectedType) {
            throw new SmokeException("Unexpected type of '" + literal.javaScriptExpression +
                "': " + resultValue.getType());
          }
          if (!literal.expectedDescription.equals(resultValue.getValueString())) {
            throw new SmokeException("Unexpected string value of '" +
                literal.javaScriptExpression + "': " + resultValue.getValueString());
          }
        }
      }

      // Do not block dispatcher thread.
View Full Code Here

      @Override public void failure(Exception cause) {
        variableHolder.setException(new Exception(cause));
      }
    };
    frame.getEvaluateContext().evaluateSync(FIBONACCI_EXPRESSION, null, callback);
    JsValue value = variableHolder.get();
    String resString = value.getValueString();
    if (!"24".equals(resString)) {
      throw new SmokeException("Wrong expression value");
    }
  }
View Full Code Here

  private ResultOrException processResponse(DATA data, WipValueLoader destinationValueLoader) {
    RemoteObjectValue valueData = getRemoteObjectValue(data);

    WipValueBuilder valueBuilder = destinationValueLoader.getValueBuilder();

    final JsValue jsValue = valueBuilder.wrap(valueData);

    if (getWasThrown(data) == Boolean.TRUE) {
      return new ResultOrException() {
        @Override public JsValue getResult() {
          return null;
View Full Code Here

   * message as a {@link Value}.
   */
  public static Variable forRealValue(EvaluateContext evaluateContext, JsVariable jsVariable,
      boolean isInternalProperty, ExpressionTracker.Node trackerNode) {
    ValueBase value;
    JsValue jsValue = jsVariable.getValue();
    if (jsValue == null) {
      JsObjectProperty objectProperty = jsVariable.asObjectProperty();
      if (objectProperty == null) {
        value = new ValueBase.ErrorMessageValue(evaluateContext,
            "Variable value is unavailable");
View Full Code Here

      }
      Value realValue = valueBase.asRealValue();
      if (realValue == null) {
        throw new IllegalArgumentException("Not a real value");
      }
      JsValue jsValue = realValue.getJsValue();
      setValue(jsValue);
    }
View Full Code Here

    private DeferredData load(ValueLoaderImpl valueLoader, int cacheState)
        throws MethodIsBlockingException {
      ObjectValueHandle scopeObject = loadScopeObject(valueLoader);
      ValueMirror mirror = valueLoader.addDataToMap(scopeObject.getSuper());
      JsValue jsValue = JsVariableBase.createValue(valueLoader, mirror);
      return new DeferredData(jsValue);
    }
View Full Code Here

TOP

Related Classes of org.chromium.sdk.JsValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.