зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1140830 - Don't try to use a null JSONObject in SiteIdentity.update() r=rnewman
This patch avoids a crash in ART on HTC One M8 devices, where a (deliberate?) NPE was used for init.
This commit is contained in:
Родитель
753efaddd0
Коммит
f09b7427dc
|
@ -119,22 +119,26 @@ public class SiteIdentity {
|
|||
}
|
||||
|
||||
public SiteIdentity() {
|
||||
resetIdentityData();
|
||||
|
||||
mMixedMode = MixedMode.UNKNOWN;
|
||||
mTrackingMode = TrackingMode.UNKNOWN;
|
||||
reset();
|
||||
}
|
||||
|
||||
private void resetIdentityData() {
|
||||
public void reset() {
|
||||
mSecurityMode = SecurityMode.UNKNOWN;
|
||||
mHost = null;
|
||||
mOwner = null;
|
||||
mSupplemental = null;
|
||||
mVerifier = null;
|
||||
mEncrypted = null;
|
||||
mMixedMode = MixedMode.UNKNOWN;
|
||||
mTrackingMode = TrackingMode.UNKNOWN;
|
||||
}
|
||||
|
||||
void update(JSONObject identityData) {
|
||||
if (identityData == null) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
JSONObject mode = identityData.getJSONObject("mode");
|
||||
|
||||
|
@ -153,7 +157,7 @@ public class SiteIdentity {
|
|||
try {
|
||||
mSecurityMode = SecurityMode.fromString(mode.getString("identity"));
|
||||
} catch (Exception e) {
|
||||
resetIdentityData();
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,10 +168,10 @@ public class SiteIdentity {
|
|||
mVerifier = identityData.getString("verifier");
|
||||
mEncrypted = identityData.getString("encrypted");
|
||||
} catch (Exception e) {
|
||||
resetIdentityData();
|
||||
reset();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
resetIdentityData();
|
||||
reset();
|
||||
mMixedMode = MixedMode.UNKNOWN;
|
||||
mTrackingMode = TrackingMode.UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -612,7 +612,7 @@ public class Tab {
|
|||
|
||||
setHasFeeds(false);
|
||||
setHasOpenSearch(false);
|
||||
updateIdentityData(null);
|
||||
mSiteIdentity.reset();
|
||||
setZoomConstraints(new ZoomConstraints(true));
|
||||
setHasTouchListeners(false);
|
||||
setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
|
||||
|
@ -629,7 +629,7 @@ public class Tab {
|
|||
void handleDocumentStart(boolean restoring, String url) {
|
||||
setLoadProgress(LOAD_PROGRESS_START);
|
||||
setState((!restoring && shouldShowProgress(url)) ? STATE_LOADING : STATE_SUCCESS);
|
||||
updateIdentityData(null);
|
||||
mSiteIdentity.reset();
|
||||
}
|
||||
|
||||
void handleDocumentStop(boolean success) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче