Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 409302

Summary: [Chrome] Bad plugin URLs break the Plugin List
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Project Inbox <orion.client-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: simon_kaegi
Version: 3.0Flags: simon_kaegi: review+
Target Milestone: 3.0 RC1   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386080
https://bugs.eclipse.org/bugs/show_bug.cgi?id=409792
Whiteboard:

Description Mark Macdonald CLA 2013-05-28 11:10:27 EDT
1. At some point I installed a plugin from http://127.0.0.3:8080/index.html into my plugin list.
2. That was a temporary site which I then took down. The URL now 404s.
3. When I go to Settings > Plugins, the plugin list fails to load due to an error. This prevents me from uninstalling the plugin.
Comment 1 Mark Macdonald CLA 2013-05-28 11:20:40 EDT
My PluginRegistry seems to be in an inconsistent state: when pluginRegistry.getPlugins() is called, the problematic plugin appears in the list. Its #getLocation() method returns "%3127.0.0.3:8080/index.html" (not sure what the %31 part means).

When we call pluginRegistry.getPlugin() passing that same URL, it returns null. That breaks the page.
Comment 2 Mark Macdonald CLA 2013-06-04 13:44:06 EDT
The root cause is a server problem (see bug 409792), but the plugin list UI should be more robust and not blow up. Will keep this bug for the UI.
Comment 3 Mark Macdonald CLA 2013-06-05 13:36:35 EDT
FWIW: only plugin URLs with a port component (like :8080) will break the UI, and only in Chrome.

This is because browsers differ in how they interpret the bogus plugin URL that is created due to bug 409792:

> var temp = document.createElement("a");
> temp.href = "127.0.0.3:8080/index.html";   // A corrupt plugin URL
> console.log(temp.href);

In Chrome the above code prints:
> "%3127.0.0.3:8080/index.html"
^ That's where the mysterious "%3" comes from: some quirk in Chrome's URL parser.

In Firefox and Safari, it prints:
> "http://localhost:8080/127.0.0.3:8080/index.html"

If the corrupt URL does not contain a port component, Chrome parses it identically to Firefox and Safari and the page UI renders without errors.
Comment 4 Mark Macdonald CLA 2013-06-05 17:25:12 EDT
Here is a candidate fix. It normalizes plugin URLs using URL-shim rather than relying on the browser's built-in URL parsing with <A> tags. This removes Chrome's moronic URL parser from the equation.

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?h=mamacdon/bug409302&id=c292d55814ea859a609313c6277dfe829794b9e3
Comment 5 Mark Macdonald CLA 2013-06-10 11:22:35 EDT
Got the OK from simon, so released:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=f993940