Failure in places.js when restoring the default bookmarks: "importer.importHTMLFromURI is not a function"

RESOLVED FIXED

Status

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: vladmaniac, Assigned: whimboo)

Tracking

({regression})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [lib], )

Attachments

(1 attachment)

Build ID: 
Build identifier: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120325 Firefox/14.0a1
Build from: http://hg.mozilla.org/mozilla-central/rev/20a01901480f 
---------------------------------------------------------------------------------------
Mozmill version: 1.5.9
---------------------------------------------------------------------------------------
Reproducible: YES 
---------------------------------------------------------------------------------------
Error: 
restoreDefaultBookmarks()@resource://mozmill/stdlib/securable-module.js -> file:///tmp/tmpdv0fUN.mozmill-tests/lib/places.js:145 teardownModule([object Object])@resource://mozmill/modules/frame.js -> file:///tmp/tmpdv0fUN.mozmill-tests/tests/endurance/testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js:61 ([object Function],[object Object])@resource://mozmill/modules/frame.js:552 ([object Object])@resource://mozmill/modules/frame.js:649 ([object Object])@resource://mozmill/modules/frame.js:669 ("/tmp/tmpdv0fUN.mozmill-tests/tests/endurance/testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js")@resource://mozmill/modules/frame.js:506 ("/tmp/tmpdv0fUN.mozmill-tests/tests/endurance/testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js")@resource://mozmill/modules/frame.js:681 ([object Function],[object Array])@resource://jsbridge/modules/server.js:179 ("f5b42282-7724-11e1-a3d3-6cf049905903",[object Function],[object Array])@resource://jsbridge/modules/server.js:183 @resource://jsbridge/modules/server.js:283 
---------------------------------------------------------------------------------------
Local report: 
http://mozmill-crowd.blargon7.com/#/endurance/report/d7273b70010f02a4bbdbf44f172e21c6
---------------------------------------------------------------------------------------
Error report: 
http://mozmill-release.blargon7.com/#/endurance/report/d7273b70010f02a4bbdbf44f172e175b
---------------------------------------------------------------------------------------
First time failure: 
2012-03-25 
---------------------------------------------------------------------------------------
Investigation details: 

Failures are reproducible locally (see local report) on Ubuntu and Mac systems. Code in teardownModule fails, specifically this callback: 

           'places.restoreDefaultBookmarks();' 

Went further in the test API and found the exact code line which triggers the problem: 
            
           '// Fire off the import
            var bookmarksURI = utils.createURI(BOOKMARKS_RESOURCE);
            var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
                           getService(Ci.nsIPlacesImportExportService);
            // XXX: FAILS 
            importer.importHTMLFromURI(bookmarksURI, true);'

The mxr.mozilla.org shows that 'importer.importHTMLFromURI' from /browser/components/nsBrowserGlue.js is not present for the default branch anymore. It is present for mozilla-aurora, mozilla-beta, mozilla-release branches.
Reporter

Updated

7 years ago
Whiteboard: [mozmill-test-failure][mozmill-endurance]
Pleaese check which patch for Firefox has been removed this method and mark the corresponding bug to block.
Keywords: regression
(In reply to Henrik Skupin (:whimboo) from comment #1)
> Pleaese check which patch for Firefox has been removed this method and mark
> the corresponding bug to block.

Of course, that would be the next thing to do - reported the bug with the info so far, not to delay the report any further until the investigation and fix are provided
Reporter

Updated

7 years ago
Assignee: nobody → vlad.mozbugs
Status: NEW → ASSIGNED
Marking dependency, the following attachment removed our method 

https://bug482911.bugzilla.mozilla.org/attachment.cgi?id=608326
Depends on: 482911
Looks like what we need is:

Components.utils.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
BookmarkHTMLUtils.importFromURL(fp.fileURL.spec, false);
Assignee: vlad.mozbugs → nobody
Component: Mozmill Tests → Mozmill Shared Modules
OS: Linux → All
QA Contact: mozmill-tests → mozmill-shared-modules
Hardware: x86 → All
(In reply to Henrik Skupin (:whimboo) from comment #4)
> Looks like what we need is:
> 
> Components.utils.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
> BookmarkHTMLUtils.importFromURL(fp.fileURL.spec, false);

Yes, but not only that - We need to re-think our helper function because we don't add Observer's anymore to ensure that bookmarks are created. 

If we try only those two lines, the above method 

var importObserver = {
    observe: function (aSubject, aTopic, aData) {
      if (aTopic == TOPIC_BOOKMARKS_RESTORE_SUCCESS) {
        importSuccessful = true;
      }
    } 

will have 'importSuccessful = false' all the time and we will fail with a timeout 
on the next waitFor, meaning this code here 

mozmill.utils.waitFor(function () {
      return importSuccessful;
    }, "Default bookmarks have finished importing", BOOKMARKS_TIMEOUT);
  }

So its not that easy
This kind of problem wouldn't happen if mozmill tests lived in m-c (developers would identify the issue before patches landed). I haven't followed mozmill development closely, though I vaguely recall that there were some mozmill tests in m-c at one point - did we abandon that as a goal?
(In reply to Maniac Vlad Florin (:vladmaniac) from comment #5)
> Yes, but not only that - We need to re-think our helper function because we
> don't add Observer's anymore to ensure that bookmarks are created. 
> 
> So its not that easy

Not exactly sure what you are talking about, but I will come up with a simple fix in a bit.

(In reply to Gavin Sharp (use gavin@gavinsharp.com for email) from comment #6)
> followed mozmill development closely, though I vaguely recall that there
> were some mozmill tests in m-c at one point - did we abandon that as a goal?

Yes we had but we were dropped due to instabilities. We will not try it again before we haven't moved to Mozmill 2.0 which is way more stable. Work on this will largely happen in Q2/2012.
Assignee: nobody → hskupin
Summary: Mozmill endurance tests /testBookmarks_AddAndRemoveBookmarkViaAwesomeBar/test1.js and /testBookmarks_OpenAllInTabs/test1.js failing with "importer.importHTMLFromURI is not a function " → Failure in places.js when restoring the default bookmarks: "importer.importHTMLFromURI is not a function"
Whiteboard: [mozmill-test-failure][mozmill-endurance] → [mozmill-test-failure]
Posted patch Patch v1Splinter Review
Simply drops the observer calls and replaces the two before mentioned lines. Also a bit of clean-up beside.
Attachment #609381 - Flags: review?(gmealer)
Comment on attachment 609381 [details] [diff] [review]
Patch v1

Review of attachment 609381 [details] [diff] [review]:
-----------------------------------------------------------------

Looks fine, r+
Attachment #609381 - Flags: review?(gmealer) → review+
Landed as:
http://hg.mozilla.org/qa/mozmill-tests/rev/f8eea8acb43a
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Component: Mozmill Shared Modules → Mozmill Tests
Whiteboard: [mozmill-test-failure] → [lib]
You need to log in before you can comment on or make changes to this bug.