Opened 4 years ago

Last modified 3 years ago

#3405 new defect

Multiple unit tests are failing in Adblock Plus for Safari

Reported by: kzar Assignee:
Priority: P4 Milestone:
Module: Platform Keywords: safari, tests
Cc: sebastian Blocked By:
Blocking: Platform: Safari
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Environment

How to reproduce

  1. Build the extension ./build.py -t safari devenv
  2. In Safari click Develop, Show Extension Builder and then load the extension.
  3. Open the options page for Adblock Plus Chrome and then type location.href = "qunit/index.html"; in the JavaScript console.

Observed behaviour

Over 50 tests fail, multiple errors in the JavaScript console.

background.js:100 TypeError: undefined is not an object (evaluating 'safari.application.addEventListener')
initadblockplus.js:136 TypeError: undefined is not an object (evaluating 'ext.storage.migratePrefs')
webrequest.js:18TypeError: undefined is not an object (evaluating 'require("filterNotifier").FilterNotifier')
adblockplus.js:377 TypeError: undefined is not an object (evaluating 'RegExpFilter.typeMap')
url.js:22 TypeError: undefined is not an object (evaluating 'url.getDecodedHostname')
cssEscaping.js:4 TypeError: undefined is not an object (evaluating 'filterClasses.Filter')

Expected behaviour

Tests should pass.

Attachments (1)

errors.txt (17.6 KB) - added by kzar 4 years ago.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by kzar

comment:1 Changed 4 years ago by sebastian

Yes, unittests failed ever since on Safari. That is because, as opposed to Chrome, some APIs most importantly a way to communicate with the background page synchronously, are missing on the content side in Safari.

It seems the only way to make tests actually work on Safari, would be to actually run them in the background page, asynchronously reporting the results, and showing them on the page. I couldn't find a way yet to do that with qunit. If there is a simple way to to that, I'd be happy to accept a patch.

comment:2 Changed 3 years ago by sebastian

  • Priority changed from Unknown to P4
  • Ready set
Note: See TracTickets for help on using tickets.