Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: extension/content_script.js

Issue 11450020: (Fix #215) better error printing in editor & extension, adds mapping for editor (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Glue code that runs on the page referencing dart web components. 5 // Glue code that runs on the page referencing dart web components.
6 // Some logic has to be placed here rather than on the background page 6 // Some logic has to be placed here rather than on the background page
7 // because of chrome security restrictions. 7 // because of chrome security restrictions.
8 8
9 // Port used to send requests to the background page to proxy urls. 9 // Port used to send requests to the background page to proxy urls.
10 var proxyPort = null; 10 var proxyPort = null;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // Replace the contents of the existing document with the 54 // Replace the contents of the existing document with the
55 // proxied content at the url with an additional .html added. 55 // proxied content at the url with an additional .html added.
56 // We prefer this versus redirecting to the page with an extra 56 // We prefer this versus redirecting to the page with an extra
57 // .html so that refreshing this page does the right thing. 57 // .html so that refreshing this page does the right thing.
58 var newDoc = document.open("text/html", "replace"); 58 var newDoc = document.open("text/html", "replace");
59 newDoc.write(content); 59 newDoc.write(content);
60 newDoc.close(); 60 newDoc.close();
61 } 61 }
62 } 62 }
63 }, 100); 63 }, 100);
64 } else if (msg.type == 'MESSAGES') {
65 var messages = msg.messages;
66 for (var i = 0; i < messages.length; i++) {
67 window.console.log(messages[i]);
Jennifer Messerly 2012/12/06 04:00:08 console.warn, console.error?
Siggi Cherem (dart-lang) 2012/12/06 18:46:42 ohhh... didn't know we had those :) Done.
68 }
64 } 69 }
65 }) 70 })
66 71
67 } 72 }
68 73
69 document.addEventListener("DOMContentLoaded", function() { 74 document.addEventListener("DOMContentLoaded", function() {
70 // Don't re-run the compiler on code we just generated. 75 // Don't re-run the compiler on code we just generated.
71 if (document.childNodes.length > 1 && 76 if (document.childNodes.length > 1 &&
72 document.childNodes[1] instanceof Comment && 77 document.childNodes[1] instanceof Comment &&
73 document.childNodes[1].nodeValue.indexOf( 78 document.childNodes[1].nodeValue.indexOf(
(...skipping 10 matching lines...) Expand all
84 }); 89 });
85 90
86 window.addEventListener("message", function(event) { 91 window.addEventListener("message", function(event) {
87 if (event.source != window) 92 if (event.source != window)
88 return; 93 return;
89 94
90 if (event.data.type == "PARSE") { 95 if (event.data.type == "PARSE") {
91 onRequestParse(); 96 onRequestParse();
92 } 97 }
93 }, false); 98 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698