Closed Bug 803065 Opened 12 years ago Closed 12 years ago

on Fennec `tabs` module doesn't work in unit test as it works in add-on code

Categories

(Add-on SDK Graveyard :: General, defect, P1)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zer0, Assigned: evold)

References

Details

Attachments

(1 file)

If you write the code below in main.js and run on Fennec:

  require("tabs").open({
    url: "data:text/html,<h1>Hello from add-on</h1>"
  });


It works perfectly fine, opening a tab with an heading saying "Hello from add-on". However, the same code in a unit test: 

  exports["test tabs"] = function(assert, done) {
    require("tabs").open({
      url: "data:text/html,<h1>Hello from test</h1>"
    });
  
    // the `done` call is omitted to have time to
    // look at the result
  };

A new tab is opened, but it's blank.

I run these code on Samsung Galaxy Tab 10.1 and both Firefox release (16.0) and Nightly (19.0a1)
Blocks: 803031
Depends on: 802215
No longer blocks: 803031
No longer depends on: 802215
I removed the dependency from bug 802215 because the issue is not related. To be clear, fix that bug doesn't solve anything here due the fact that the same issue is present in the `test-tabs`, however because access to the tab's content is not critical to those tests, they passes.

I also removed the dependency from bug 803031 because, even if the re-implementation of selection module makes it working on Fennec mostly "as is", due the issue with `tabs` is not possible test it properly. So I will keep this bug separated, and I finalize it as soon `tabs` will work on Fennec also in unit testing.
Sorry, skip the second part of the comment, ("I also...") It was mean to be in another bug. This bug still blocks the implementation of Selection module on Fennec.
Blocks: 803031
This logs correct html, and also fails to display the content.. tho I notice the content is displayed in the tab bar..

  exports.testTabs = function(test) {
    test.waitUntilDone();

    require("tabs").open({
//      url: "data:text/html,<h1>Hello</h1>",
      url: 'data:text/html;charset=utf-8,<html><head><title>Hi</title></head><body><h1>asdfasdfasdf</h1></body></html>',
      onReady: function(tab) {
        tab.attach({
          contentScript: "self.postMessage(document.body.innerHTML)",
          onMessage: function(html) {
        	  console.log("message!")
            console.log(html);
          }
        });
      }
    });

  };
I think this may be because cfx test opens a window that merely says "Running Tests" which isn't displayed on Fennec, but I see it oddly displayed when I play around with the test in comment 3 so I am pretty sure it exists, and it shouldn't..  Assuming it is displayed I could understand that it prevents painting on the main window.
(In reply to Erik Vold [:erikvold] from comment #4)
> I think this may be because cfx test opens a window that merely says
> "Running Tests" which isn't displayed on Fennec, but I see it oddly
> displayed when I play around with the test in comment 3 so I am pretty sure
> it exists, and it shouldn't..  Assuming it is displayed I could understand
> that it prevents painting on the main window.

Ah intuition always points the way! This is the problem, so the question is do we really need that window for Firefox?..
Attachment #672857 - Flags: review?(rFobic)
Assignee: nobody → evold
Blocks: 804187
Attachment #672857 - Flags: review?(rFobic) → review+
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/8ac61592ad337e9ec03cd1946cf981162441b77c
Bug 803065 Running Tests window cannot be used on Fennec, and is not needed

https://github.com/mozilla/addon-sdk/commit/f4291b6472154021fbf8bce6386d690c2e62251d
Merge pull request #622 from erikvold/803065

Fix Bug 803065 Running Tests window cannot be used on Fennec, and is not needed r=@gozala
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
I believe because the last comment of Erik and its revert (https://github.com/mozilla/addon-sdk/commit/062444b7e29d85a229620b40c7cfd17dae65b4f1) this bug should be reopened.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
No longer blocks: 804187
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/6fa7e7b9b07c768637a5df106d83f9b245f5c743
Merge pull request #657 from erikvold/803065

Fix Bug 803065 again (ignoring windows that are not part of test in testTrackWindows) r=@gozala
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: