Bug 1671578 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

In AC we have a bunch of tests that verify that we forward the correct data to GeckoView.

A simplified example is:

```Kotlin
engineSession.loadUrl("http://mozilla.org")

verify(geckoSession).loadUri(
    "http://mozilla.org",
    null as GeckoSession?,
    GeckoSession.LOAD_FLAGS_NONE,
    null as Map<String, String>?
)
```

If I translate this to using `GeckoSession.Loader`:

```Kotlin
 verify(geckoSession).load(
    GeckoSession.Loader()
        .uri("https://www.mozilla.org")
)
```

... then this fails because since `GeckoSession.Loader` doesn't implement `equals` it falls back to comparing references. Implementing `equals()` (and then probably also `hashCode()`) would help us write test and would make `GeckoSession.Loader` more like a [data class](https://kotlinlang.org/docs/reference/data-classes.html) in Kotlin or a [record in Java 14+](https://openjdk.java.net/jeps/359).
In AC we have a bunch of tests that verify that we forward the correct data to GeckoView.

A simplified example is:

```Kotlin
engineSession.loadUrl("http://mozilla.org")

verify(geckoSession).loadUri(
    "http://mozilla.org",
    null as GeckoSession?,
    GeckoSession.LOAD_FLAGS_NONE,
    null as Map<String, String>?
)
```

If I translate this to using `GeckoSession.Loader`:

```Kotlin
 verify(geckoSession).load(
    GeckoSession.Loader()
        .uri("https://www.mozilla.org")
)
```

... then this fails because since `GeckoSession.Loader` doesn't implement `equals` it falls back to comparing references. Implementing `equals()` (and then probably also `hashCode()`) would help us write test and would make `GeckoSession.Loader` more like a [data class](https://kotlinlang.org/docs/reference/data-classes.html) in Kotlin or a [Record in Java 14+](https://openjdk.java.net/jeps/359).

Back to Bug 1671578 Comment 0