Skip to content

Commit

Permalink
Small change to help WebRTC support on JS port. Added support for HTM…
Browse files Browse the repository at this point in the history
…L5Peer.removeOnDeinitialize client property which prevents JS port from removing peer iframe on deinitialize when set to false. Corresponds with db6b3e3
  • Loading branch information
shannah committed Sep 10, 2020
1 parent 9f57e53 commit d8f491e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions CodenameOne/src/com/codename1/ui/BrowserComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,29 @@ public void setDebugMode(boolean mode) {
putClientProperty("BrowserComponent.firebug", null);
}
}

@Override
public void putClientProperty(String key, Object value) {
super.putClientProperty(key, value);
// In Javascript we use an iframe, and normal behaviour is for the
// iframe to be added hidden to the DOM immediately on creation, but
// it is removed from the DOM on deinitialize() and added in initComponent().
// In some cases, e.g. WebRTC, removing from the DOM breaks things, so we
// need it to remain on the dom even after deinitialize(). This is necessary
// in case we reinitialize it afterward (e.g when displaying a dialog, it will
// deinitialize the form, and when we close the dialog it will reshow the form
// but the browser will be broken.
// Thie client property is a flag to tell the JS port not to remove the peer
// on deinitialize.
if ("HTML5Peer.removeOnDeinitialize".equals(key)) {
if (internal != null) {
internal.putClientProperty(key, value);
}
}

}



/**
* Indicates if debug mode is set (might have no effect though)
Expand Down

0 comments on commit d8f491e

Please sign in to comment.