Closed Bug 719936 Opened 13 years ago Closed 13 years ago

iframeMarkupForEmbeddedChart doesn't work on http://localhost/

Categories

(Webtools Graveyard :: Graph Server, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rniwa, Assigned: rniwa)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.75 Safari/535.7 Steps to reproduce: Go launch Graph Server on http://localhost/ using after setting USE_GENERATED_IMAGES_IN_DASHBOARD to false. Actual results: Iframes fail to load. Expected results: Iframes should load graphs.
The problem is caused by the following statements: var protocol = window.location.protocol; var hostname = window.location.hostname; var pathname = window.location.pathname; pathname = pathname.replace(/\w+\.html/, 'embed.html'); When accessing http://localhost/, there's no file name in the URL and the string replacement doesn't happen.
Attached patch Fixes the bug (obsolete) — Splinter Review
Instead of replacing graph.html by embed.html, just use SERVER + '/embed.html' since SERVER already gives us the absolute path.
Attachment #590281 - Flags: review?(rhelmer)
(In reply to Ryosuke Niwa from comment #2) > Created attachment 590281 [details] [diff] [review] > Fixes the bug > > Instead of replacing graph.html by embed.html, just use SERVER + > '/embed.html' since SERVER already gives us the absolute path. Would you mind doing /embed.html as a relative PATH? The advantage to this is that you can set SERVER to a remote host (to get the JSON data), but test a frontend that is hosted elsewhere (like localhost). Actually the more I think about it, perhaps there should be two different SERVER variables, one for backend and one for frontend (could be set to the same thing by default)...
Assignee: nobody → rniwa
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #590281 - Attachment is obsolete: true
Attachment #590281 - Flags: review?(rhelmer)
Attachment #590372 - Flags: review?(rhelmer)
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
(In reply to Robert Helmer [:rhelmer] from comment #5) > Comment on attachment 590372 [details] [diff] [review] > Fixed per comment > > https://github.com/mozilla/graphs/commit/ > 1930475050fa0401228a42f8174bc731c47691fc Sorry make that https://github.com/mozilla/graphs/commit/5028e19dcb5c20f344307ae302a63db090a26b18 (gave you credit in the commit message) Feel free to use github pull requests and just link them from bugzilla if you'd rather, if patches are easier for you that's no problem of course.
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: