[webkit-reviews] review requested: [Bug 56263] XML Viewer: extensions can't render original XML : [Attachment 85682] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Mar 14 09:08:38 PDT 2011
Vsevolod Vlasov <vsevik at chromium.org> has asked for review:
Bug 56263: XML Viewer: extensions can't render original XML
https://bugs.webkit.org/show_bug.cgi?id=56263
Attachment 85682: Patch
https://bugs.webkit.org/attachment.cgi?id=85682&action=review
------- Additional Comments from Vsevolod Vlasov <vsevik at chromium.org>
Since current xml viewer implementation applies XSL transformation internally,
custom xml tree extensions encounter two problems:
1. Detecting XML without style using code like 'if (document instanceof
XMLDocument)' is not possible anymore.
2. Source XML is hidden from extension - it could only see an XSL
transformation result.
Proposed solution:
1. XML Viewer defines global javascript function with pseudo-unique name
handleWebKitXMLViewerOnLoadEvent(). Extensions could check if this function is
defined.
2. WebKit xml viewer is not shown when window.opener is defined. Running
window.open(document.location, '_self') will turn xml viewer off.
Putting all together, extension with logic like
if (currentDocumentIsXMLWithoutStyle())
showCustomXMLViewer()
Could be rewritten like
if (typeof(window['handleWebKitXMLViewerOnLoadEvent']) == 'function')
window.open(document.location, '_self');
else if (currentDocumentIsXMLWithoutStyle())
showCustomXMLViewer();
The worst impact would be triggering one-time page reload for pages having
'handleWebKitXMLViewerOnLoadEvent()' function defined for some reason.
More information about the webkit-reviews
mailing list