WebCore:
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Oct 2007 02:11:55 +0000 (02:11 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Oct 2007 02:11:55 +0000 (02:11 +0000)
        Reviewed by Adam Roben.

        Fix http://bugs.webkit.org/show_bug.cgi?id=14953
        Implement window.console in WebCore

        - Adds a window.console object that has 4 methods (log, info, warn, and error)
          that send messages to the Chrome.  This moves functionality that was in the
          app down into WebCore.

        * DerivedSources.make:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/scripts/CodeGeneratorJS.pm: Add extended attribute
        to mark attributes as [Replacable] which indicates they can
        overridden when set.
        * page/Chrome.cpp:
        (WebCore::Chrome::addMessageToConsole): Allow all messages to go
        up to the ChromeClient.
        * page/Console.cpp: Added.
        (WebCore::Console::Console):
        (WebCore::Console::disconnectFrame):
        (WebCore::Console::error):
        (WebCore::Console::info):
        (WebCore::Console::log):
        (WebCore::Console::warn):
        * page/Console.h: Added.
        * page/Console.idl: Added.
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::clear):
        (WebCore::DOMWindow::console):
        * page/DOMWindow.h:
        * page/DOMWindow.idl:

LayoutTests:

        Reviewed by Adam Roben.

        Update tests for http://bugs.webkit.org/show_bug.cgi?id=14953
        Implement window.console in WebCore

        * fast/dom/Window/window-properties-expected.txt:
        * http/tests/security/cross-frame-access-put-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27161 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties-expected.txt
LayoutTests/http/tests/security/cross-frame-access-put-expected.txt
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/page/Chrome.cpp
WebCore/page/Console.cpp [new file with mode: 0644]
WebCore/page/Console.h [new file with mode: 0644]
WebCore/page/Console.idl [new file with mode: 0644]
WebCore/page/DOMWindow.cpp
WebCore/page/DOMWindow.h
WebCore/page/DOMWindow.idl

index de0e4c987bcff53bff4e997d6af1bd8f79d1221b..9090469a777e8bae69c4cfdaa573d9f8429b7e14 100644 (file)
@@ -1,3 +1,13 @@
+2007-10-27  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Update tests for http://bugs.webkit.org/show_bug.cgi?id=14953
+        Implement window.console in WebCore
+
+        * fast/dom/Window/window-properties-expected.txt:
+        * http/tests/security/cross-frame-access-put-expected.txt:
+
 2007-10-27  Matt Lilek  <webkit@mattlilek.com>
 
         Update results.
index f1e6d66382b90cd061aa2679be13e1b005b6b9cf..d8698995a2dd7a1ca2cdd024cac096aef6fbb362 100644 (file)
@@ -1170,6 +1170,11 @@ window.clientInformation.vendorSub [string]
 window.close [function]
 window.closed [boolean]
 window.confirm [function]
+window.console [object Console]
+window.console.error [function]
+window.console.info [function]
+window.console.log [function]
+window.console.warn [function]
 window.crypto [undefined]
 window.defaultStatus [string]
 window.defaultstatus [string]
index f672e497d2b2d7e03f09e21ad9478d952f16b000..f8b516bd90a3304d8cf4ad7eae54eb3d0940e7ca 100644 (file)
@@ -413,7 +413,7 @@ ALERT: PASS: window.XPathEvaluator should be '[object XPathEvaluatorConstructor]
 ALERT: PASS: window.XPathResult should be '[object XPathResultConstructor]' and is.
 ALERT: PASS: window.clientInformation should be '[object Navigator]' and is.
 ALERT: PASS: window.closed should be 'false' and is.
-ALERT: PASS: window.console should be '[object HTMLPreElement]' and is.
+ALERT: PASS: window.console should be '[object Console]' and is.
 ALERT: PASS: window.crypto should be 'undefined' and is.
 ALERT: PASS: window.defaultStatus should be '' and is.
 ALERT: PASS: window.defaultstatus should be '' and is.
index 441bed7e1f78715ca378be66112b9c5e06d4470d..d84716b6b28370a167df2b31fae8716f372bb629 100644 (file)
@@ -1,3 +1,39 @@
+2007-10-27  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Adam Roben.
+
+        Fix http://bugs.webkit.org/show_bug.cgi?id=14953
+        Implement window.console in WebCore
+
+        - Adds a window.console object that has 4 methods (log, info, warn, and error)
+          that send messages to the Chrome.  This moves functionality that was in the
+          app down into WebCore.
+
+        * DerivedSources.make:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/scripts/CodeGeneratorJS.pm: Add extended attribute
+        to mark attributes as [Replacable] which indicates they can 
+        overridden when set.
+        * page/Chrome.cpp:
+        (WebCore::Chrome::addMessageToConsole): Allow all messages to go
+        up to the ChromeClient.
+        * page/Console.cpp: Added.
+        (WebCore::Console::Console):
+        (WebCore::Console::disconnectFrame):
+        (WebCore::Console::error):
+        (WebCore::Console::info):
+        (WebCore::Console::log):
+        (WebCore::Console::warn):
+        * page/Console.h: Added.
+        * page/Console.idl: Added.
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::clear):
+        (WebCore::DOMWindow::console):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+
 2007-10-27  Eric Seidel  <eric@webkit.org>
 
         Reviewed by aroben.
index b4f2069b4bc20abc1433b2ef50b92d396c47159e..5db0e648e83d72e99bdb36cd0d7292a0a2ef2953 100644 (file)
@@ -327,6 +327,7 @@ all : \
     JSCanvasRenderingContext2D.h \
     JSCharacterData.h \
     JSComment.h \
+    JSConsole.h \
     JSCounter.h \
     JSCSSStyleDeclaration.h \
     JSDatabase.h \
index 510c88f8bbae670168b1806c788937d4516146ef..a220d011c47c93c7dbdd1d719a71a5a9b197925e 100644 (file)
@@ -293,6 +293,7 @@ IDL_BINDINGS += \
     html/HTMLTitleElement.idl \
     html/HTMLUListElement.idl \
     page/BarInfo.idl \
+    page/Console.idl \
     page/DOMSelection.idl \
     page/DOMWindow.idl \
     page/History.idl \
@@ -605,6 +606,7 @@ SOURCES += \
     loader/TextResourceDecoder.cpp \
     page/BarInfo.cpp \
     page/Chrome.cpp \
+    page/Console.cpp \
     page/ContextMenuController.cpp \
     page/DOMSelection.cpp \
     page/DOMWindow.cpp \
index 9bbd125f3233c9b0886265a40f4ae874d9e5f8bf..ab28a722d2bfa75d7b7aa5e2476c5372b788b126 100644 (file)
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSComment.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSConsole.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSConsole.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSCounter.cpp"\r
                                >\r
                                RelativePath="..\page\ChromeClient.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\page\Console.cpp"\r
+                               >\r
+                       </File>\r
+                       <File\r
+                               RelativePath="..\page\Console.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\page\ContextMenuClient.h"\r
                                >\r
index 5c9cd80376c1e5e1b9bc807d61d811c72df8dcab..23a6b118ac65d45ca0f823c2419c959b3a7af08c 100644 (file)
                BC06EE040BFD71AA00856E9D /* JSHTMLTableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC06EE020BFD71AA00856E9D /* JSHTMLTableElement.cpp */; };
                BC06EE050BFD71AA00856E9D /* JSHTMLTableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC06EE030BFD71AA00856E9D /* JSHTMLTableElement.h */; };
                BC073BAA0C399B1F000F5979 /* FloatConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = BC073BA90C399B1F000F5979 /* FloatConversion.h */; };
+               BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC0B36A10CD3C67C00AC7EB5 /* Console.cpp */; };
+               BC0B36A50CD3C67C00AC7EB5 /* Console.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0B36A20CD3C67C00AC7EB5 /* Console.h */; };
+               BC0B36A60CD3C67C00AC7EB5 /* Console.idl in Resources */ = {isa = PBXBuildFile; fileRef = BC0B36A30CD3C67C00AC7EB5 /* Console.idl */; };
                BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC124EE40C2641CD009E2349 /* BarInfo.cpp */; };
                BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC124EE50C2641CD009E2349 /* BarInfo.h */; };
                BC124EFF0C26447A009E2349 /* JSBarInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC124EFD0C26447A009E2349 /* JSBarInfo.cpp */; };
                BC94D1540C275C8B006BC617 /* History.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D1510C275C8B006BC617 /* History.h */; };
                BC94D1570C275CAB006BC617 /* GlobalHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = BC94D1560C275CAB006BC617 /* GlobalHistory.h */; };
                BC94D1590C275CB6006BC617 /* GlobalHistoryMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC94D1580C275CB6006BC617 /* GlobalHistoryMac.mm */; };
+               BC98543D0CD3D98B00069BC1 /* JSConsole.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC98543B0CD3D98B00069BC1 /* JSConsole.cpp */; };
+               BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */ = {isa = PBXBuildFile; fileRef = BC98543C0CD3D98B00069BC1 /* JSConsole.h */; };
                BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */; };
                BC9ADD230CC4032600098C4C /* CSSTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9ADD220CC4032600098C4C /* CSSTransformValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC9ADD800CC4092200098C4C /* CSSTransformValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9ADD7F0CC4092200098C4C /* CSSTransformValue.cpp */; };
                BC06F24B06D18A7E004A6FA3 /* XSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTProcessor.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLTProcessor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC073BA90C399B1F000F5979 /* FloatConversion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FloatConversion.h; sourceTree = "<group>"; };
+               BC0B36A10CD3C67C00AC7EB5 /* Console.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Console.cpp; sourceTree = "<group>"; };
+               BC0B36A20CD3C67C00AC7EB5 /* Console.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Console.h; sourceTree = "<group>"; };
+               BC0B36A30CD3C67C00AC7EB5 /* Console.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Console.idl; sourceTree = "<group>"; };
                BC124EE40C2641CD009E2349 /* BarInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BarInfo.cpp; sourceTree = "<group>"; };
                BC124EE50C2641CD009E2349 /* BarInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BarInfo.h; sourceTree = "<group>"; };
                BC124EE60C2641CD009E2349 /* BarInfo.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = BarInfo.idl; sourceTree = "<group>"; };
                BC94D1520C275C8B006BC617 /* History.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = History.idl; sourceTree = "<group>"; };
                BC94D1560C275CAB006BC617 /* GlobalHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GlobalHistory.h; sourceTree = "<group>"; };
                BC94D1580C275CB6006BC617 /* GlobalHistoryMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = GlobalHistoryMac.mm; sourceTree = "<group>"; };
+               BC98543B0CD3D98B00069BC1 /* JSConsole.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSConsole.cpp; sourceTree = "<group>"; };
+               BC98543C0CD3D98B00069BC1 /* JSConsole.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSConsole.h; sourceTree = "<group>"; };
                BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheetCustom.cpp; sourceTree = "<group>"; };
                BC9ADD220CC4032600098C4C /* CSSTransformValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSTransformValue.h; sourceTree = "<group>"; };
                BC9ADD7F0CC4092200098C4C /* CSSTransformValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSTransformValue.cpp; sourceTree = "<group>"; };
                14DFB33F0A7DF7630018F769 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
+                               A83B79100CCB001B000B0825 /* Core */,
                                A83B790E0CCAFF97000B0825 /* CSS */,
-                               A83B79100CCB001B000B0825 /* DOM */,
                                A83B79120CCB003F000B0825 /* Events */,
                                A83B79080CCAFF2B000B0825 /* HTML */,
-                               BC124EFD0C26447A009E2349 /* JSBarInfo.cpp */,
-                               BC124EFE0C26447A009E2349 /* JSBarInfo.h */,
-                               BC94D14C0C275C68006BC617 /* JSHistory.cpp */,
-                               BC94D14D0C275C68006BC617 /* JSHistory.h */,
-                               BCFE2F0F0C1B58370020235F /* JSRect.cpp */,
-                               BCFE2F100C1B58370020235F /* JSRect.h */,
-                               BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */,
-                               BCEC01C10C274DDD009F4EC9 /* JSScreen.h */,
-                               A83B79220CCB00F0000B0825 /* XML */,
-                               656581D909D1508D000E61D7 /* JSXSLTProcessor.lut.h */,
+                               BC9854460CD3DA5F00069BC1 /* Ranges */,
                                A83B79150CCB0078000B0825 /* Storage */,
                                A83B790A0CCAFF47000B0825 /* SVG */,
+                               BC9854530CD3DA8F00069BC1 /* Traversal */,
+                               BC9854430CD3D9D000069BC1 /* Window */,
+                               A83B79220CCB00F0000B0825 /* XML */,
                                A83B790C0CCAFF83000B0825 /* XPath */,
                        );
                        name = "Derived Sources";
                                14D8238A0AF92DF60004F057 /* Chrome.cpp */,
                                14D823500AF92A790004F057 /* Chrome.h */,
                                14D824060AF93AEB0004F057 /* ChromeClient.h */,
+                               BC0B36A10CD3C67C00AC7EB5 /* Console.cpp */,
+                               BC0B36A20CD3C67C00AC7EB5 /* Console.h */,
+                               BC0B36A30CD3C67C00AC7EB5 /* Console.idl */,
                                065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */,
                                065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */,
                                065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */,
                                A8D05FAA0A23B30F005E7203 /* JSCSSValueList.h */,
                                BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */,
                                BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */,
+                               BCFE2F0F0C1B58370020235F /* JSRect.cpp */,
+                               BCFE2F100C1B58370020235F /* JSRect.h */,
                                BCE013980C0BEF180043860A /* JSStyleSheet.cpp */,
                                BCE013990C0BEF180043860A /* JSStyleSheet.h */,
                                A84EBD820CB8C97700079609 /* JSStyleSheetList.cpp */,
                        name = CSS;
                        sourceTree = "<group>";
                };
-               A83B79100CCB001B000B0825 /* DOM */ = {
+               A83B79100CCB001B000B0825 /* Core */ = {
                        isa = PBXGroup;
                        children = (
                                65DF31D809D1C122000BE325 /* JSAttr.cpp */,
                                65DF31E209D1CC60000BE325 /* JSDocumentType.h */,
                                65DF31E309D1CC60000BE325 /* JSDOMImplementation.cpp */,
                                65DF31E409D1CC60000BE325 /* JSDOMImplementation.h */,
-                               1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */,
-                               1ACE53DE0A8D18810022947D /* JSDOMParser.h */,
-                               BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */,
-                               BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */,
-                               1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */,
-                               1403BA0E09EB18F800797C7F /* JSDOMWindow.h */,
                                65DF31E509D1CC60000BE325 /* JSElement.cpp */,
                                65DF31E609D1CC60000BE325 /* JSElement.h */,
                                65DF322D09D1DDBC000BE325 /* JSEntity.cpp */,
                                BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */,
                                14DC0D3509FED073007B0235 /* JSNode.cpp */,
                                14DC0D3609FED073007B0235 /* JSNode.h */,
-                               14115B7009F84CD600CA4FC1 /* JSNodeFilter.cpp */,
-                               14115B7109F84CD600CA4FC1 /* JSNodeFilter.h */,
-                               1A750D8B0A90E521000FF215 /* JSNodeIterator.cpp */,
-                               1A750D8C0A90E521000FF215 /* JSNodeIterator.h */,
                                BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */,
                                BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */,
                                65DF31E909D1CC60000BE325 /* JSNotation.cpp */,
                                65DF31EA09D1CC60000BE325 /* JSNotation.h */,
                                65DF31EB09D1CC60000BE325 /* JSProcessingInstruction.cpp */,
                                65DF31EC09D1CC60000BE325 /* JSProcessingInstruction.h */,
-                               65DF31ED09D1CC60000BE325 /* JSRange.cpp */,
-                               65DF31EE09D1CC60000BE325 /* JSRange.h */,
-                               D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */,
-                               D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
                                65DF31EF09D1CC60000BE325 /* JSText.cpp */,
                                65DF31F009D1CC60000BE325 /* JSText.h */,
-                               1A750D5A0A90DEE1000FF215 /* JSTreeWalker.cpp */,
-                               1A750D5B0A90DEE1000FF215 /* JSTreeWalker.h */,
                        );
-                       name = DOM;
+                       name = Core;
                        sourceTree = "<group>";
                };
                A83B79120CCB003F000B0825 /* Events */ = {
                A83B79220CCB00F0000B0825 /* XML */ = {
                        isa = PBXGroup;
                        children = (
+                               1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */,
+                               1ACE53DE0A8D18810022947D /* JSDOMParser.h */,
                                656581D709D1508D000E61D7 /* JSXMLHttpRequest.lut.h */,
                                1ACE53F40A8D19470022947D /* JSXMLSerializer.cpp */,
                                1ACE53F50A8D19470022947D /* JSXMLSerializer.h */,
+                               656581D909D1508D000E61D7 /* JSXSLTProcessor.lut.h */,
                        );
                        name = XML;
                        sourceTree = "<group>";
                        name = Custom;
                        sourceTree = "<group>";
                };
+               BC9854430CD3D9D000069BC1 /* Window */ = {
+                       isa = PBXGroup;
+                       children = (
+                               BC5A86B30C3367E800EEA649 /* JSDOMSelection.cpp */,
+                               BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */,
+                               1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */,
+                               1403BA0E09EB18F800797C7F /* JSDOMWindow.h */,
+                               BC98543B0CD3D98B00069BC1 /* JSConsole.cpp */,
+                               BC98543C0CD3D98B00069BC1 /* JSConsole.h */,
+                               BC124EFD0C26447A009E2349 /* JSBarInfo.cpp */,
+                               BC124EFE0C26447A009E2349 /* JSBarInfo.h */,
+                               BC94D14C0C275C68006BC617 /* JSHistory.cpp */,
+                               BC94D14D0C275C68006BC617 /* JSHistory.h */,
+                               BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */,
+                               BCEC01C10C274DDD009F4EC9 /* JSScreen.h */,
+                       );
+                       name = Window;
+                       sourceTree = "<group>";
+               };
+               BC9854460CD3DA5F00069BC1 /* Ranges */ = {
+                       isa = PBXGroup;
+                       children = (
+                               65DF31ED09D1CC60000BE325 /* JSRange.cpp */,
+                               65DF31EE09D1CC60000BE325 /* JSRange.h */,
+                               D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */,
+                               D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
+                       );
+                       name = Ranges;
+                       sourceTree = "<group>";
+               };
+               BC9854530CD3DA8F00069BC1 /* Traversal */ = {
+                       isa = PBXGroup;
+                       children = (
+                               14115B7009F84CD600CA4FC1 /* JSNodeFilter.cpp */,
+                               14115B7109F84CD600CA4FC1 /* JSNodeFilter.h */,
+                               1A750D8B0A90E521000FF215 /* JSNodeIterator.cpp */,
+                               1A750D8C0A90E521000FF215 /* JSNodeIterator.h */,
+                               1A750D5A0A90DEE1000FF215 /* JSTreeWalker.cpp */,
+                               1A750D5B0A90DEE1000FF215 /* JSTreeWalker.h */,
+                       );
+                       name = Traversal;
+                       sourceTree = "<group>";
+               };
                BCB16BFB0979C38700467741 /* loader */ = {
                        isa = PBXGroup;
                        children = (
                                A80F3A7D0CCDA324002DD990 /* DOMSVGAngle.h in Headers */,
                                A80F43520CCDE604002DD990 /* DOMSVGAnimateElementInternal.h in Headers */,
                                E15863990CD10B730066E2C9 /* TextCodecUserDefined.h in Headers */,
+                               BC0B36A50CD3C67C00AC7EB5 /* Console.h in Headers */,
+                               BC98543E0CD3D98C00069BC1 /* JSConsole.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A83B78DF0CCAFEC1000B0825 /* SVGFontFaceFormatElement.idl in Resources */,
                                A83B78E20CCAFEC1000B0825 /* SVGFontFaceElement.idl in Resources */,
                                A83B78E50CCAFEC1000B0825 /* SVGDefinitionSrcElement.idl in Resources */,
+                               BC0B36A60CD3C67C00AC7EB5 /* Console.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A80F393E0CCD971A002DD990 /* JSSVGDefinitionSrcElement.cpp in Sources */,
                                A80F39590CCD9796002DD990 /* DOMSVGDefinitionSrcElement.mm in Sources */,
                                E158639A0CD10B730066E2C9 /* TextCodecUserDefined.cpp in Sources */,
+                               BC0B36A40CD3C67C00AC7EB5 /* Console.cpp in Sources */,
+                               BC98543D0CD3D98B00069BC1 /* JSConsole.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index e2f28a48110238acedd129eac84cb3f576e454be..706981b7113df8695b9986003896a8211df981a6 100644 (file)
@@ -1047,6 +1047,8 @@ sub GenerateImplementation
                         $implIncludes{"JS" . $constructorType . ".h"} = 1;
                         push(@implContent, "        // Shadowing a built-in constructor\n");
                         push(@implContent, "        JSObject::put(exec, \"$name\", value);\n");
+                    } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
+                        push(@implContent, "        JSObject::put(exec, \"$name\", value);\n");
                     } else {
                         if ($podType) {
                             push(@implContent, "        $podType imp(*impl());\n\n");
index 3823dd181202023a94178a38ffc216ce0a2060cc..4fd05679b94646bb6f5c98b11299875a50223cf8 100644 (file)
@@ -197,7 +197,7 @@ void Chrome::setResizable(bool b) const
 
 void Chrome::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
 {
-    if (source == JSMessageSource && level == ErrorMessageLevel)
+    if (source == JSMessageSource)
         m_client->addMessageToConsole(message, lineNumber, sourceID);
 
     if (InspectorController* inspector = m_page->inspectorController())
diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp
new file mode 100644 (file)
index 0000000..d45af62
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Console.h"
+
+#include "Chrome.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "Page.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+Console::Console(Frame* frame)
+    : m_frame(frame)
+{
+}
+
+void Console::disconnectFrame()
+{
+    m_frame = 0;
+}
+
+void Console::error(const String& message)
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    page->chrome()->addMessageToConsole(JSMessageSource, ErrorMessageLevel, message, 0, m_frame->loader()->url().prettyURL());
+}
+
+void Console::info(const String& message)
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    page->chrome()->addMessageToConsole(JSMessageSource, LogMessageLevel, message, 0, m_frame->loader()->url().prettyURL());
+}
+
+void Console::log(const String& message)
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    page->chrome()->addMessageToConsole(JSMessageSource, LogMessageLevel, message, 0, m_frame->loader()->url().prettyURL());
+}
+
+void Console::warn(const String& message)
+{
+    if (!m_frame)
+        return;
+
+    Page* page = m_frame->page();
+    if (!page)
+        return;
+
+    page->chrome()->addMessageToConsole(JSMessageSource, WarningMessageLevel, message, 0, m_frame->loader()->url().prettyURL());
+}
+
+} // namespace WebCore
diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h
new file mode 100644 (file)
index 0000000..88bbf9f
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Console_h
+#define Console_h
+
+#include "Shared.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+    class Frame;
+
+    class Console : public Shared<Console> {
+    public:
+        Console(Frame*);
+        void disconnectFrame();
+
+        void error(const String& message);
+        void info(const String& message);
+        void log(const String& message);
+        void warn(const String& message);
+
+    private:
+        Frame* m_frame;
+    };
+
+} // namespace WebCore
+
+#endif // Console_h
diff --git a/WebCore/page/Console.idl b/WebCore/page/Console.idl
new file mode 100644 (file)
index 0000000..3356c0e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module window {
+
+    interface Console {
+        void error(in DOMString message);
+        void info(in DOMString message);
+        void log(in DOMString message);
+        void warn(in DOMString message);
+    };
+
+}
index b09907ff06da15aa46e1d3c1626fdf37957e8f5f..3e242f802818512016e0b7e9f4f16956ddaf63d7 100644 (file)
@@ -31,6 +31,7 @@
 #include "CSSRuleList.h"
 #include "CSSStyleSelector.h"
 #include "Chrome.h"
+#include "Console.h"
 #include "Database.h"
 #include "DOMSelection.h"
 #include "Document.h"
@@ -99,6 +100,10 @@ void DOMWindow::clear()
     if (m_toolbar)
         m_toolbar->disconnectFrame();
     m_toolbar = 0;
+
+    if (m_console)
+        m_console->disconnectFrame();
+    m_console = 0;
 }
 
 Screen* DOMWindow::screen() const
@@ -157,6 +162,13 @@ BarInfo* DOMWindow::toolbar() const
     return m_toolbar.get();
 }
 
+Console* DOMWindow::console() const
+{
+    if (!m_console)
+        m_console = new Console(m_frame);
+    return m_console.get();
+}
+
 DOMSelection* DOMWindow::getSelection()
 {
     if (!m_selection)
index 35913abc722bb3fe77e57e1b08290de4d0b1dd2e..a9a5857d3cc7fc6bf77bdd05c3c4db83e91124ee 100644 (file)
@@ -36,6 +36,7 @@ namespace WebCore {
     class BarInfo;
     class CSSRuleList;
     class CSSStyleDeclaration;
+    class Console;
     class Database;
     class DOMSelection;
     class Document;
@@ -43,7 +44,7 @@ namespace WebCore {
     class Frame;
     class History;
     class Screen;
-    
+
     typedef int ExceptionCode;
 
     class DOMWindow : public Shared<DOMWindow> {
@@ -136,6 +137,8 @@ namespace WebCore {
         PassRefPtr<Database> openDatabase(const String& name, const String& version, ExceptionCode&);
 #endif
 
+        Console* console() const;
+
     private:
         Frame* m_frame;
         mutable RefPtr<Screen> m_screen;
@@ -147,6 +150,7 @@ namespace WebCore {
         mutable RefPtr<BarInfo> m_scrollbars;
         mutable RefPtr<BarInfo> m_statusbar;
         mutable RefPtr<BarInfo> m_toolbar;
+        mutable RefPtr<Console> m_console;
     };
 
 } // namespace WebCore
index 1d0b3d994ce122cbc16d9a63c61b2b4225592877..9314d0287402a63ba82cf44485115f3fc22838a8 100644 (file)
@@ -115,6 +115,8 @@ module window {
             raises(DOMException);
 #endif
 
+                 attribute [Replaceable] Console console;
+
 #if defined(LANGUAGE_JAVASCRIPT)
         // Global constructors
         attribute StyleSheetConstructor StyleSheet;