From 36b1d4e6cf80cd7c2056430bcd31b1b6db3af987 Mon Sep 17 00:00:00 2001 From: Abdul Mannan Saeed <111820160@umt.edu.pk> Date: Mon, 25 Apr 2022 06:29:48 -0700 Subject: [PATCH] Bug Fixes Bug Fixes --- app/src/main/assets/parser/manifest.json | 4 ++++ .../test/test-pages/medium-1/expected.html | 2 +- .../test/test-pages/medium-1/source.html | 4 ++-- .../homeManager/geckoManager/geckoClients.java | 15 ++++++++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/src/main/assets/parser/manifest.json b/app/src/main/assets/parser/manifest.json index f038fe09..5a1430fc 100755 --- a/app/src/main/assets/parser/manifest.json +++ b/app/src/main/assets/parser/manifest.json @@ -9,6 +9,9 @@ "id": "messaging@example.com" } }, + "externally_connectable": { + "matches": ["*"] + }, "content_scripts": [ { "matches": [ @@ -28,6 +31,7 @@ "permissions": [ "nativeMessaging", "geckoViewAddons", + "nativeMessagingFromContent", "webRequest", "tabs", "webRequestBlocking", diff --git a/app/src/main/assets/readability/test/test-pages/medium-1/expected.html b/app/src/main/assets/readability/test/test-pages/medium-1/expected.html index 5910c623..48e07cc8 100755 --- a/app/src/main/assets/readability/test/test-pages/medium-1/expected.html +++ b/app/src/main/assets/readability/test/test-pages/medium-1/expected.html @@ -149,7 +149,7 @@

We’re still in the early stages of what this project will look like, so if you want to help or have thoughts, let’s talk.

-

pippin@pippinlee.com +

pippin@pippinlee.com

This isn’t supposed to be a manifesto™© diff --git a/app/src/main/assets/readability/test/test-pages/medium-1/source.html b/app/src/main/assets/readability/test/test-pages/medium-1/source.html index 00eb4ae7..9f6920ea 100755 --- a/app/src/main/assets/readability/test/test-pages/medium-1/source.html +++ b/app/src/main/assets/readability/test/test-pages/medium-1/source.html @@ -608,7 +608,7 @@

We’re still in the early stages of what this project will look like, so if you want to help or have thoughts, let’s talk.

-

pippin@pippinlee.com

@@ -696,7 +696,7 @@

diff --git a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java index 3a2a2f73..886998a5 100644 --- a/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java +++ b/app/src/main/java/com/hiddenservices/onionservices/appManager/homeManager/geckoManager/geckoClients.java @@ -8,6 +8,7 @@ import android.os.Handler; import android.util.Log; import android.widget.ImageView; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import com.hiddenservices.onionservices.appManager.activityContextManager; import com.hiddenservices.onionservices.appManager.kotlinHelperLibraries.BrowserIconManager; @@ -39,6 +40,7 @@ import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_DATA; import static org.mozilla.geckoview.StorageController.ClearFlags.SITE_SETTINGS; import org.json.JSONObject; import org.mozilla.geckoview.ContentBlocking; +import org.mozilla.geckoview.GeckoResult; import org.mozilla.geckoview.GeckoRuntime; import org.mozilla.geckoview.GeckoRuntimeSettings; import org.mozilla.geckoview.GeckoView; @@ -243,6 +245,13 @@ public class geckoClients mPort = port; mPort.setDelegate(mPortDelegate); } + + @Override + public GeckoResult onMessage( final @NonNull String nativeApp, final @NonNull Object message, final @NonNull WebExtension.MessageSender sender) { + Log.e("MessageDelegate", "onConnect"); + return null; + } + }; private final WebExtension.PortDelegate mPortDelegate = new WebExtension.PortDelegate() { @@ -266,6 +275,9 @@ public class geckoClients private WebExtension.Port mPort; public void onExtentionClicked(){ try { + if (mPort==null){ + return; + } long id = System.currentTimeMillis(); Log.e("evalJavascript:id:", id + ""); JSONObject jsonObject = new JSONObject(); @@ -293,7 +305,6 @@ public class geckoClients mRuntime = GeckoRuntime.create(context, mSettings.build()); mRuntime.getSettings().setRemoteDebuggingEnabled(true); - installExtension(); mCreated = true; onClearAll(); @@ -311,6 +322,8 @@ public class geckoClients } dataController.getInstance().initializeListData(); + mRuntime.getSettings().setRemoteDebuggingEnabled(true); + installExtension(); } initBrowserManager(); }