| Index: sky/framework/inspector/page-agent.sky
|
| diff --git a/sky/framework/inspector/page-agent.sky b/sky/framework/inspector/page-agent.sky
|
| index 2157b770bd0983519ffb9e6e3c6509e79131b15a..a489e4be50e233feb493ca8133545423ca4cfabe 100644
|
| --- a/sky/framework/inspector/page-agent.sky
|
| +++ b/sky/framework/inspector/page-agent.sky
|
| @@ -1,37 +1,57 @@
|
| <import src="/sky/framework/xmlhttprequest.sky" as="XMLHttpRequest" />
|
| <script>
|
| -function Page(delegate) {
|
| - this.delegate_ = delegate;
|
| -}
|
| -
|
| -Page.prototype.enable = function() {
|
| -};
|
| +class Page {
|
| + constructor(delegate) {
|
| + this.delegate_ = delegate;
|
| + Object.preventExtensions(this);
|
| + }
|
|
|
| -Page.prototype.canScreencast = function() {
|
| - return {
|
| - result: false
|
| - };
|
| -};
|
| + enable() {
|
| + }
|
|
|
| -Page.prototype.canEmulate = function() {
|
| - return {
|
| - result: false
|
| - };
|
| -};
|
| + canScreencast() {
|
| + return {
|
| + result: false
|
| + };
|
| + }
|
|
|
| -Page.prototype.getResourceContent = function(params, messageId) {
|
| - var request = new XMLHttpRequest;
|
| - request.onload = function() {
|
| - var message = {
|
| - 'content' : request.responseText,
|
| + canEmulate() {
|
| + return {
|
| + result: false
|
| };
|
| - this.delegate_.sendResponse(messageId, message);
|
| - }.bind(this);
|
| - request.open("GET", params.url);
|
| - request.send();
|
| + }
|
| +
|
| + getResourceContent(params, messageId) {
|
| + var request = new XMLHttpRequest;
|
| + request.onload = function() {
|
| + var message = {
|
| + 'content' : request.responseText,
|
| + };
|
| + this.delegate_.sendResponse(messageId, message);
|
| + }.bind(this);
|
| + request.open("GET", params.url);
|
| + request.send();
|
|
|
| - return this.delegate_.ASYNC_RESPONSE;
|
| -};
|
| + return this.delegate_.ASYNC_RESPONSE;
|
| + }
|
| +
|
| + getResourceTree() {
|
| + // Unclear if this is all needed, but if we don't return something here
|
| + // the inspector hits an exception in WebInspector.ResourceTreeModel.
|
| + return {
|
| + "frameTree": {
|
| + "frame": {
|
| + "id": "1",
|
| + "loaderId": "1",
|
| + "url": String(document.URL),
|
| + "mimeType": "text/html",
|
| + "securityOrigin": String(document.URL),
|
| + },
|
| + "resources": arrayFromIterator(resourcesMapForSubtree(document).values()),
|
| + }
|
| + };
|
| + }
|
| +}
|
|
|
| // FIXME: ES6 has Array.from which theoretically does this.
|
| function arrayFromIterator(iterator) {
|
| @@ -46,7 +66,7 @@ function forEachInNodeList(array, callback, scope) {
|
| for (var i = 0; i < array.length; i++) {
|
| callback.call(scope, array[i]);
|
| }
|
| -};
|
| +}
|
|
|
| function addResource(map, url, type, mimeType) {
|
| // Be sure to string the url object since has(new Object)
|
| @@ -84,22 +104,5 @@ function resourcesMapForSubtree(root_doc) {
|
| return map;
|
| }
|
|
|
| -Page.prototype.getResourceTree = function() {
|
| - // Unclear if this is all needed, but if we don't return something here
|
| - // the inspector hits an exception in WebInspector.ResourceTreeModel.
|
| - return {
|
| - "frameTree": {
|
| - "frame": {
|
| - "id": "1",
|
| - "loaderId": "1",
|
| - "url": String(document.URL),
|
| - "mimeType": "text/html",
|
| - "securityOrigin": String(document.URL),
|
| - },
|
| - "resources": arrayFromIterator(resourcesMapForSubtree(document).values()),
|
| - }
|
| - };
|
| -};
|
| -
|
| module.exports = Page;
|
| </script>
|
|
|