Index: LayoutTests/inspector/sources/debugger/resources/framework.js |
diff --git a/LayoutTests/inspector/sources/debugger/resources/framework.js b/LayoutTests/inspector/sources/debugger/resources/framework.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c4175bda0295fc2cb6491b6411a36a0a2e5db413 |
--- /dev/null |
+++ b/LayoutTests/inspector/sources/debugger/resources/framework.js |
@@ -0,0 +1,41 @@ |
+// A framework for testing. |
+ |
+var Framework = {}; |
+ |
+Framework.safeRun = function(callback, onSuccess, onException, breakOnUncaught) |
+{ |
+ try { |
+ callback(); |
+ if (onSuccess) |
+ Framework.safeRun(onSuccess, undefined, onException, breakOnUncaught); |
+ } catch (e) { |
+ if (onException) |
+ Framework.safeRun(onException, undefined, breakOnUncaught ? Framework.breakInFramework : undefined); |
+ else if (breakOnUncaught) |
+ Framework.breakInFramework(); |
+ } |
+} |
+ |
+Framework.throwFrameworkException = function(msg) |
+{ |
+ throw Error("FrameworkException" + (msg ? ": " + msg : "")); |
+} |
+ |
+Framework.breakInFramework = function() |
+{ |
+ debugger; |
+} |
+ |
+Framework.empty = function() |
+{ |
+} |
+ |
+Framework.doSomeWork = function() |
+{ |
+ const numberOfSteps = 50; |
+ for (var i = 0; i < numberOfSteps; ++i) { |
+ if (window["dummy property should not exist!" + i]) // Prevent optimizations. |
+ return i; |
+ Framework.safeRun(Framework.empty, Framework.empty, Framework.empty, true); |
+ } |
+} |