Add setXSSAuditorEnabled support in WebSettings.
Change-Id: I6f74589b28960b91093acf8219a55e98f93b1881
This commit is contained in:
@@ -184,6 +184,7 @@ public class WebSettings {
|
||||
private boolean mDomStorageEnabled = false;
|
||||
private boolean mWorkersEnabled = false; // only affects V8.
|
||||
private boolean mGeolocationEnabled = true;
|
||||
private boolean mXSSAuditorEnabled = false;
|
||||
// HTML5 configuration parameters
|
||||
private long mAppCacheMaxSize = Long.MAX_VALUE;
|
||||
private String mAppCachePath = "";
|
||||
@@ -1233,6 +1234,17 @@ public class WebSettings {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether XSS Auditor is enabled.
|
||||
* @param flag Whether XSS Auditor should be enabled.
|
||||
*/
|
||||
public synchronized void setXSSAuditorEnabled(boolean flag) {
|
||||
if (mXSSAuditorEnabled != flag) {
|
||||
mXSSAuditorEnabled = flag;
|
||||
postSync();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if javascript is enabled. <b>Note: The default is false.</b>
|
||||
* @return True if javascript is enabled.
|
||||
|
||||
@@ -75,6 +75,7 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
||||
private static final int SET_GEOLOCATION_PERMISSION = 43;
|
||||
private static final int OVERRIDE_PREFERENCE = 44;
|
||||
private static final int LAYOUT_DUMP_CHILD_FRAMES_TEXT = 45;
|
||||
private static final int SET_XSS_AUDITOR_ENABLED = 46;
|
||||
|
||||
CallbackProxy(EventSender eventSender,
|
||||
LayoutTestController layoutTestController) {
|
||||
@@ -278,6 +279,11 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
||||
boolean value = msg.getData().getBoolean("value");
|
||||
mLayoutTestController.overridePreference(key, value);
|
||||
break;
|
||||
|
||||
case SET_XSS_AUDITOR_ENABLED:
|
||||
mLayoutTestController.setXSSAuditorEnabled(
|
||||
msg.arg1 == 1 ? true : false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,4 +513,8 @@ public class CallbackProxy extends Handler implements EventSender, LayoutTestCon
|
||||
message.getData().putBoolean("value", value);
|
||||
message.sendToTarget();
|
||||
}
|
||||
|
||||
public void setXSSAuditorEnabled(boolean flag) {
|
||||
obtainMessage(SET_XSS_AUDITOR_ENABLED, flag ? 1 : 0, 0).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +68,7 @@ public interface LayoutTestController {
|
||||
public void setGeolocationPermission(boolean allow);
|
||||
|
||||
public void overridePreference(String key, boolean value);
|
||||
|
||||
// For XSSAuditor tests
|
||||
public void setXSSAuditorEnabled(boolean flag);
|
||||
}
|
||||
|
||||
@@ -497,6 +497,10 @@ public class TestShellActivity extends Activity implements LayoutTestController
|
||||
}
|
||||
}
|
||||
|
||||
public void setXSSAuditorEnabled (boolean flag) {
|
||||
mWebView.getSettings().setXSSAuditorEnabled(flag);
|
||||
}
|
||||
|
||||
private final WebViewClient mViewClient = new WebViewClient(){
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
|
||||
Reference in New Issue
Block a user