Closed Bug 1344376 Opened 3 years ago Closed 3 years ago

onCreatedNavigationTarget not called when clicking a target="_blank" link

Categories

(WebExtensions :: Request Handling, defect, P1)

54 Branch
defect

Tracking

(firefox54 verified, firefox55 verified)

VERIFIED FIXED
mozilla55
Tracking Status
firefox54 --- verified
firefox55 --- verified

People

(Reporter: u287251, Assigned: rpl)

References

Details

(Keywords: regression, testcase, Whiteboard: triaged)

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170303110153

Steps to reproduce:

1. Unzip and load-temporary-add-on the very simple extension created to reproduce the issue.
2. Open the browser console, to be able to see what the extension is reporting
3. Open the web page http://jessehakanen.net/adblockpluspopupaddon/test.html
4. Click the 3rd entry in the list, "Regular link with 'target="_blank"' attribute"



Actual results:

Nothing was reported at the browser console.

For example, clicking the first entry in the list will cause the onCreatedNavigationTarget to output the argument sent to it by the browser. This is not happening with the 3rd entry.

Also, using the debugger confirms that the listener is not being called.


Expected results:

The onCreatedNavigationTarget listener should have been called, like it is for all other cases.
Component: Untriaged → WebExtensions: Untriaged
Keywords: testcase
Product: Firefox → Toolkit
Assignee: nobody → lgreco
Priority: -- → P1
Whiteboard: triaged
Status: UNCONFIRMED → ASSIGNED
Component: WebExtensions: Untriaged → WebExtensions: Request Handling
Ever confirmed: true
Attachment #8844126 - Flags: review?(wmccloskey)
Hi Bill,
you were right in Bug 1190687, after fixing this issue with the attached patch, I went to re-read one of your comments and I noticed that I misread it :-(

In the attached patch:

- the fix that ensure that the target="_blank" scenario fires the onCreatedNavigationTarget event as expected
- the related additional test cases
Comment on attachment 8844126 [details]
Bug 1344376 - Clicking on a link with target=_blank should fire onCreatedNavigationTarget.

https://reviewboard.mozilla.org/r/117664/#review119788
Attachment #8844126 - Flags: review?(wmccloskey) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/7fc04ff18b6c
Clicking on a link with target=_blank should fire onCreatedNavigationTarget. r=billm
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/7fc04ff18b6c
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Verified as fixed in FF 55
Status: RESOLVED → VERIFIED
Attached image verif1344376.png
Postfix screenshot
Comment on attachment 8844126 [details]
Bug 1344376 - Clicking on a link with target=_blank should fire onCreatedNavigationTarget.

Approval Request Comment

[Feature/Bug causing the regression]:

Bug 1190687 introduced the webNavigation.onCreatedNavigationTarget event in Firefox 54, and this patch (Bug 1344376) fixes a missing scenario that is supposed to fire that event but it doesn't on the implementation currently in Firefox 54. 

[User impact if declined]:

This event is going to be used by the WebExtension version of the "ads blocking" addons (e.g. Adblock Plus and UBlock Origin), and these addons need this event to be fired on this additional scenario to work correctly.

If this uplift request is not accepted, these addons will not be able to block all the ads that have to be caught using this event on Firefox 54, or their port to webextension could be furtherly deferred to Firefox 55. 

[Is this code covered by automated tests?]:

Yes, the other scenarios that should fire the onCreatedNavigationTarget event were already tested by automated tests, 
and this patch contains the one line fix as well as the additional test cases related to it.
(also, Bug 1345722 is a test only change that should be uplifted with this one to prevent these tests to fail intermittently once the new test cases are added by this patch)

[Has the fix been verified in Nightly?]:

Yes

[Needs manual test from QE? If yes, steps to reproduce]:

Yes, it would be helpful to explicitly verify the fix once uplifted, 
the STR is:
- run Firefox build which includes this fix on a new profile
- “xpinstall.signatures.required” preference set to “false” 
- Install the test addon “Back to Source Tab” WebExtension installed (https://addons-dev.allizom.org/en-US/firefox/addon/back-to-the-source-tab-test/ )
- Open the following test page in a new tab: http://jessehakanen.net/adblockpluspopupaddon/test.html
- Open the Browser Console and clear the messages
- Click the third link ("Regular link with 'target="_blank"' attribute")
- In the Browser Console the following new log message should have been logged:

```
webNavigation.onCreatedNavigationTarget event received Object { url: ..., timeStamp: ..., sourceFrameId: 0, tabId: ..., windowId: ..., sourceTabId: ... }
```
 
[List of other uplifts needed for the feature/fix]:

- Bug 1345722 (test-only change, it splits the test file where Bug 1344376 new test cases have been added by this patch to prevent them from failing intermittently)

[Is the change risky?]:

This change should have a low risk

[Why is the change risky/not risky?]:

The fix is small (it is basically a one-line change) and its impact is restricted to the lines of code that has been added by Bug 1344376 (which introduced this event for the first time), most of the patch is composed by the new test cases (which are added to the number of tests that have been already landed as part of Bug 1344376).

[String changes made/needed]:

None
Attachment #8844126 - Flags: approval-mozilla-aurora?
Comment on attachment 8844126 [details]
Bug 1344376 - Clicking on a link with target=_blank should fire onCreatedNavigationTarget.

Fix some potential broken "ads blocking" addons using onCreatedNavigationTarget event and was verified. Aurora54+.
Attachment #8844126 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Verifed as fixed on FF 54
Attached image Postfix screenshot FF54
Product: Toolkit → WebExtensions

For certain reasons the bug occurs again in Firefox Developer Edition 67.0b4 (64-bit)

It can be reproduced exactly in the same way as the original bug report:

  1. Unzip and load-temporary-add-on the very simple extension created to reproduce the issue.
  2. Open the browser console, to be able to see what the extension is reporting
  3. Open the web page http://jessehakanen.net/adblockpluspopupaddon/test.html
  4. Click the 3rd entry in the list, "Regular link with 'target="_blank"' attribute"

I can confirm that the bug is reproducible again. We did a mozregression and the possible source for the issue is Bug 1503681. We added a comment in that bug and added a need info for the assignee.

See Also: → 1543647

Is this issue fixed?

Flags: needinfo?(jmathies)

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression

(In reply to kranthi samala from comment #16)

Is this issue fixed?
according to the resolution, yet. if you're still seeing something like it, you should file a fresh bug.

Flags: needinfo?(jmathies)
You need to log in before you can comment on or make changes to this bug.