Bug 117927 - Web Inspector: WebInspector.displayNameForURL() failure prevents DOM inspection
Summary: Web Inspector: WebInspector.displayNameForURL() failure prevents DOM inspection
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Antoine Quint
Keywords: InRadar
Depends on:
Reported: 2013-06-24 03:02 PDT by Antoine Quint
Modified: 2013-06-24 11:06 PDT (History)
5 users (show)

See Also:

Patch (1.70 KB, patch)
2013-06-24 06:09 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (1.72 KB, patch)
2013-06-24 06:18 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2013-06-24 03:02:37 PDT
If I go to http://www.lequipe.fr/Football/Actualites/Menez-attend-un-signe/380997#xtor=RSS-1, I can't inspect the page due to the following failure:

[Error] URIError: URI error
	displayNameForURL (Main.js, line 2894)
	_updateTitles (Main.js, line 2895)
	_updateResource (Main.js, line 2893)
	ResourceTreeElement (Main.js, line 2876)
	_addTreeElementForRepresentedObject (Main.js, line 3014)
	onpopulate (Main.js, line 2980)
	expand (Main.js, line 2405)
	_attach (Main.js, line 2364)
	insertChild (Main.js, line 2230)
	_mainFrameDidChange (Main.js, line 2743)
	dispatch (Main.js, line 278)
	dispatchEventToListeners (Main.js, line 280)
	_mainFrameDidChange (Main.js, line 1514)
	_processMainFrameResourceTreePayload (Main.js, line 1500)
	(anonymous function)
	dispatch (Main.js, line 388)
	dispatchNextQueuedMessageFromBackend (Main.js, line 8396)
	(anonymous function)
Comment 1 Radar WebKit Bug Importer 2013-06-24 03:02:55 PDT
Comment 2 Antoine Quint 2013-06-24 03:30:05 PDT
The error is coming from calling decodeURIComponent() with this string as the value for urlComponents.lastPathComponent:

http://ww84.smartadserver.com/call2/pubjallajax/2368/17167/2077,2078,647,2163,7186,7185,630,713,650,1278,7186,631,3075,4738,736,632,12340,1075,1446,651,648,16752/4891911503/xtor%3DRSS-1%3Bsize%3Dsmall%3BFOOTBALL%3BLIGUE_1%3BSAISON_2012-2013%3BPARIS-SG%3BMENEZ_JEREMY%3BTRANSFERTS_FOOTBALL%3BMERCATO_ETE_2013%3BINFO_L_%C9QUIPE%3BD1%3B? xtor%3DRSS-1%3Bsize%3Dsmall%3BFOOTBALL%3BLIGUE_1%3BSAISON_2012-2013%3BPARIS-SG%3BMENEZ_JEREMY%3BTRANSFERTS_FOOTBALL%3BMERCATO_ETE_2013%3BINFO_L_%C9QUIPE%3BD1%3B
Comment 3 Antoine Quint 2013-06-24 05:49:32 PDT
It looks like urlComponents.lastPathComponent is just set incorrectly.
Comment 4 Antoine Quint 2013-06-24 05:53:41 PDT
The problematic string passed todecodeURIComponent() is actually "xtor%3DRSS-1%3Bsize%3Dsmall%3BFOOTBALL%3BLIGUE_1%3BSAISON_2012-2013%3BPARIS-SG%3BMENEZ_JEREMY%3BTRANSFERTS_FOOTBALL%3BMERCATO_ETE_2013%3BINFO_L_%C9QUIPE%3BD1%3B"
Comment 5 Antoine Quint 2013-06-24 05:57:07 PDT
"%C9" is the part of the string that yields the decodeURIComponent exception.
Comment 6 Antoine Quint 2013-06-24 06:03:33 PDT
Looks like the URI encoding is incorrect, and "É" should be "%C3%89" and not "%C9", although some pages on the internets seem to suggest that's OK (http://www.degraeve.com/reference/urlencoding.php). But the RFC 3986 (http://tools.ietf.org/html/rfc3986) suggests otherwise (first full paragraph of page 16). We should just handle the possible exception thrown by decodeURIComponent() here.
Comment 7 Antoine Quint 2013-06-24 06:09:34 PDT
Created attachment 205288 [details]
Comment 8 Timothy Hatcher 2013-06-24 06:15:28 PDT
Comment on attachment 205288 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=205288&action=review

We should probably guard WebInspector.updateWindowTitle and parseQueryString too.

> Source/WebInspectorUI/UserInterface/Main.js:360
> +        displayName = decodeURIComponent(urlComponents.lastPathComponent || "");
> +    } catch (e) {
> +        // Ignore possible URIError.

We should fallback to urlComponents.lastPathComponent (not decoded) for displayName in the catch.
Comment 9 Antoine Quint 2013-06-24 06:18:35 PDT
Created attachment 205289 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2013-06-24 11:06:52 PDT
Comment on attachment 205289 [details]
Patch for landing

Clearing flags on attachment: 205289

Committed r151918: <http://trac.webkit.org/changeset/151918>
Comment 11 WebKit Commit Bot 2013-06-24 11:06:55 PDT
All reviewed patches have been landed.  Closing bug.