Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8117161

WebView crash in WebEngine load method - Win + Mac

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: fx2.0.1
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      Java 1.6.0_26 on Macbook Unibody late 2008: Mac OS 10.6.8 2Ghz Core 2 Duo 4G RAM Nvidia 9400
      Java 7 on Windows 7 32 bits 2GB RAM

    • Subcomponent:
      web

      Description

      The code below crashes on Win 7 JavaFX 2.0 and Mac OS X 10.6 Java FX 2.0 EA
      On Win 7 32 bits under Java 7 it crashes in WebPane.dll
      On Mac OS X I get: Invalid memory access of location 0x170 rip=0x11e7c0d67
      The culprit is
                                                      eng.load("https://graph.facebook.com/me/friends?access_token="+token); in the change listener.


      It would be great if somebody can have a look at it since it's a blocker for me.
      Dependency on commons-codec 1.3 attached

      Kind Regards

      Here's the code:

          private static final String API_KEY = "100105617934";
          private static final String SECRET_KEY = "81f64457a02b7abf6fde109aee7ed5cd";

          public static void main(String[] args) {
              Application.launch(args);
          }
          
          @Override
          public void start(Stage primaryStage) {
           primaryStage.setTitle("Hello World");
               WebView view = new WebView();
              final WebEngine eng = view.getEngine();
              
              eng.load("https://graph.facebook.com/oauth/authorize?" + "client_id=" +
      API_KEY + "&"
      + "redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup);
         
              final TextField locationField = new TextField("http://www.oracle.com/us/index.html");
              locationField.setMaxHeight(Double.MAX_VALUE);
              Button goButton = new Button("Go");
              goButton.setDefaultButton(true);
              EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
                  @Override public void handle(ActionEvent event) {
                      eng.load(locationField.getText().startsWith("http://") ? locationField.getText() :
                              "http://" + locationField.getText());
                      
                  }
              };
              goButton.setOnAction(goAction);
              locationField.setOnAction(goAction);
              eng.locationProperty().addListener(new ChangeListener<String>() {
                  @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
                      locationField.setText(newValue);
                      
                    
      if (newValue.startsWith("http://www.facebook.com/connect/login_success.html")) {
                                             URLCodec codec = new URLCodec();
      try {
      String s = codec.decode(newValue);

      String[] splits = s.split(",");
      try {
      String json = s.substring(s.indexOf('#') + 1, s.length());
      System.out.println("JSON = " + json);
      String st = URLDecoder.decode(json, "UTF-8");
      System.out.println(st);
      String params[] = st.split("&");
      HashMap<String, String> parmsMap = new HashMap<String, String>();
      for (String param : params) {
      String temp[] = param.split("=");
      parmsMap.put(temp[0], java.net.URLDecoder.decode(temp[1], "UTF-8"));
      }
      String token = parmsMap.get("access_token");
      System.out.println(token);
      eng.load("https://graph.facebook.com/me/friends?access_token="+token);
          
      } catch (Exception e) {
      }
      } catch (DecoderException e) {

      }
      }
                  }
              });
              GridPane grid = new GridPane();
              grid.setVgap(5);
              grid.setHgap(5);
              GridPane.setConstraints(locationField, 0, 0, 1, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.SOMETIMES);
              GridPane.setConstraints(goButton,1,0);
              GridPane.setConstraints(view, 0, 1, 2, 1, HPos.CENTER, VPos.CENTER, Priority.ALWAYS, Priority.ALWAYS);
              grid.getColumnConstraints().addAll(
                      new ColumnConstraints(100, 100, Double.MAX_VALUE, Priority.ALWAYS, HPos.CENTER, true),
                      new ColumnConstraints(40, 40, 40, Priority.NEVER, HPos.CENTER, true)
              );
              grid.getChildren().addAll(locationField, goButton, view);
              Scene scene = new Scene(grid, 1024, 768);
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                peterz Peter Zhelezniakov (Inactive)
                Reporter:
                cantakijfx Carl Antaki (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: