httpd server shouldn't include guid identifiers in its URI

VERIFIED FIXED

Status

VERIFIED FIXED
8 years ago
2 years ago

People

(Reporter: whimboo, Assigned: k0scist)

Tracking

Details

(Whiteboard: [mozmill-1.4.2+])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

8 years ago
With the current state of the httpd server it will include random guid identifiers into the url. That makes it hard for us to implement some tests with local test data, especially for tests for the search engines. It would require us to create those opensearch xml files on the fly. It would be better when we could use static urls.

Current behavior:
http://localhost:43336/d9746a82d6e8-9c45-9cfe-ad49af65db7d/testfile.js

Wanted behavior:
http://localhost:43336/testfile.js

I wonder if there is any reason why we are using the guids by default. Jeff, can you explain it please?
(Reporter)

Updated

8 years ago
No longer blocks: 554197
Depends on: 554197
(Reporter)

Updated

8 years ago
Whiteboard: [mozmill-1.4.2?]

Updated

8 years ago
Whiteboard: [mozmill-1.4.2?] → [mozmill-1.4.2+]

Updated

8 years ago
Assignee: nobody → jhammel
(Assignee)

Comment 1

8 years ago
(In reply to comment #1)
> I wonder if there is any reason why we are using the guids by default. Jeff,
> can you explain it please?

I assume you mean Jeff Walden?  I have no clue.

The code that does this is here: http://github.com/mikeal/mozmill/blob/master/mozmill/extension/resource/modules/frame.js#L311

{{{
  if (ns == undefined) {
    ns = uuidgen.generateUUID().toString().replace('-', '').replace('{', '').replace('}','');
  }
  var lp = Components.classes["@mozilla.org/file/local;1"]
             .createInstance(Components.interfaces.nsILocalFile);
  lp.initWithPath(os.abspath(directory, this.current_file));
  this.httpd.registerDirectory('/'+ns+'/', lp);
}}}

If there is no reason not to take this out, then this should fix the problem.
}}}
(Assignee)

Comment 2

8 years ago
Created attachment 450152 [details] [diff] [review]
patch to remove UUIDs from the server

this will/should remove the UUIDs from the http server. untested
Attachment #450152 - Flags: review?(hskupin)
(Assignee)

Comment 3

8 years ago
(In reply to comment #2)
> Created an attachment (id=450152) [details]
> patch to remove UUIDs from the server
> 
> this will/should remove the UUIDs from the http server. untested

Doing this causes 5 new failures (the one that looks fixed is probably a red herring):

> diff before.txt after.txt 
2d1
< Test Failed : testRestoreHomeToDefault in /home/jhammel/mozmill/src/mozmill-tests/firefox/testPreferences/testRestoreHomepageToDefault.js
11a11
> Test Failed : testScrollBackgroundTabIntoView in /home/jhammel/mozmill/src/mozmill-tests/firefox/testTabbedBrowsing/testBackgroundTabScrolling.js
14a15,16
> Test Failed : testOpenInBackgroundTab in /home/jhammel/mozmill/src/mozmill-tests/firefox/testTabbedBrowsing/testOpenInBackground.js
> Test Failed : testPermissionsDisabled in /home/jhammel/mozmill/src/mozmill-tests/firefox/testPrivateBrowsing/testDisabledPermissions.js
34a37,38
> Test Failed : testPopUpBlocked in /home/jhammel/mozmill/src/mozmill-tests/firefox/testPopups/testPopupsBlocked.js
> Test Failed : testUndoTabFromContextMenu in /home/jhammel/mozmill/src/mozmill-tests/firefox/testSessionStore/testUndoTabFromContextMenu.js
42c46
< Passed 186 :: Failed 29 :: Skipped 7
---
> Passed 182 :: Failed 33 :: Skipped 7
(Reporter)

Comment 4

8 years ago
Comment on attachment 450152 [details] [diff] [review]
patch to remove UUIDs from the server

>   if (ns == undefined) {
>-    ns = uuidgen.generateUUID().toString().replace('-', '').replace('{', '').replace('}','');
>+      ns = '/';
>   }
>+  else {
>+      ns = '/' + ns + '/';
>+  }

We have an indentation of 2 characters in JS. Can you use the comprehensive style (?:) here?

>   var lp = Components.classes["@mozilla.org/file/local;1"]
>              .createInstance(Components.interfaces.nsILocalFile);

Put the dot at the end of the first line and align createInstace with Components. Haven't we Cc and Ci defined as short names?

>+  this.httpd.registerDirectory(ns, lp);
>+  return 'http://localhost:'+this.http_port+ns

Please add spaces between the operands.

> }
> Collector.prototype.initTestModule = function (filename) {
>   var test_module = loadFile(filename, this);

Can you please add a blank line between those two functions while we are already here?

One thing I'm just wondering about, why do we have two slashes in the url between the port and the path?

With those changes r=me.
Attachment #450152 - Flags: review?(hskupin) → review+
(Reporter)

Comment 5

8 years ago
(In reply to comment #3)
> Doing this causes 5 new failures (the one that looks fixed is probably a red
> herring):

You should better run those tests with Namoroka or Shiretoko builds. Tests for 1.9.3 are currently broken in some areas. That said I can't see that it should break something on our end.
(Assignee)

Comment 6

8 years ago
Created attachment 450263 [details] [diff] [review]
updated patch to remove UUIDs

carrying r+ from whimboo and obsolescent patch
Attachment #450152 - Attachment is obsolete: true
Attachment #450263 - Flags: review+
(Assignee)

Comment 7

8 years ago
(In reply to comment #4)
> (From update of attachment 450152 [details] [diff] [review])
> >   if (ns == undefined) {
> >-    ns = uuidgen.generateUUID().toString().replace('-', '').replace('{', '').replace('}','');
> >+      ns = '/';
> >   }
> >+  else {
> >+      ns = '/' + ns + '/';
> >+  }
> 
> We have an indentation of 2 characters in JS. Can you use the comprehensive
> style (?:) here?

Corrected.  Sorry about that.
 
> >   var lp = Components.classes["@mozilla.org/file/local;1"]
> >              .createInstance(Components.interfaces.nsILocalFile);
> 
> Put the dot at the end of the first line and align createInstace with
> Components. Haven't we Cc and Ci defined as short names?

Not at file-scope, no.  Fixed, even though it was not part of my original patch.

> >+  this.httpd.registerDirectory(ns, lp);
> >+  return 'http://localhost:'+this.http_port+ns
> 
> Please add spaces between the operands.

Done.

> > }
> > Collector.prototype.initTestModule = function (filename) {
> >   var test_module = loadFile(filename, this);
> 
> Can you please add a blank line between those two functions while we are
> already here?

Done.

> One thing I'm just wondering about, why do we have two slashes in the url
> between the port and the path?

I think I figured this out.  At least, I have a theory.  Originally (and in the old patch), the check was for ns being undefined.  I have replaced this with `if(!ns)` which should cover the case where ns is '' or other non-value.  I hope this fixes.

> With those changes r=me.

New patch at https://bugzilla.mozilla.org/attachment.cgi?id=450263
(Assignee)

Comment 8

8 years ago
(In reply to comment #5)
> (In reply to comment #3)
> > Doing this causes 5 new failures (the one that looks fixed is probably a red
> > herring):
> 
> You should better run those tests with Namoroka or Shiretoko builds. Tests for
> 1.9.3 are currently broken in some areas. That said I can't see that it should
> break something on our end.

Who is going to be the point-person(s) on fixing tests?
(Assignee)

Comment 9

8 years ago
 
> > One thing I'm just wondering about, why do we have two slashes in the url
> > between the port and the path?
> 
> I think I figured this out.  

It turns out I was wrong.  I have no idea where the extra slash comes from.  Are the tests putting it in?  That's the only place I would know to look.  I'm unfamiliar with httpd, so it's possible it's happening internally there.  

I would guess fixing this will at fix the 5(ish) failing tests caused by this patch.
(Reporter)

Comment 10

8 years ago
Comment on attachment 450263 [details] [diff] [review]
updated patch to remove UUIDs

>+  else {
>+    ns = '/' + ns + '/';
>+  }

Nearly fine now. else should be one line higher. I will update it before I check this in.

(In reply to comment #8)
> Who is going to be the point-person(s) on fixing tests?

I'm the one who assigns tasks to Geo, Anthony, and myself. It's still quite a lot of work to do.

Regarding the double slashes, it's the problem in our tests. I have figured out why it happens and Anthony will work on fixing it with his work on bug 568008.
(Reporter)

Comment 11

8 years ago
Landed as:
http://github.com/mikeal/mozmill/commit/a43c8163a8f171eb07f01bfeb89a5a6ceed170ba
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Reporter)

Updated

8 years ago
No longer depends on: 554197
(Reporter)

Comment 12

8 years ago
Tested with the developer version of Mozmill and the patch checked in. Works fantastic with and without a namespace => Verified.
Status: RESOLVED → VERIFIED
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.