Index: Source/core/frame/UseCounter.cpp |
diff --git a/Source/core/frame/UseCounter.cpp b/Source/core/frame/UseCounter.cpp |
index 4cd5fe1aa703a2e855b5e00312f9e79938fd5f50..1decbd7314fa5bdd2b7bf2a001d22f80c7a47773 100644 |
--- a/Source/core/frame/UseCounter.cpp |
+++ b/Source/core/frame/UseCounter.cpp |
@@ -665,9 +665,12 @@ void UseCounter::countDeprecationIfNotPrivateScript(v8::Isolate* isolate, Execut |
} |
// FIXME: Update other UseCounter::deprecationMessage() cases to use this. |
Julien - ping for review
2014/11/18 00:24:33
Shouldn't this be removed?
|
-static String replacedBy(const char* oldString, const char* newString) |
+static String replacedBy(const char* oldString, const char* newString, bool useApostrophe = true) |
Julien - ping for review
2014/11/18 00:24:32
Booleans are not a good idea in a function's signa
|
{ |
- return String::format("'%s' is deprecated. Please use '%s' instead.", oldString, newString); |
+ if (useApostrophe) |
+ return String::format("'%s' is deprecated. Please use '%s' instead.", oldString, newString); |
+ |
+ return String::format("%s is deprecated. Please use %s instead.", oldString, newString); |
} |
String UseCounter::deprecationMessage(Feature feature) |
@@ -675,20 +678,20 @@ String UseCounter::deprecationMessage(Feature feature) |
switch (feature) { |
// Quota |
case PrefixedStorageInfo: |
- return "'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead."; |
+ return replacedBy("window.webkitStorageInfo", "navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage"); |
Julien - ping for review
2014/11/18 00:24:32
This call is just magical. If you don't know what
|
// Keyboard Event (DOM Level 3) |
case KeyboardEventKeyLocation: |
return replacedBy("KeyboardEvent.keyLocation", "KeyboardEvent.location"); |
case ConsoleMarkTimeline: |
- return "console.markTimeline is deprecated. Please use the console.timeStamp instead."; |
+ return replacedBy("console.markTimeline", "the console.timeStamp", false); |
case FileError: |
return "FileError is deprecated. Please use the 'name' or 'message' attributes of DOMError rather than 'code'."; |
case ShowModalDialog: |
- return "showModalDialog is deprecated. Please use window.open and postMessage instead."; |
+ return replacedBy("showModalDialog", "window.open and postMessage"); |
case CSSStyleSheetInsertRuleOptionalArg: |
return "Calling CSSStyleSheet.insertRule() with one argument is deprecated. Please pass the index argument as well: insertRule(x, 0)."; |
@@ -697,19 +700,19 @@ String UseCounter::deprecationMessage(Feature feature) |
return "'HTMLVideoElement.webkitSupportsFullscreen' is deprecated. Its value is true if the video is loaded."; |
case PrefixedVideoDisplayingFullscreen: |
- return "'HTMLVideoElement.webkitDisplayingFullscreen' is deprecated. Please use the 'fullscreenchange' and 'webkitfullscreenchange' events instead."; |
+ return replacedBy("'HTMLVideoElement.webkitDisplayingFullscreen'", "the 'fullscreenchange' and 'webkitfullscreenchange' events", false); |
Julien - ping for review
2014/11/18 00:24:33
I think your mistake here is to assume that we *ha
|
case PrefixedVideoEnterFullscreen: |
- return "'HTMLVideoElement.webkitEnterFullscreen()' is deprecated. Please use 'Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()' instead."; |
+ return replacedBy("HTMLVideoElement.webkitEnterFullscreen()", "Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()"); |
case PrefixedVideoExitFullscreen: |
- return "'HTMLVideoElement.webkitExitFullscreen()' is deprecated. Please use 'Document.exitFullscreen()' and 'Document.webkitExitFullscreen()' instead."; |
+ return replacedBy("HTMLVideoElement.webkitExitFullscreen()", "Document.exitFullscreen()' and 'Document.webkitExitFullscreen()"); |
case PrefixedVideoEnterFullScreen: |
- return "'HTMLVideoElement.webkitEnterFullScreen()' is deprecated. Please use 'Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()' instead."; |
+ return replacedBy("HTMLVideoElement.webkitEnterFullScreen()", "Element.requestFullscreen()' and 'Element.webkitRequestFullscreen()"); |
case PrefixedVideoExitFullScreen: |
- return "'HTMLVideoElement.webkitExitFullScreen()' is deprecated. Please use 'Document.exitFullscreen()' and 'Document.webkitExitFullscreen()' instead."; |
+ return replacedBy("HTMLVideoElement.webkitExitFullScreen()", "Document.exitFullscreen()' and 'Document.webkitExitFullscreen()"); |
case MediaErrorEncrypted: |
return "'MediaError.MEDIA_ERR_ENCRYPTED' is deprecated. This error code is never used."; |
@@ -787,31 +790,31 @@ String UseCounter::deprecationMessage(Feature feature) |
return "Setting 'XMLHttpRequest.withCredentials' for synchronous requests is deprecated."; |
case EventSourceURL: |
- return "'EventSource.URL' is deprecated. Please use 'EventSource.url' instead."; |
+ return replacedBy("EventSource.URL", "EventSource.url"); |
case WebSocketURL: |
- return "'WebSocket.URL' is deprecated. Please use 'WebSocket.url' instead."; |
+ return replacedBy("WebSocket.URL", "WebSocket.url"); |
case HTMLTableElementVspace: |
- return "The 'vspace' attribute on table is deprecated. Please use CSS instead."; |
+ return replacedBy("The 'vspace' attribute on table", "CSS", false); |
Julien - ping for review
2014/11/18 00:24:32
This should be moved to a more useful suggestion:
|
case HTMLTableElementHspace: |
- return "The 'hspace' attribute on table is deprecated. Please use CSS instead."; |
+ return replacedBy("The 'hspace' attribute on table", "CSS", false); |
Julien - ping for review
2014/11/18 00:24:33
Same comment here: margin-left and margin-right
|
case PictureSourceSrc: |
return "<source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead."; |
case XHRProgressEventPosition: |
- return "The XMLHttpRequest progress event property 'position' is deprecated. Please use 'loaded' instead."; |
+ return replacedBy("The XMLHttpRequest progress event property 'position'", "'loaded'", false); |
case XHRProgressEventTotalSize: |
- return "The XMLHttpRequest progress event property 'totalSize' is deprecated. Please use 'total' instead."; |
+ return replacedBy("The XMLHttpRequest progress event property 'totalSize'", "'total'", false); |
case ConsoleTimeline: |
- return "console.timeline is deprecated. Please use the console.time instead."; |
+ return replacedBy("console.timeline", "the console.time", false); |
case ConsoleTimelineEnd: |
- return "console.timelineEnd is deprecated. Please use the console.timeEnd instead."; |
+ return replacedBy("console.timelineEnd", "the console.timeEnd", false); |
case XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload: |
return "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/."; |