Closed Bug 1643736 Opened 4 years ago Closed 3 years ago

cookieStoreId should only be sent to the app if the extension has the appropriate permissions

Categories

(GeckoView :: Extensions, defect, P2)

Unspecified
All

Tracking

(firefox88 fixed)

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: agi, Assigned: ankushduacodes, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [geckoview:m79])

Attachments

(3 files)

Severity: -- → S3
Priority: -- → P1
Whiteboard: [geckoview:m79]
Whiteboard: [geckoview:m79] → [geckoview:m79][geckoview:m80]
Priority: P1 → P2
Whiteboard: [geckoview:m79][geckoview:m80] → [geckoview:m79]

Hi, I would love to work on this, Please let me know if I may.

Hi Agi, Just a friendly reminder regarding comment#1

Flags: needinfo?(agi)

Agi is unavailable for a few days. The linked bug, bug 1643688, has a description of the problem, and Agi's initial comment here points to some relevant places in the code.

The general guide to get started with code contributions to extension code is at https://wiki.mozilla.org/WebExtensions/Contribution_Onramp

If you have any specific questions, let me know.

Flags: needinfo?(agi)

Hi Rob, I have read through the issue and added a check before passing cookieStoreId to GeckoViewTabBridge.createNewTab().
Is there a test that needs to be added for this patch?

Flags: needinfo?(rob)
Assignee: nobody → ankushduacodes
Status: NEW → ASSIGNED

I replied in the patch.

Flags: needinfo?(rob)

Looks like this bug will require more knowledge of extension-specific stuff than mobile-specific stuff, so I'll take over mentoring.

Mentor: agi → rob
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/10cb82a1a314
Adding appropriate check before passing cookieStoreId to GeckoViewTabBridge.createNewTab() r=robwu,agi

Test Failures:

adb logcat -s "Gecko,GeckoViewActivity":

--------- beginning of main
--------- beginning of system
01-15 02:52:24.418 30625 30652 I Gecko   : [30625, Unnamed thread b8d26800] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/checkouts/gecko/xpcom/base/nsTraceRefcnt.cpp:202
01-15 02:52:24.595 30625 30652 I Gecko   : AndroidBridge::Init
01-15 02:52:25.675 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040111 (NS_ERROR_NOT_AVAILABLE): file /builds/worker/checkouts/gecko/netwerk/protocol/res/SubstitutingProtocolHandler.cpp:414
01-15 02:52:25.675 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040111 (NS_ERROR_NOT_AVAILABLE): file /builds/worker/checkouts/gecko/dom/fetch/FetchDriver.cpp:635
01-15 02:52:27.062 30625 30652 I Gecko   : -*- nsDNSServiceDiscovery.js : nsDNSServiceDiscovery
01-15 02:52:29.530 30625 30652 I Gecko   : AndroidBridge::GetStaticStringField MODEL
01-15 02:52:29.530 30625 30652 I Gecko   : AndroidBridge::GetStaticStringField PRODUCT
01-15 02:52:29.530 30625 30652 I Gecko   : AndroidBridge::GetStaticStringField MANUFACTURER
01-15 02:52:29.531 30625 30652 I Gecko   : AndroidBridge::GetStaticIntField SDK_INT
01-15 02:52:29.531 30625 30652 I Gecko   : AndroidBridge::GetStaticStringField HARDWARE
01-15 02:52:29.531 30625 30652 I Gecko   : AndroidBridge::GetStaticStringField RELEASE
01-15 02:52:29.551 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: Failed to bind API to GL!: file /builds/worker/checkouts/gecko/gfx/gl/GLContextProviderEGL.cpp:648
01-15 02:52:29.551 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: Failed to create GLContext from PBuffer: file /builds/worker/checkouts/gecko/gfx/gl/GLContextProviderEGL.cpp:1164
01-15 02:52:29.556 30625 30652 I Gecko   : Initializing context 0xe6a133c0 surface 0xeb7a00a0 on display 0x1
01-15 02:52:29.564 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: Robustness supported, strategy is not LOSE_CONTEXT_ON_RESET!: file /builds/worker/checkouts/gecko/gfx/gl/GLContext.cpp:972
01-15 02:52:29.564 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: robustness marked as unsupported: file /builds/worker/checkouts/gecko/gfx/gl/GLContextFeatures.cpp:628
01-15 02:52:29.571 30625 30652 I Gecko   : Destroying context 0xe6a133c0 surface 0xeb7a00a0 on display 0x1
01-15 02:52:29.572 30625 30652 I Gecko   : AndroidBridge::getScreenSize
01-15 02:52:30.019 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(presShell) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4287
01-15 02:52:30.082 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(presShell) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4287
01-15 02:52:30.170 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80520012 (NS_ERROR_FILE_NOT_FOUND): file /builds/worker/checkouts/gecko/layout/style/Loader.cpp:1993
01-15 02:52:30.416 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_SUCCESS_VOID(rv) failed with result 0x80520012 (NS_ERROR_FILE_NOT_FOUND): file /builds/worker/checkouts/gecko/dom/base/nsFrameMessageManager.cpp:1272
01-15 02:52:30.419 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(presShell) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4287
01-15 02:52:30.512 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4289
01-15 02:52:30.585 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4289
01-15 02:52:30.625 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:1180
01-15 02:52:31.133 30625 30652 I Gecko   : nsWindow[0xa94db040]::Create 0x0 [0 0 1 1]
01-15 02:52:31.136 30625 30724 I Gecko   : Initializing context 0xd962fc80 surface 0x0 on display 0x1
01-15 02:52:31.145 30625 30724 I Gecko   : [Parent 30625, Unnamed thread a940a900] WARNING: Robustness supported, strategy is not LOSE_CONTEXT_ON_RESET!: file /builds/worker/checkouts/gecko/gfx/gl/GLContext.cpp:972
01-15 02:52:31.145 30625 30724 I Gecko   : [Parent 30625, Unnamed thread a940a900] WARNING: robustness marked as unsupported: file /builds/worker/checkouts/gecko/gfx/gl/GLContextFeatures.cpp:628
01-15 02:52:31.196 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4289
01-15 02:52:31.206 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4289
01-15 02:52:31.557 30625 30652 I Gecko   : AndroidBridge::HasHWH264
01-15 02:52:31.593 30670 30695 I Gecko   : [30670, Unnamed thread b9124780] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/checkouts/gecko/xpcom/base/nsTraceRefcnt.cpp:202
01-15 02:52:31.595 30670 30695 I Gecko   : [30670, Unnamed thread b9124780] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/checkouts/gecko/xpcom/base/nsTraceRefcnt.cpp:202
01-15 02:52:31.595 30670 30695 I Gecko   : [30670, Unnamed thread b9124780] WARNING: XPCOM objects created/destroyed from static ctor/dtor: file /builds/worker/checkouts/gecko/xpcom/base/nsTraceRefcnt.cpp:202
01-15 02:52:31.717 30625 30652 I Gecko   : AndroidBridge::HasHWVP8Encoder
01-15 02:52:31.719 30625 30652 I Gecko   : AndroidBridge::HasHWVP8Decoder
01-15 02:52:31.758 30625 30750 I Gecko   : [Parent 30625, Unnamed thread a6e6e900] WARNING: Failed to delete GMP storage directory: file /builds/worker/checkouts/gecko/dom/media/gmp/GMPServiceParent.cpp:1562
01-15 02:52:31.884 30625 30652 I Gecko   : AndroidBridge::GetScreenOrientation
01-15 02:52:31.894 30625 30652 I Gecko   : nsWindow[0xa94db040]::Show 1
01-15 02:52:32.305 30670 30695 I Gecko   : [Child 30670, Main Thread] WARNING: NS_ENSURE_SUCCESS_VOID(rv) failed with result 0x80520012 (NS_ERROR_FILE_NOT_FOUND): file /builds/worker/checkouts/gecko/dom/base/nsFrameMessageManager.cpp:1272
01-15 02:52:32.348 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_SUCCESS_VOID(rv) failed with result 0x80520012 (NS_ERROR_FILE_NOT_FOUND): file /builds/worker/checkouts/gecko/dom/base/nsFrameMessageManager.cpp:1272
01-15 02:52:32.350 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(presShell) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4287
01-15 02:52:32.404 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4289
01-15 02:52:32.430 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/worker/checkouts/gecko/dom/base/nsGlobalWindowOuter.cpp:4289
01-15 02:52:32.494 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:1180
01-15 02:53:02.974 30625 30652 I Gecko   : nsWindow[0xa94db040]::Show 0
01-15 02:53:03.048 30625 30724 I Gecko   : Destroying context 0xd962fc80 surface 0x0 on display 0x1
01-15 02:53:03.119 30625 30652 I Gecko   : [Parent 30625, Main Thread] WARNING: '!CanSend() || !mManager || !mManager->CanSend()', file /builds/worker/checkouts/gecko/dom/ipc/jsactor/JSWindowActorChild.cpp:40
01-15 02:53:03.218 30625 30704 I Gecko   : [Parent 30625, Unnamed thread aa4f9480] WARNING: 'NS_FAILED(directory->GetDirectoryEntries(getter_AddRefs(entries)))', file /builds/worker/checkouts/gecko/dom/quota/ActorsParent.cpp:9754
01-15 02:53:03.232 30625 30704 I Gecko   : [Parent 30625, Unnamed thread aa4f9480] WARNING: 'NS_FAILED(directory->GetDirectoryEntries(getter_AddRefs(entries)))', file /builds/worker/checkouts/gecko/dom/quota/ActorsParent.cpp:9754

Test logs:

47 actionable tasks: 3 executed, 44 up-to-date
 0:39.23 adb INFO Setting run_as_package to org.mozilla.geckoview.test
 0:40.08 adb INFO Setting test_root to /data/local/tmp/test_root
 0:40.23 adb INFO Resetting test root from /data/local/tmp/test_root to /data/data/org.mozilla.geckoview.test/test_root
 0:11.04 pid:70669 Full command: /Users/ankushdua/.mozbuild/android-device/host-utils-85.0a1.en-US.mac/pk12util -i /Users/ankushdua/src/mozilla-unified/build/pgo/certs/mochitest.client -w /var/folders/fx/4ldx407s32gfyy32ngql6_bc0000gn/T/tmp8gj9utgh.mozrunner/.crtdbpw -d /var/folders/fx/4ldx407s32gfyy32ngql6_bc0000gn/T/tmp8gj9utgh.mozrunner
pid:70669 pk12util: PKCS12 IMPORT SUCCESSFUL
 0:11.97 INFO MochitestServer : launching ['/Users/ankushdua/.mozbuild/android-device/host-utils-85.0a1.en-US.mac/xpcshell', '-g', '/Users/ankushdua/.mozbuild/android-device/host-utils-85.0a1.en-US.mac', '-f', '/Users/ankushdua/.mozbuild/android-device/host-utils-85.0a1.en-US.mac/components/httpd.js', '-e', "const _PROFILE_PATH = '/var/folders/fx/4ldx407s32gfyy32ngql6_bc0000gn/T/tmp8gj9utgh.mozrunner'; const _SERVER_PORT = '8888'; const _SERVER_ADDR = '192.168.18.11'; const _TEST_PREFIX = undefined; const _DISPLAY_RESULTS = false;", '-f', '/Users/ankushdua/src/mozilla-unified/obj-android/_tests/testing/mochitest/server.js']
 0:11.97 INFO runtests.py | Server pid: 70683
 0:12.00 INFO runtests.py | Websocket server pid: 70684
 0:12.02 INFO runtests.py | SSL tunnel pid: 70685
 0:12.71 SUITE_START: running 1 tests
 0:54.16 adb INFO Granting important runtime permissions to org.mozilla.geckoview.test
 0:13.21 INFO launching am instrument -w -r -e args '-profile /data/data/org.mozilla.geckoview.test/test_root/junit-profile' -e class org.mozilla.geckoview.test.WebExtensionTest#testBrowserTabsCreate -e env0 MOZ_CRASHREPORTER=1 -e env1 MOZ_CRASHREPORTER_SHUTDOWN=1 -e env2 XPCOM_DEBUG_BREAK=stack -e env3 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 -e env4 MOZ_IN_AUTOMATION=1 -e env5 R_LOG_VERBOSE=1 -e env6 R_LOG_LEVEL=6 -e env7 R_LOG_DESTINATION=stderr -e env8 MOZ_WEBRENDER=0 org.mozilla.geckoview.test/androidx.test.runner.AndroidJUnitRunner
 0:15.62 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.test.WebExtensionTest
 0:15.62 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: current=1
 0:15.62 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
 0:15.62 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: numtests=1
 0:15.62 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: stream=
 0:15.62 org.mozilla.geckoview.test org.mozilla.geckoview.test.WebExtensionTest:
 0:15.62 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: test=testBrowserTabsCreate
 0:15.63 org.mozilla.geckoview.test INSTRUMENTATION_STATUS_CODE: 1
 0:15.63 TEST_START: org.mozilla.geckoview.test.WebExtensionTest.testBrowserTabsCreate
 0:54.74 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.test.WebExtensionTest
 0:54.74 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: current=1
 0:54.74 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
 0:54.74 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: numtests=1
 0:54.74 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: stack=org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms
 0:54.74 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutRunnable.run(UiThreadUtils.java:52)
 0:54.74 org.mozilla.geckoview.test     at android.os.Handler.handleCallback(Handler.java:883)
 0:54.74 org.mozilla.geckoview.test     at android.os.Handler.dispatchMessage(Handler.java:100)
 0:54.74 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils.waitForCondition(UiThreadUtils.java:155)
 0:54.75 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils.waitForResult(UiThreadUtils.java:80)
 0:54.75 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.waitForResult(GeckoSessionTestRule.java:2312)
 0:54.75 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.WebExtensionTest.testBrowserTabsCreate(WebExtensionTest.kt:574)
 0:54.75 org.mozilla.geckoview.test     at java.lang.reflect.Method.invoke(Native Method)
 0:54.75 org.mozilla.geckoview.test     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 0:54.75 org.mozilla.geckoview.test     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 0:54.75 org.mozilla.geckoview.test     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 0:54.84 org.mozilla.geckoview.test     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 0:54.84 org.mozilla.geckoview.test     at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
 0:54.84 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$2.lambda$evaluate$0$GeckoSessionTestRule$2(GeckoSessionTestRule.java:1313)
 0:54.84 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.-$$Lambda$GeckoSessionTestRule$2$sIbRNaZJgAu-QrUVWSGD8JbPSWM.run(Unknown Source:6)
 0:54.84 org.mozilla.geckoview.test     at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2227)
 0:54.84 org.mozilla.geckoview.test     at android.os.Handler.handleCallback(Handler.java:883)
 0:54.84 org.mozilla.geckoview.test     at android.os.Handler.dispatchMessage(Handler.java:100)
 0:54.85 org.mozilla.geckoview.test     at android.os.Looper.loop(Looper.java:237)
 0:54.85 org.mozilla.geckoview.test     at android.app.ActivityThread.main(ActivityThread.java:7948)
 0:54.85 org.mozilla.geckoview.test     at java.lang.reflect.Method.invoke(Native Method)
 0:54.85 org.mozilla.geckoview.test     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
 0:54.85 org.mozilla.geckoview.test     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
 0:54.85 org.mozilla.geckoview.test 
 0:54.85 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: stream=
 0:54.85 org.mozilla.geckoview.test Error in testBrowserTabsCreate(org.mozilla.geckoview.test.WebExtensionTest):
 0:54.85 org.mozilla.geckoview.test org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms
 0:54.85 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutRunnable.run(UiThreadUtils.java:52)
 0:54.85 org.mozilla.geckoview.test     at android.os.Handler.handleCallback(Handler.java:883)
 0:54.85 org.mozilla.geckoview.test     at android.os.Handler.dispatchMessage(Handler.java:100)
 0:54.85 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils.waitForCondition(UiThreadUtils.java:155)
 0:54.85 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils.waitForResult(UiThreadUtils.java:80)
 0:54.85 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.waitForResult(GeckoSessionTestRule.java:2312)
 0:54.85 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.WebExtensionTest.testBrowserTabsCreate(WebExtensionTest.kt:574)
 0:54.85 org.mozilla.geckoview.test     at java.lang.reflect.Method.invoke(Native Method)
 0:54.85 org.mozilla.geckoview.test     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 0:54.85 org.mozilla.geckoview.test     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 0:54.85 org.mozilla.geckoview.test     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 0:54.85 org.mozilla.geckoview.test     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 0:54.85 org.mozilla.geckoview.test     at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
 0:54.85 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$2.lambda$evaluate$0$GeckoSessionTestRule$2(GeckoSessionTestRule.java:1313)
 0:54.86 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.-$$Lambda$GeckoSessionTestRule$2$sIbRNaZJgAu-QrUVWSGD8JbPSWM.run(Unknown Source:6)
 0:54.86 org.mozilla.geckoview.test     at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2227)
 0:54.86 org.mozilla.geckoview.test     at android.os.Handler.handleCallback(Handler.java:883)
 0:54.86 org.mozilla.geckoview.test     at android.os.Handler.dispatchMessage(Handler.java:100)
 0:54.86 org.mozilla.geckoview.test     at android.os.Looper.loop(Looper.java:237)
 0:54.86 org.mozilla.geckoview.test     at android.app.ActivityThread.main(ActivityThread.java:7948)
 0:54.86 org.mozilla.geckoview.test     at java.lang.reflect.Method.invoke(Native Method)
 0:54.86 org.mozilla.geckoview.test     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
 0:54.86 org.mozilla.geckoview.test     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
 0:54.86 org.mozilla.geckoview.test 
 0:54.86 org.mozilla.geckoview.test INSTRUMENTATION_STATUS: test=testBrowserTabsCreate
 0:54.86 org.mozilla.geckoview.test INSTRUMENTATION_STATUS_CODE: -2
 0:54.86 TEST_END: FAIL, expected PASS - org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms
 0:55.30 org.mozilla.geckoview.test INSTRUMENTATION_RESULT: stream=
 0:55.30 org.mozilla.geckoview.test 
 0:55.30 org.mozilla.geckoview.test Time: 39.189
 0:55.30 org.mozilla.geckoview.test There was 1 failure:
 0:55.30 org.mozilla.geckoview.test 1) testBrowserTabsCreate(org.mozilla.geckoview.test.WebExtensionTest)
 0:55.30 org.mozilla.geckoview.test org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms
 0:55.30 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutRunnable.run(UiThreadUtils.java:52)
 0:55.30 org.mozilla.geckoview.test     at android.os.Handler.handleCallback(Handler.java:883)
 0:55.30 org.mozilla.geckoview.test     at android.os.Handler.dispatchMessage(Handler.java:100)
 0:55.30 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils.waitForCondition(UiThreadUtils.java:155)
 0:55.30 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.util.UiThreadUtils.waitForResult(UiThreadUtils.java:80)
 0:55.31 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.waitForResult(GeckoSessionTestRule.java:2312)
 0:55.31 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.WebExtensionTest.testBrowserTabsCreate(WebExtensionTest.kt:574)
 0:55.31 org.mozilla.geckoview.test     at java.lang.reflect.Method.invoke(Native Method)
 0:55.31 org.mozilla.geckoview.test     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 0:55.31 org.mozilla.geckoview.test     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 0:55.31 org.mozilla.geckoview.test     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 0:55.31 org.mozilla.geckoview.test     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 0:55.32 org.mozilla.geckoview.test     at androidx.test.internal.runner.junit4.statement.RunBefores.evaluate(RunBefores.java:80)
 0:55.32 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.GeckoSessionTestRule$2.lambda$evaluate$0$GeckoSessionTestRule$2(GeckoSessionTestRule.java:1313)
 0:55.32 org.mozilla.geckoview.test     at org.mozilla.geckoview.test.rule.-$$Lambda$GeckoSessionTestRule$2$sIbRNaZJgAu-QrUVWSGD8JbPSWM.run(Unknown Source:6)
 0:55.32 org.mozilla.geckoview.test     at android.app.Instrumentation$SyncRunnable.run(Instrumentation.java:2227)
 0:55.32 org.mozilla.geckoview.test     at android.os.Handler.handleCallback(Handler.java:883)
 0:55.32 org.mozilla.geckoview.test     at android.os.Handler.dispatchMessage(Handler.java:100)
 0:55.32 org.mozilla.geckoview.test     at android.os.Looper.loop(Looper.java:237)
 0:55.32 org.mozilla.geckoview.test     at android.app.ActivityThread.main(ActivityThread.java:7948)
 0:55.32 org.mozilla.geckoview.test     at java.lang.reflect.Method.invoke(Native Method)
 0:55.32 org.mozilla.geckoview.test     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
 0:55.32 org.mozilla.geckoview.test     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
 0:55.32 org.mozilla.geckoview.test 
 0:55.32 org.mozilla.geckoview.test FAILURES!!!
 0:55.32 org.mozilla.geckoview.test Tests run: 1,  Failures: 1
 0:55.32 org.mozilla.geckoview.test 
 0:55.32 org.mozilla.geckoview.test 
 0:55.32 org.mozilla.geckoview.test INSTRUMENTATION_CODE: -1
 0:55.40 INFO Passed: 0
 0:55.40 INFO Failed: 1
 0:55.40 INFO Todo: 0
 0:55.40 SUITE_END

suite 1
~~~~~~~
Ran 1 checks (1 tests)
Expected results: 0
Unexpected results: 1
  test: 1 (1 fail)

Unexpected Results
------------------
FAIL org.mozilla.geckoview.test.WebExtensionTest.testBrowserTabsCreate - org.mozilla.geckoview.test.util.UiThreadUtils$TimeoutException: Timed out after 30000ms

Flags: needinfo?(ankushduacodes) → needinfo?(agi)

A full logcat is probably gonna be more helpful, there's a lot of logging that we do during tests that's not showing up there.

Flags: needinfo?(agi)
Attached file adb logcat.txt.zip

adb logcat full output

Flags: needinfo?(agi)

This seems relevant:

01-15 03:28:30.636 14155 14198 E GeckoConsole: [JavaScript Error: "Error: No permission for cookieStoreId: null" {file: "undefined" line: 0}]

Looks like we're somehow tripping into the cookieStoreId code here.

Flags: needinfo?(agi)

While merging the patch for https://bugzilla.mozilla.org/show_bug.cgi?id=1643736, One of the test seems to have failed.

I was digging through the logs and found that the test being failed is the following:
https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/androidTest/assets/web_extensions/tabs-create

Now in this test, the extension does not require cookies permissions but our current implementation fails that test as the following checks are mandatory even if the cookies permission is not necessary, Please check out: https://searchfox.org/mozilla-central/source/toolkit/components/extensions/parent/ext-tabs-base.js#2260,2265-2268,2271-2274

What do you think are the right course of action here?

Flags: needinfo?(rob)
Flags: needinfo?(agi)

Adding a simple check like:

if (cookieStoreId) {
            cookieStoreId = getUserContextIdForCookieStoreId(
              extension,
              cookieStoreId,
              false // TODO bug 1372178: support creation of private browsing tabs
            );
          }

seems to do the trick but I am not aware of any issue it may cause.

Turns out issues. there is one more issue while running the test https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/androidTest/assets/web_extensions/tabs-create-2

This code https://searchfox.org/mozilla-central/source/toolkit/components/extensions/parent/ext-tabs-base.js#2294-2296 throws error this time. as contextual identities are not enabled.
Is there a way to enable contextual identities for this test?

(In reply to Ankush Dua from comment #15)

Adding a simple check like:

if (cookieStoreId) {
            cookieStoreId = getUserContextIdForCookieStoreId(

Right, the method should only be used if cookieStoreId is set.

(In reply to Ankush Dua from comment #16)

Turns out issues. there is one more issue while running the test https://searchfox.org/mozilla-central/source/mobile/android/geckoview/src/androidTest/assets/web_extensions/tabs-create-2

This code https://searchfox.org/mozilla-central/source/toolkit/components/extensions/parent/ext-tabs-base.js#2294-2296 throws error this time. as contextual identities are not enabled.
Is there a way to enable contextual identities for this test?

The sessionRule.setPrefsUntilTestEnd test helper can be used, I guess.

Flags: needinfo?(rob)

Only calling getUserContextIdForCookieStoreId when cookieStoreId is set and using setPrefsUntilTestEnd sound good to me! Please send it back for review after making these changes.

Flags: needinfo?(agi)

Sent to try: https://treeherder.mozilla.org/jobs?repo=try&revision=d85abf5fa1647b82cb932acbec8277b1e35700c6&selectedTaskRun=ElzFKbqXT1OqOj7N7tw0xQ.0

Looks like toolkit/components/extensions/test/mochitest/test_ext_tabs_create_cookieStoreId.html times out

You can run this test by running ./mach test test_ext_tabs_create_cookieStoreId.html.

Flags: needinfo?(ankushduacodes)

Hi Agi, as I had outlined some of the errors that stood out to me on the matrix channel. here are the details:
This is what happens when promise to create a new tab on GeckoView is NOT rejected.

01-23 11:16:15.814 14423 14449 D GeckoViewTab: createNewTab
01-23 11:16:15.828 14423 14423 D WebExtension: handleMessage GeckoView:WebExtension:NewTab
01-23 11:16:15.860 14423 14449 D GeckoViewConsole: onEvent GeckoView:WebExtension:Get {"extensionId":"{9fc1bf07-1bec-4489-a454-f2755f2f1095}"}
01-23 11:16:15.866 14423 14449 D GeckoViewConsole: Could not find extension with id={9fc1bf07-1bec-4489-a454-f2755f2f1095}

I tried adding a bunch of log statements to see whats going and here's my summary of it:
when createNewTab is called it goes into EventDispatcher.instance.sendRequestForResult which in essence dispatches an event of type GeckoView:WebExtension:NewTab which is handled here (I think). now newTab is called which should send back sessionId to this call. My suspicion is that something is going wrong in between and I am getting this error raised is 01-23 11:16:15.866 14423 14449 D GeckoViewConsole: Could not find extension with id={9fc1bf07-1bec-4489-a454-f2755f2f1095}.

Now justification for my above-mentioned suspicion if that when I put a log statement after the function where we get the sessionId the log statement never gets logged.

I am not sure from where and when 01-23 11:16:15.860 14423 14449 D GeckoViewConsole: onEvent GeckoView:WebExtension:Get {"extensionId":"{9fc1bf07-1bec-4489-a454-f2755f2f1095}"} is being triggered

I could be wrong but I am pretty confident with what I have discovered. Please let me know if I am missing something or if I am completely off on this one.

Thanks

(PS: Will be uploading a logcat for this as well)

Flags: needinfo?(ankushduacodes) → needinfo?(agi)
Attached file adb logcat

Add useAddonManager: "permanent", to the loadExtension calls. It's currently required for tests on Android due to bug 1641735.

Flags: needinfo?(agi)

(In reply to Rob Wu [:robwu] from comment #22)

Add useAddonManager: "permanent", to the loadExtension calls. It's currently required for tests on Android due to bug 1641735.

I tried using the suggested option but I am getting another error when I add this option to loadExtension calls, I am getting another error:

01-25 08:22:06.809 13943 13979 I GeckoConsole: 1611543126808	addons.xpi	WARN	Invalid XPI: Error: Cannot find id for addon /data/user/0/org.mozilla.geckoview.test/app_tmpdir/generated-extension-1.xpi(resource://gre/modules/addons/XPIInstall.jsm:1539:19) JS Stack trace: loadManifest@XPIInstall.jsm:1539:19

Now I noticed a pattern in both (this and previous issue), My tests are passing when tab creation promise if rejected but fails when it is not rejected, means add_task(async function valid_cookieStoreId() { is the only one that's failing.

Flags: needinfo?(rob)

When useAddonManager: "permanent" is used, the extension ID must also be fixed, via applications.gecko.id. Search on Searchfox for many examples.

And indeed this is only needed for the parts where the logic goes through the implementation of the embedder, for communication with the Java side a valid addon instance is needed.

Flags: needinfo?(rob)

Hi Rob, I have updated the patch with adb logcat of all the scenarios I have tried. Please have look.

Flags: needinfo?(rob)
Flags: needinfo?(rob)
Pushed by asferro@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/56e4eb9e13db
Adding appropriate check before passing cookieStoreId to GeckoViewTabBridge.createNewTab() r=robwu,agi
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: