Package org.chromium.sdk

Examples of org.chromium.sdk.DebugContext


      if (jsObject == null) {
        return createErrorOptional(
            new Message(Messages.LogicImpl_NOT_FOR_PRIMITIVE, MessagePriority.BLOCKING_PROBLEM));
      }

      DebugContext debugContext = uiValue.getSuspendedState().getDebugContext();
      // Unsafe asynchronous check.
      if (uiValue.getSuspendedState().isDismissed()) {
        return createErrorOptional(
            new Message(Messages.LogicImpl_CONTEXT_DISMISSED, MessagePriority.BLOCKING_PROBLEM));
      }
      JsEvaluateContext globalEvaluateContext = debugContext.getGlobalEvaluateContext();

      return createOptional(new PreviewContext(globalEvaluateContext, jsObject));
    }
View Full Code Here


        new FakeConnection(messageResponder), FakeConnection.HANDSHAKER);
    javascriptVm.attach(listener);

    listener.expectSuspendedEvent();
    messageResponder.sendSuspendedEvent();
    DebugContext debugContext = listener.getDebugContext();

    JSONObject valueObject = (JSONObject) JSONValue.parse(
        "{\"ref\":" + FixtureChromeStub.getNumber3Ref() +
        ",\"type\":\"number\",\"value\":3,\"text\":\"3\"}");
    SomeRef someRef = V8ProtocolParserAccess.get().parseSomeRef(valueObject);
View Full Code Here

        new FakeConnection(messageResponder), FakeConnection.HANDSHAKER);
    standaloneVm.attach(listener);

    listener.expectSuspendedEvent();
    messageResponder.sendSuspendedEvent();
    DebugContext debugContext = listener.getDebugContext();

    String propertyRefText = "{'ref':" + FixtureChromeStub.getNumber3Ref() +
        ",'type':'number','value':3,'text':'3'}";

    InternalContext internalContext = ContextBuilder.getInternalContextForTests(debugContext);
View Full Code Here

  public <R> R describeState(StateVisitor<R> visitor) {
    return currentStepState.describeState(visitor);
  }

  private static StackFrameBase[] wrapStackFrames(JavascriptThread.SuspendedState threadState) {
    DebugContext debugContext = threadState.getDebugContext();
    List<? extends CallFrame> jsFrames = debugContext.getCallFrames();
    List<StackFrameBase> result = new ArrayList<StackFrameBase>(jsFrames.size() + 1);

    ExceptionData exceptionData = debugContext.getExceptionData();
    if (exceptionData != null) {
      // Add fake 'throw exception' frame.
      EvaluateContext evaluateContext =
          new EvaluateContext(debugContext.getGlobalEvaluateContext(), threadState);
      result.add(new ExceptionStackFrame(evaluateContext, exceptionData));
    }
    for (CallFrame jsFrame : jsFrames) {
      result.add(new StackFrame(threadState, jsFrame));
    }
View Full Code Here

        null, callbackSemaphore);
    callbackSemaphore.acquireDefault(relayOk);

    // First time just suspend on breakpoint and go on.
    {
      DebugContext context = stateManager.expectEvent(EXPECT_SUSPENDED_VISITOR);
      context.continueVm(DebugContext.StepAction.CONTINUE, 0, null);
      stateManager.expectEvent(EXPECT_RESUMED_VISITOR);
    }

    // Second time check variables and expressions.
    {
      DebugContext context = stateManager.expectEvent(EXPECT_SUSPENDED_VISITOR);

      {
        // Check cache dropping.
        JsObject root = evaluateSync(context.getGlobalEvaluateContext(),
            "(debug_value_1 = {a:2})").asObject();
        if (root == null) {
          throw new RuntimeException();
        }
        String aValue;
        aValue = root.getProperty("a").getValue().getValueString();
        if (!"2".equals(aValue)) {
          throw new SmokeException();
        }
        evaluateSync(context.getGlobalEvaluateContext(), "debug_value_1.a = 3");

        root.getRemoteValueMapping().clearCaches();

        aValue = root.getProperty("a").getValue().getValueString();
        if (!"3".equals(aValue)) {
          throw new SmokeException();
        }
      }

      {
        // 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.
      stateManager.setDefaultReceiver(IGNORE_SCRIPTS_VISITOR);

      List<? extends CallFrame> callFrames = context.getCallFrames();
      CallFrame topFrame = callFrames.get(0);

      JsScope localScope;
      findScope: {
        for (JsScope scope : topFrame.getVariableScopes()) {
          if (scope.getType() == JsScope.Type.LOCAL) {
            localScope = scope;
            break findScope;
          }
        }
        throw new SmokeException("Failed to find local scope");
      }

      JsVariable xVar = getVariable(localScope, "x");
      if (!"1".equals(xVar.getValue().getValueString())) {
        throw new SmokeException("Unexpected value of local variable");
      }
      JsVariable yVar = getVariable(localScope, "y");
      if (!"2".equals(yVar.getValue().getValueString())) {
        throw new SmokeException("Unexpected value of local variable");
      }

      for (CallFrame frame : callFrames) {
        checkExpression(frame);
      }

      context.continueVm(DebugContext.StepAction.CONTINUE, 0, null);
      stateManager.expectEvent(EXPECT_RESUMED_VISITOR);
    }

    stateManager.setDefaultReceiver(IGNORE_ALL_VISITOR);
    vm.detach();
View Full Code Here

            contextData.frames = new Frames(jsonFrames, preContext);

            preContext.createContext(contextData);

            DebugContext userContext = preContext.getContext();
            currentStep = userContext;
            return userContext;
          }
        };
      }
View Full Code Here

          };
          V8Helper.reloadScriptAsync(debugSession, Collections.singletonList(getId()),
              scriptCallback, null);

          if (body.stepin_recommended() == Boolean.TRUE) {
            DebugContext debugContext = debugSession.getContextBuilder().getCurrentDebugContext();
            if (debugContext == null) {
              // We may have already issued 'continue' since the moment that change live command
              // was sent so the context was dropped. Ignore this case.
            } else {
              debugContext.continueVm(DebugContext.StepAction.IN, 0, null);
              resumed = true;
            }
          } else {
            if (resultDescription != null && resultDescription.stack_modified()) {
              debugSession.recreateCurrentContext();
View Full Code Here

            contextData.frames = new Frames(jsonFrames, preContext);

            preContext.createContext(contextData);

            DebugContext userContext = preContext.getContext();
            currentStep = userContext;
            return userContext;
          }
        };
      }
View Full Code Here

          };
          V8Helper.reloadScriptAsync(debugSession, Collections.singletonList(getId()),
              scriptCallback, null);

          if (body.stepin_recommended() == Boolean.TRUE) {
            DebugContext debugContext = debugSession.getContextBuilder().getCurrentDebugContext();
            if (debugContext == null) {
              // We may have already issued 'continue' since the moment that change live command
              // was sent so the context was dropped. Ignore this case.
            } else {
              debugContext.continueVm(DebugContext.StepAction.IN, 0, null);
            }
          } else {
            if (resultDescription != null && resultDescription.stack_modified()) {
              debugSession.recreateCurrentContext();
            }
View Full Code Here

    SuccessCommandResponse successResponse = response.asSuccess();
    if (successResponse == null) {
      handleWrongStacktrace();
    }

    final DebugContext debugContext = setFrames(successResponse, step2);
    final DebugSession debugSession = step2.getInternalContext().getDebugSession();

    JavascriptVm.ScriptsCallback afterScriptsAreLoaded = new JavascriptVm.ScriptsCallback() {
      @Override public void failure(String errorMessage) {
        handleWrongStacktrace();
View Full Code Here

TOP

Related Classes of org.chromium.sdk.DebugContext

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.