Index: LayoutTests/fast/dom/Orientation/script-tests/create-event-orientationchange.js |
diff --git a/LayoutTests/fast/dom/Orientation/script-tests/create-event-orientationchange.js b/LayoutTests/fast/dom/Orientation/script-tests/create-event-orientationchange.js |
index 9015bb53ba609d280563fdf11545cf681ca94977..59b356ae7e8635b7d288607bd3cb18d78b7d991c 100644 |
--- a/LayoutTests/fast/dom/Orientation/script-tests/create-event-orientationchange.js |
+++ b/LayoutTests/fast/dom/Orientation/script-tests/create-event-orientationchange.js |
@@ -1,16 +1,20 @@ |
-description('Tests that document.createEvent() works with orientationChange') |
+description('Tests that document.createEvent() works with orientationChange if enabled') |
-function handleOrientationChange() |
+function handleTestResult() |
{ |
document.getElementById('result').innerHTML = "PASS"; |
} |
-window.addEventListener('orientationchange', handleOrientationChange, false); |
+if (window.internals && internals.runtimeFlags.orientationEventEnabled) { |
+ window.addEventListener('orientationchange', handleTestResult, false); |
-try { |
- var event = document.createEvent("OrientationEvent"); |
- event.initEvent("orientationchange", false, false); |
- window.dispatchEvent(event); |
-} catch(e) { |
- document.getElementById('result').innerHTML = "FAIL... orientationChange event doesn't appear to be enabled or implemented."; |
+ try { |
+ var event = document.createEvent("OrientationEvent"); |
+ event.initEvent("orientationchange", false, false); |
+ window.dispatchEvent(event); |
+ } catch(e) { |
+ document.getElementById('result').innerHTML = "FAIL... orientationChange event doesn't appear to be enabled or implemented."; |
+ } |
+} else { |
+ handleTestResult(); |
} |