Closed
Bug 1443283
Opened 7 years ago
Closed 7 years ago
Prevent crash when a null or open GeckoSession is registered with GeckoView.setSession()
Categories
(GeckoView :: General, defect)
GeckoView
General
Tracking
(firefox60 fixed)
RESOLVED
FIXED
mozilla60
Tracking | Status | |
---|---|---|
firefox60 | --- | fixed |
People
(Reporter: rbarker, Assigned: rbarker)
Details
Attachments
(1 file)
GeckoView will either crash if a null GeckoSession is set or throw an exception if the GeckoSession is open.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → rbarker
Comment hidden (mozreview-request) |
Comment 2•7 years ago
|
||
mozreview-review |
Comment on attachment 8956281 [details]
Bug 1443283 - Prevent crash when a null or open GeckoSession is registered with GeckoView.setSession()
https://reviewboard.mozilla.org/r/225170/#review231374
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
(Diff revision 1)
> }
> }
>
> public void setSession(final GeckoSession session) {
> - if (mSession != null && mSession.isOpen()) {
> - throw new IllegalStateException("Current session is open");
We still need to throw here. Otherwise we'd leak an open session.
Attachment #8956281 -
Flags: review?(nchen) → review-
Assignee | ||
Comment 3•7 years ago
|
||
It's only a leak if GeckoView owns the session which won't be the case with tabs or in the case of the VR browser.
Comment 4•7 years ago
|
||
GeckoView doesn't know if the consumer is taking ownership of the session, and I don't think a naive caller of `setSession` would assume it has to take ownership of the existing session first.
I'd prefer leaving this check in-place, and add a `releaseSession()` call that bypasses this check, and returns the released session.
Comment hidden (mozreview-request) |
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8956281 [details]
Bug 1443283 - Prevent crash when a null or open GeckoSession is registered with GeckoView.setSession()
https://reviewboard.mozilla.org/r/225170/#review231804
::: mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java:195
(Diff revision 2)
> if (mSurfaceView != null) {
> mSurfaceView.setBackgroundColor(color);
> }
> }
>
> + public void releaseSession() {
`releaseSession` should return the released session
Attachment #8956281 -
Flags: review?(nchen) → review+
Assignee | ||
Comment 7•7 years ago
|
||
(In reply to Jim Chen [:jchen] [:darchons] from comment #6)
>
> `releaseSession` should return the released session
I had it that way at originally, but figured if someone wants the current session they should just call getSession first?
(In reply to Jim Chen [:jchen] [:darchons] from comment #6)
> Comment on attachment 8956281 [details]
> Bug 1443283 - Prevent crash when a null or open GeckoSession is registered
> with GeckoView.setSession()
>
> https://reviewboard.mozilla.org/r/225170/#review231804
>
> :::
> mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java:
> 195
> (Diff revision 2)
> > if (mSurfaceView != null) {
> > mSurfaceView.setBackgroundColor(color);
> > }
> > }
> >
> > + public void releaseSession() {
>
> `releaseSession` should return the released session
I like returning the session because it signifies that ownership of the session is being transferred to the caller.
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8956281 [details]
Bug 1443283 - Prevent crash when a null or open GeckoSession is registered with GeckoView.setSession()
https://reviewboard.mozilla.org/r/225170/#review231866
LGTM with releaseSession returning the session.
Attachment #8956281 -
Flags: review?(esawin) → review+
Comment 10•7 years ago
|
||
Pushed by rbarker@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9a824b10df47
Prevent crash when a null or open GeckoSession is registered with GeckoView.setSession() r=jchen,esawin
Comment 11•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 60
Updated•6 years ago
|
Product: Firefox for Android → GeckoView
Updated•6 years ago
|
Target Milestone: Firefox 60 → mozilla60
You need to log in
before you can comment on or make changes to this bug.
Description
•