You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Mike Stay (JIRA)" <ji...@apache.org> on 2009/10/01 21:00:24 UTC

[jira] Issue Comment Edited: (SHINDIG-1185) Wrap console.log instead of directly exposing console

    [ https://issues.apache.org/jira/browse/SHINDIG-1185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12761302#action_12761302 ] 

Mike Stay edited comment on SHINDIG-1185 at 10/1/09 11:59 AM:
--------------------------------------------------------------

The patch:

Index: features/src/main/javascript/features/caja/taming.js
===================================================================
--- features/src/main/javascript/features/caja/taming.js	(revision 820746)
+++ features/src/main/javascript/features/caja/taming.js	(working copy)
@@ -939,7 +939,9 @@
   ___.grantFunc(imports.outers, 'alert');
 
   if (console && console.log) {
-    imports.outers.console = console;
+    imports.outers.console = {
+      log: function(msg) { return console.log(msg); }
+    };
     ___.grantRead(imports.outers, 'console');
     ___.grantFunc(imports.outers.console, 'log');
   }


      was (Author: mikestay):
    The patch
  
> Wrap console.log instead of directly exposing console
> -----------------------------------------------------
>
>                 Key: SHINDIG-1185
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1185
>             Project: Shindig
>          Issue Type: Bug
>          Components: Javascript 
>            Reporter: Mike Stay
>            Priority: Minor
>         Attachments: console.diff
>
>
> The console object provided by Firebug derives from a different frame's Object, so it inherits none of the modifications to Object.prototype made by cajita.js.  Therefore, accessing a non-whitelisted property like console.debug throws an exception rather than returning undefined. This change exposes a simple record with a method that wraps console.log instead of the console object itself.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.