Opened on 10/17/2016 at 01:55:38 PM

Closed on 10/17/2016 at 02:46:24 PM

#4543 closed defect (fixed)

Failed to extract domain

Reported by: asmirnov Assignee: asmirnov
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: Blocked By:
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29351744/#ps29357635

Description

Environment

We need to extract domain from URL and pass it to filterEngine.getElementHidingSelectors() invocation. Currently we're using java's new URI() to extract domain. We're passing url that comes from onPageStarted callback and for some urls it fails, f.e.:

10-17 09:47:33.033 9188-9188 D/AdblockWebView: Start loading http://www.samsung.com/ru/consumer/mobile-devices/smartphones/galaxy-s/galaxy-s7/?cid=ru_sem_googleru_topgalaxys7brand_20160402&utm_source=google&utm_medium=cpc&utm_campaign=395828594&utm_content=ch_google_adwords|trg_aud-195172024634:kwd-37599011983|crt_126770374874|kwmt_p|ps_1t1|srct_g|trgt_|src_|devt_m|devm_|cid_395828594|lcl_1012052|fdi_|mrlid_5021|dop_&utm_term=galaxy%20s%207
10-17 09:47:33.033 9188-9188 D/AdblockWebView: domain=www.samsung.com
10-17 09:47:37.493 9188-9188 E/AdblockWebView: Failed to extract domain for http://www.samsung.com/ru/consumer/mobile-devices/smartphones/galaxy-s/galaxy-s7/?cid=ru_sem_googleru_topgalaxys7brand_20160402&utm_source=google&utm_medium=cpc&utm_campaign=395828594&utm_content=ch_google_adwords|trg_aud-195172024634:kwd-37599011983|crt_126770374874|kwmt_p|ps_1t1|srct_g|trgt_|src_|devt_m|devm_|cid_395828594|lcl_1012052|fdi_|mrlid_5021|dop_&utm_term=galaxy%20s%207
                                               java.net.URISyntaxException: Illegal character in query at index 213: http://www.samsung.com/ru/consumer/mobile-devices/smartphones/galaxy-s/galaxy-s7/?cid=ru_sem_googleru_topgalaxys7brand_20160402&utm_source=google&utm_medium=cpc&utm_campaign=395828594&utm_content=ch_google_adwords|trg_aud-195172024634:kwd-37599011983|crt_126770374874|kwmt_p|ps_1t1|srct_g|trgt_|src_|devt_m|devm_|cid_395828594|lcl_1012052|fdi_|mrlid_5021|dop_&utm_term=galaxy%20s%207
                                                   at libcore.net.UriCodec.validate(UriCodec.java:63)
                                                   at java.net.URI.parseURI(URI.java:406)
                                                   at java.net.URI.<init>(URI.java:204)
                                                   at org.adblockplus.android.Utils.getDomain(Utils.java:116)
                                                   at org.adblockplus.android.AdblockWebView.startAbpLoading(AdblockWebView.java:1325)
                                                   at org.adblockplus.android.AdblockWebView.access$900(AdblockWebView.java:71)
                                                   at org.adblockplus.android.AdblockWebView$AdblockWebViewClient.onPageStarted(AdblockWebView.java:687)
                                                   at com.android.webview.chromium.WebViewContentsClientAdapter.onPageStarted(WebViewContentsClientAdapter.java:438)
                                                   at com.android.org.chromium.android_webview.AwContentsClientCallbackHelper$1.handleMessage(AwContentsClientCallbackHelper.java:100)
                                                   at android.os.Handler.dispatchMessage(Handler.java:102)
                                                   at android.os.Looper.loop(Looper.java:136)
                                                   at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                   at java.lang.reflect.Method.invokeNative(Native Method)
                                                   at java.lang.reflect.Method.invoke(Method.java:515)
                                                   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                   at dalvik.system.NativeStart.main(Native Method)

How to reproduce

  1. Go to google.com
  2. Make sure you're redirected to google.ru
  3. search "galaxy s7"
  4. click the first in-line ads (to samsung website)
  5. make sure "feailed to extract domain" log entry in the log

Happens in Lightning browser 91, 92.

Observed behaviour

Exception thrown

Expected behaviour

It should be able to extract domain even if it has errors after it.

Attachments (0)

Change History (2)

comment:1 Changed on 10/17/2016 at 02:36:08 PM by asmirnov

Tested in AdblockWebView app:

10-17 10:35:11.375 2857-2857 D/AdblockWebView: Extracted domain www.samsung.com from http://www.samsung.com/ru/consumer/mobile-devices/smartphones/galaxy-s/galaxy-s7/?cid=ru_sem_googleru_topgalaxys7brand_20160402&utm_source=google&utm_medium=cpc&utm_campaign=395828594&utm_content=ch_google_adwords|trg_aud-195172024634:kwd-37599011983|crt_126770374874|kwmt_p|ps_1t1|srct_g|trgt_|src_|devt_m|devm_|cid_395828594|lcl_1012052|fdi_|mrlid_5021|dop_&utm_term=galaxy%20s%207

comment:2 Changed on 10/17/2016 at 02:46:24 PM by asmirnov

  • Resolution set to fixed
  • Review URL(s) modified (diff)
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from asmirnov.
 
Note: See TracTickets for help on using tickets.