2014-03-01 69 views
1

我最近收到一張支持票據,表示我們的某些Web應用程序的某些功能正在iPad上崩潰Safari瀏覽器。此功能在最新的iOS 7.0.6更新之前沒有問題。我們有幾個GWT ValueListBoxes,它們的值發生更改時會更改DOM。在進行更改之前,我們向用戶提供一個Window.confirm()消息,告知他們這些更改會產生的效果,並詢問他們是否仍然想繼續操作。自更新以來,確認選擇什麼都不做,Safari崩潰。這隻發生在iPad上。該功能在桌面瀏覽器(IE,Chrome,Firefox,Safari和Chrome移動模擬器)上運行良好,但在iPad上崩潰Safari。有其他人有這個問題嗎?GWT Window.confirm()由ValueListBox的onchange在iPad上崩潰Safari導致iOS 7.0.6

這裏是崩潰的截圖:SafariCrashOniPad

而這裏的代碼示例:

this._view.isPrimaryFoodGen().addValueChangeHandler(new ValueChangeHandler<Boolean>() 
{ 
    @Override 
    public void onValueChange(final ValueChangeEvent<Boolean> event) 
    { 
     @SuppressWarnings("unchecked") 
     ValueListBoxWithOldValue<Boolean> vlb = (ValueListBoxWithOldValue<Boolean>)event.getSource(); 

     if (confirmQuestionChange()){ 
      changeGroupAndQuestions(CONSTANTS.PRIMARY_FOOD, event.getValue()); 
     } 
     else { 
      vlb.setValue(vlb.getOldValue()); 
     } 
    } 
}); 

public boolean confirmQuestionChange() 
{ 
    if (!this._view.isImageCriteriaQuestionsVisible()) 
    { //questions aren't currently visible 
     return true; 
    } 

    boolean confirmed = Window.confirm("Changing this response will delete image data already collected. Do you wish to proceed?"); 
    return confirmed; 
} 

關於防止iPad上的崩潰的解決方案的任何幫助,將不勝感激。在調用Window.confirm()之前,我曾嘗試關注另一個元素,希望覆蓋和ValueListBox選項可以被刪除以阻止任何JS衝突,但它沒有奏效。

我在蘋果的擺佈下,直到下一次更新修復這個問題? 還是有一個可行的解決方案?

回答

0

好吧,事實證明,由於找不到修復程序來繼續使用Window.confirm(),我不得不通過更改onValueChange()和confirmQuestionChange()方法來使用手動創建DialogBox而不是Window.confirm()。這不是最佳的解決方案,但Safari不再在iPad上崩潰,用戶可以完成他們的工作。下面是代碼的變化:

this._view.isPrimaryFoodGen().addValueChangeHandler(new ValueChangeHandler<Boolean>() 
{ 
    @Override 
    public void onValueChange(final ValueChangeEvent<Boolean> event) 
    { 
     confirmQuestionChange(CONSTANTS.PRIMARY_FOOD, event); 
    } 

}); 

public void confirmQuestionChange(final String question, ValueChangeEvent<Boolean> event) 
{ 
    final ValueListBoxWithOldValue<Boolean> vlb = (ValueListBoxWithOldValue<Boolean>)event.getSource(); 

    if (!this._view.isImageCriteriaQuestionsVisible()) //questions aren't currently visible, can change them no problem 
    { 
     changeGroupAndQuestions(question, vlb.getValue()); 
    } 
    else{ 
     //the following fix was put in place for issues with Safari on the iPad OPS-76 
     final DialogBox dialogBox = new DialogBox(); 
     dialogBox.setHTML("<center>Changing this response will delete<br />image data already collected.<br />Do you wish to proceed?</center>"); 
     dialogBox.setAnimationEnabled(true); 
     Button yesButton = new Button("YES"); 
     Button noButton = new Button("NO"); 
     HorizontalPanel dialogHPanel = new HorizontalPanel(); 
     dialogHPanel.setWidth("100%"); 
     dialogHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); 
     dialogHPanel.add(noButton); 
     dialogHPanel.add(yesButton); 

     noButton.addClickHandler(new ClickHandler() { 
      @Override 
      public void onClick(ClickEvent event) { 
       vlb.setValue(vlb.getOldValue()); 
       dialogBox.hide(); 
       } 
     }); 

     yesButton.addClickHandler(new ClickHandler() { 
      @Override 
      public void onClick(ClickEvent event) { 
       changeGroupAndQuestions(question, vlb.getValue()); 
       dialogBox.hide(); 
       } 
     }); 

     // Set the contents of the Widget 
     dialogBox.setWidget(dialogHPanel); 
     dialogBox.setPopupPosition(180, 425); 
     dialogBox.show(); 
    } 
} 

以下是截圖: enter image description here

正如你可以看到,出現對話框之前關閉ValueListBox選項,屏幕不再鎖定。