зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1454384 - [1.0] Enforce non-null extras and arguments in GeckoRuntimeSettings. r=snorp
This commit is contained in:
Родитель
4d7ccac45c
Коммит
9ce480ea8b
|
@ -112,8 +112,11 @@ public class TestRunnerActivity extends Activity {
|
|||
if (sRuntime == null) {
|
||||
final GeckoRuntimeSettings.Builder runtimeSettingsBuilder =
|
||||
new GeckoRuntimeSettings.Builder();
|
||||
runtimeSettingsBuilder.arguments(new String[] { "-purgecaches" })
|
||||
.extras(intent.getExtras());
|
||||
runtimeSettingsBuilder.arguments(new String[] { "-purgecaches" });
|
||||
final Bundle extras = intent.getExtras();
|
||||
if (extras != null) {
|
||||
runtimeSettingsBuilder.extras(extras);
|
||||
}
|
||||
|
||||
sRuntime = GeckoRuntime.create(this, runtimeSettingsBuilder.build());
|
||||
sRuntime.setDelegate(new GeckoRuntime.Delegate() {
|
||||
|
|
|
@ -52,6 +52,9 @@ public final class GeckoRuntimeSettings implements Parcelable {
|
|||
* @param args The Gecko process arguments.
|
||||
*/
|
||||
public @NonNull Builder arguments(final @NonNull String[] args) {
|
||||
if (args == null) {
|
||||
throw new IllegalArgumentException("Arguments must not be null");
|
||||
}
|
||||
mSettings.mArgs = args;
|
||||
return this;
|
||||
}
|
||||
|
@ -62,6 +65,9 @@ public final class GeckoRuntimeSettings implements Parcelable {
|
|||
* @param extras The Gecko intent extras.
|
||||
*/
|
||||
public @NonNull Builder extras(final @NonNull Bundle extras) {
|
||||
if (extras == null) {
|
||||
throw new IllegalArgumentException("Extras must not be null");
|
||||
}
|
||||
mSettings.mExtras = extras;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -63,8 +63,11 @@ public class GeckoViewActivity extends Activity {
|
|||
runtimeSettingsBuilder.arguments(new String[] { "-purgecaches" });
|
||||
}
|
||||
|
||||
runtimeSettingsBuilder.useContentProcessHint(useMultiprocess)
|
||||
.extras(getIntent().getExtras());
|
||||
final Bundle extras = getIntent().getExtras();
|
||||
if (extras != null) {
|
||||
runtimeSettingsBuilder.extras(extras);
|
||||
}
|
||||
runtimeSettingsBuilder.useContentProcessHint(useMultiprocess);
|
||||
sGeckoRuntime = GeckoRuntime.create(this, runtimeSettingsBuilder.build());
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче