• joepeck@webkit.org's avatar
    Web Inspector: Download Web Archive of Inspected Page · e061c7f1
    joepeck@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=119774
    
    Reviewed by Timothy Hatcher.
    
    Source/WebCore:
    
    Add PageAgent.archive which will return a Base-64 encoded web archive
    when successful. In order to then allow saving non-string files, extend
    InspectorFrontendHost.save to allow for Base-64 encoded data.
    
    * inspector/Inspector.json:
    * inspector/InspectorPageAgent.cpp:
    (WebCore::InspectorPageAgent::archive):
    * inspector/InspectorPageAgent.h:
    Introduce and implement PageAgent.archive. Create a Web Archive of the
    page's main frame.
    
    * inspector/InspectorFrontendClient.h:
    * inspector/InspectorFrontendClientLocal.h:
    (WebCore::InspectorFrontendClientLocal::save):
    * inspector/InspectorFrontendHost.cpp:
    (WebCore::InspectorFrontendHost::save):
    * inspector/InspectorFrontendHost.h:
    * inspector/InspectorFrontendHost.idl:
    Extend InspectorFrontendHost.save to include a base64Encoded param.
    
    * inspector/front-end/FileManager.js:
    * inspector/front-end/InspectorFrontendHostStub.js:
    (.WebInspector.InspectorFrontendHostStub.prototype.save):
    Misc. updates to the old inspector for function changes.
    
    Source/WebInspectorUI:
    
    * UserInterface/ContentBrowser.js:
    (WebInspector.ContentBrowser.prototype._saveDataToFile):
    Allow a custom save handler which will do all the work.
    
    * UserInterface/DOMTreeContentView.js:
    (WebInspector.DOMTreeContentView):
    (WebInspector.DOMTreeContentView.prototype.get supportsSave):
    (WebInspector.DOMTreeContentView.prototype.get saveData.saveHandler):
    (WebInspector.DOMTreeContentView.prototype.get saveData):
    Allow Save keyboard shortcut to download an archive viewing the DOM Tree.
    
    * UserInterface/ResourceTreeElement.js:
    (WebInspector.ResourceTreeElement.prototype._updateStatus):
    * UserInterface/FrameTreeElement.js:
    (WebInspector.FrameTreeElement):
    (WebInspector.FrameTreeElement.prototype.updateStatusForMainFrame):
    (WebInspector.FrameTreeElement.prototype._mainResourceDidChange):
    (WebInspector.FrameTreeElement.prototype._shouldGroupIntoFolders):
    (WebInspector.FrameTreeElement.prototype._reloadPageClicked):
    (WebInspector.FrameTreeElement.prototype._downloadButtonClicked):
    (WebInspector.FrameTreeElement.prototype._updateDownloadButton):
    (WebInspector.FrameTreeElement.prototype._pageArchiveStarted):
    (WebInspector.FrameTreeElement.prototype._pageArchiveEnded):
    Move handling of main frame TreeElement buttons to FrameTreeElement.
    Add a Download button, and enable/disable it appropriately.
    
    * UserInterface/ResourceTreeElement.css:
    * UserInterface/TreeElementStatusButton.css: Copied from Source/WebInspectorUI/UserInterface/ResourceTreeElement.css.
    (.item > .status > .status-button):
    (.item > .status > .status-button > svg *):
    (.item.selected > .status > .status-button > svg *):
    (.item.selected > .status > .status-button:active > svg *):
    (.item > .status > .status-button.disabled > svg *):
    (.item.selected > .status > .status-button.disabled > svg *):
    * UserInterface/TreeElementStatusButton.js: Added.
    (WebInspector.TreeElementStatusButton):
    (WebInspector.TreeElementStatusButton.prototype.get element):
    (WebInspector.TreeElementStatusButton.prototype.get hidden):
    (WebInspector.TreeElementStatusButton.prototype.set hidden):
    (WebInspector.TreeElementStatusButton.prototype.get enabled):
    (WebInspector.TreeElementStatusButton.prototype.set enabled):
    (WebInspector.TreeElementStatusButton.prototype._clicked):
    Make buttons in the TreeElement status a generic class to share styling
    and handling of the buttons. New "disabled" state with even more
    transparent is used when the page is downloading.
    
    * UserInterface/Main.html:
    * UserInterface/Main.js:
    (WebInspector.archiveMainFrame):
    (WebInspector.canArchiveMainFrame):
    Generic API for archiving the page and determining if you can archive it.
    
    * UserInterface/InspectorBackendCommands.js:
    * UserInterface/InspectorFrontendHostStub.js:
    (.WebInspector.InspectorFrontendHostStub.prototype.save):
    * UserInterface/Images/DownloadArrow.svg: Added.
    * Localizations/en.lproj/localizedStrings.js:
    Misc. updates and new files.
    
    Source/WebKit/mac:
    
    Update to support InspectorFrontendHost.save's new base64Encoded
    parameter. It means the incoming content is binary data, not a string.
    
    * WebCoreSupport/WebInspectorClient.h:
    * WebCoreSupport/WebInspectorClient.mm:
    (WebInspectorFrontendClient::save):
    
    Source/WebKit2:
    
    Update to support InspectorFrontendHost.save's new base64Encoded
    parameter. It means the incoming content is binary data, not a string.
    
    * UIProcess/WebInspectorProxy.cpp:
    (WebKit::WebInspectorProxy::save):
    * UIProcess/WebInspectorProxy.h:
    * UIProcess/WebInspectorProxy.messages.in:
    * UIProcess/efl/WebInspectorProxyEfl.cpp:
    (WebKit::WebInspectorProxy::platformSave):
    * UIProcess/gtk/WebInspectorProxyGtk.cpp:
    (WebKit::WebInspectorProxy::platformSave):
    * UIProcess/mac/WebInspectorProxyMac.mm:
    (WebKit::WebInspectorProxy::platformSave):
    * UIProcess/qt/WebInspectorProxyQt.cpp:
    (WebKit::WebInspectorProxy::platformSave):
    * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
    (WebKit::WebInspectorFrontendClient::save):
    * WebProcess/WebCoreSupport/WebInspectorFrontendClient.h:
    * WebProcess/WebPage/WebInspector.cpp:
    (WebKit::WebInspector::save):
    * WebProcess/WebPage/WebInspector.h:
    
    LayoutTests:
    
    * inspector-protocol/page/archive-expected.txt: Added.
    * inspector-protocol/page/archive.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e061c7f1
Main.html 20.3 KB