fune/devtools/client/netmonitor/shared/components/preview-panel.js
Ricky Chien d76428577f Bug 1328197 - Implement details view r=Honza
MozReview-Commit-ID: 29VdjQzeAZi

--HG--
extra : rebase_source : 11330426fdf5d28bdb062816b41a1b358eb679a4
2017-01-14 16:50:06 +08:00

37 lines
870 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { DOM, PropTypes } = require("devtools/client/shared/vendor/react");
const { div, iframe } = DOM;
/*
* Preview panel component
* Display HTML content within a sandbox enabled iframe
*/
function PreviewPanel({
request,
}) {
const htmlBody = request.responseContent ?
request.responseContent.content.text : "";
return (
div({ className: "panel-container" },
iframe({
sandbox: "",
srcDoc: typeof htmlBody === "string" ? htmlBody : "",
})
)
);
}
PreviewPanel.displayName = "PreviewPanel";
PreviewPanel.propTypes = {
request: PropTypes.object.isRequired,
};
module.exports = PreviewPanel;