001package Torello.Browser.BrowserAPI; 002 003import java.util.*; 004import javax.json.*; 005import javax.json.stream.*; 006import java.io.*; 007 008import java.lang.reflect.Method; 009import java.lang.reflect.Parameter; 010import java.util.function.Function; 011 012import Torello.Browser.BrowserEvent; 013import Torello.Browser.JavaScriptAPI.*; 014import Torello.Browser.helper.*; 015 016import Torello.Java.Additional.*; 017import Torello.Java.JSON.*; 018 019import static Torello.Java.JSON.JFlag.*; 020 021import Torello.Java.StrCmpr; 022import Torello.JavaDoc.StaticFunctional; 023import Torello.JavaDoc.JDHeaderBackgroundImg; 024import Torello.JavaDoc.Excuse; 025 026/** 027 * <SPAN CLASS=COPIEDJDK><B>Security</B></SPAN> 028 * 029 * <EMBED CLASS='external-html' DATA-FILE-ID=CODE_GEN_NOTE> 030 */ 031@StaticFunctional(Excused={"counter"}, Excuses={Excuse.CONFIGURATION}) 032@JDHeaderBackgroundImg(EmbedTagFileID="WOOD_PLANK_NOTE") 033public class Security 034{ 035 // ******************************************************************************************** 036 // ******************************************************************************************** 037 // Class Header Stuff 038 // ******************************************************************************************** 039 // ******************************************************************************************** 040 041 042 // No Pubic Constructors 043 private Security () { } 044 045 // These two Vector's are used by all the "Methods" exported by this class. java.lang.reflect 046 // is used to generate the JSON String's. It saves thousands of lines of Auto-Generated Code. 047 private static final Map<String, Vector<String>> parameterNames = new HashMap<>(); 048 private static final Map<String, Vector<Class<?>>> parameterTypes = new HashMap<>(); 049 050 // Some Methods do not take any parameters - for instance all the "enable()" and "disable()" 051 // I simply could not get ride of RAW-TYPES and UNCHECKED warnings... so there are now, 052 // offically, two empty-vectors. One for String's, and the other for Classes. 053 054 private static final Vector<String> EMPTY_VEC_STR = new Vector<>(); 055 private static final Vector<Class<?>> EMPTY_VEC_CLASS = new Vector<>(); 056 057 static 058 { 059 for (Method m : Security.class.getMethods()) 060 { 061 // This doesn't work! The parameter names are all "arg0" ... "argN" 062 // It works for java.lang.reflect.Field, BUT NOT java.lang.reflect.Parameter! 063 // 064 // Vector<String> parameterNamesList = new Vector<>(); -- NOPE! 065 066 Vector<Class<?>> parameterTypesList = new Vector<>(); 067 068 for (Parameter p : m.getParameters()) parameterTypesList.add(p.getType()); 069 070 parameterTypes.put( 071 m.getName(), 072 (parameterTypesList.size() > 0) ? parameterTypesList : EMPTY_VEC_CLASS 073 ); 074 } 075 } 076 077 static 078 { 079 Vector<String> v = null; 080 081 parameterNames.put("disable", EMPTY_VEC_STR); 082 083 parameterNames.put("enable", EMPTY_VEC_STR); 084 085 v = new Vector<String>(1); 086 parameterNames.put("setIgnoreCertificateErrors", v); 087 Collections.addAll(v, new String[] 088 { "ignore", }); 089 090 v = new Vector<String>(2); 091 parameterNames.put("handleCertificateError", v); 092 Collections.addAll(v, new String[] 093 { "eventId", "action", }); 094 095 v = new Vector<String>(1); 096 parameterNames.put("setOverrideCertificateErrors", v); 097 Collections.addAll(v, new String[] 098 { "override", }); 099 } 100 101 102 // ******************************************************************************************** 103 // ******************************************************************************************** 104 // Types - Static Inner Classes 105 // ******************************************************************************************** 106 // ******************************************************************************************** 107 108 // public static class CertificateId => Integer 109 110 /** 111 * A description of mixed content (HTTP resources on HTTPS pages), as defined by 112 * https://www.w3.org/TR/mixed-content/#categories 113 */ 114 public static final String[] MixedContentType = 115 { "blockable", "optionally-blockable", "none", }; 116 117 /** The security level of a page or resource. */ 118 public static final String[] SecurityState = 119 { "unknown", "neutral", "insecure", "secure", "info", "insecure-broken", }; 120 121 /** 122 * <CODE>[No Description Provided by Google]</CODE> 123 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 124 */ 125 public static final String[] SafetyTipStatus = 126 { "badReputation", "lookalike", }; 127 128 /** 129 * The action to take when a certificate error occurs. continue will continue processing the 130 * request and cancel will cancel the request. 131 */ 132 public static final String[] CertificateErrorAction = 133 { "continue", "cancel", }; 134 135 /** 136 * Details about the security state of the page certificate. 137 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 138 */ 139 public static class CertificateSecurityState 140 extends BaseType 141 implements java.io.Serializable 142 { 143 /** For Object Serialization. java.io.Serializable */ 144 protected static final long serialVersionUID = 1; 145 146 public boolean[] optionals() 147 { return new boolean[] { false, false, true, false, true, false, false, false, false, false, true, false, false, false, false, false, false, false, }; } 148 149 /** Protocol name (e.g. "TLS 1.2" or "QUIC"). */ 150 public final String protocol; 151 152 /** Key Exchange used by the connection, or the empty string if not applicable. */ 153 public final String keyExchange; 154 155 /** 156 * (EC)DH group used by the connection, if applicable. 157 * <BR /><B CLASS=Opt>OPTIONAL</B> 158 */ 159 public final String keyExchangeGroup; 160 161 /** Cipher name. */ 162 public final String cipher; 163 164 /** 165 * TLS MAC. Note that AEAD ciphers do not have separate MACs. 166 * <BR /><B CLASS=Opt>OPTIONAL</B> 167 */ 168 public final String mac; 169 170 /** Page certificate. */ 171 public final String[] certificate; 172 173 /** Certificate subject name. */ 174 public final String subjectName; 175 176 /** Name of the issuing CA. */ 177 public final String issuer; 178 179 /** Certificate valid from date. */ 180 public final Number validFrom; 181 182 /** Certificate valid to (expiration) date */ 183 public final Number validTo; 184 185 /** 186 * The highest priority network error code, if the certificate has an error. 187 * <BR /><B CLASS=Opt>OPTIONAL</B> 188 */ 189 public final String certificateNetworkError; 190 191 /** True if the certificate uses a weak signature algorithm. */ 192 public final boolean certificateHasWeakSignature; 193 194 /** True if the certificate has a SHA1 signature in the chain. */ 195 public final boolean certificateHasSha1Signature; 196 197 /** True if modern SSL */ 198 public final boolean modernSSL; 199 200 /** True if the connection is using an obsolete SSL protocol. */ 201 public final boolean obsoleteSslProtocol; 202 203 /** True if the connection is using an obsolete SSL key exchange. */ 204 public final boolean obsoleteSslKeyExchange; 205 206 /** True if the connection is using an obsolete SSL cipher. */ 207 public final boolean obsoleteSslCipher; 208 209 /** True if the connection is using an obsolete SSL signature. */ 210 public final boolean obsoleteSslSignature; 211 212 /** 213 * Constructor 214 * 215 * @param protocol Protocol name (e.g. "TLS 1.2" or "QUIC"). 216 * 217 * @param keyExchange Key Exchange used by the connection, or the empty string if not applicable. 218 * 219 * @param keyExchangeGroup (EC)DH group used by the connection, if applicable. 220 * <BR /><B CLASS=Opt>OPTIONAL</B> 221 * 222 * @param cipher Cipher name. 223 * 224 * @param mac TLS MAC. Note that AEAD ciphers do not have separate MACs. 225 * <BR /><B CLASS=Opt>OPTIONAL</B> 226 * 227 * @param certificate Page certificate. 228 * 229 * @param subjectName Certificate subject name. 230 * 231 * @param issuer Name of the issuing CA. 232 * 233 * @param validFrom Certificate valid from date. 234 * 235 * @param validTo Certificate valid to (expiration) date 236 * 237 * @param certificateNetworkError The highest priority network error code, if the certificate has an error. 238 * <BR /><B CLASS=Opt>OPTIONAL</B> 239 * 240 * @param certificateHasWeakSignature True if the certificate uses a weak signature algorithm. 241 * 242 * @param certificateHasSha1Signature True if the certificate has a SHA1 signature in the chain. 243 * 244 * @param modernSSL True if modern SSL 245 * 246 * @param obsoleteSslProtocol True if the connection is using an obsolete SSL protocol. 247 * 248 * @param obsoleteSslKeyExchange True if the connection is using an obsolete SSL key exchange. 249 * 250 * @param obsoleteSslCipher True if the connection is using an obsolete SSL cipher. 251 * 252 * @param obsoleteSslSignature True if the connection is using an obsolete SSL signature. 253 */ 254 public CertificateSecurityState( 255 String protocol, String keyExchange, String keyExchangeGroup, String cipher, 256 String mac, String[] certificate, String subjectName, String issuer, 257 Number validFrom, Number validTo, String certificateNetworkError, 258 boolean certificateHasWeakSignature, boolean certificateHasSha1Signature, 259 boolean modernSSL, boolean obsoleteSslProtocol, boolean obsoleteSslKeyExchange, 260 boolean obsoleteSslCipher, boolean obsoleteSslSignature 261 ) 262 { 263 // Exception-Check(s) to ensure that if any parameters which are not declared as 264 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 265 266 if (protocol == null) THROWS.throwNPE("protocol"); 267 if (keyExchange == null) THROWS.throwNPE("keyExchange"); 268 if (cipher == null) THROWS.throwNPE("cipher"); 269 if (certificate == null) THROWS.throwNPE("certificate"); 270 if (subjectName == null) THROWS.throwNPE("subjectName"); 271 if (issuer == null) THROWS.throwNPE("issuer"); 272 if (validFrom == null) THROWS.throwNPE("validFrom"); 273 if (validTo == null) THROWS.throwNPE("validTo"); 274 275 this.protocol = protocol; 276 this.keyExchange = keyExchange; 277 this.keyExchangeGroup = keyExchangeGroup; 278 this.cipher = cipher; 279 this.mac = mac; 280 this.certificate = certificate; 281 this.subjectName = subjectName; 282 this.issuer = issuer; 283 this.validFrom = validFrom; 284 this.validTo = validTo; 285 this.certificateNetworkError = certificateNetworkError; 286 this.certificateHasWeakSignature = certificateHasWeakSignature; 287 this.certificateHasSha1Signature = certificateHasSha1Signature; 288 this.modernSSL = modernSSL; 289 this.obsoleteSslProtocol = obsoleteSslProtocol; 290 this.obsoleteSslKeyExchange = obsoleteSslKeyExchange; 291 this.obsoleteSslCipher = obsoleteSslCipher; 292 this.obsoleteSslSignature = obsoleteSslSignature; 293 } 294 295 /** 296 * JSON Object Constructor 297 * @param jo A Json-Object having data about an instance of {@code 'CertificateSecurityState'}. 298 */ 299 public CertificateSecurityState (JsonObject jo) 300 { 301 this.protocol = ReadJSON.getString(jo, "protocol", false, true); 302 this.keyExchange = ReadJSON.getString(jo, "keyExchange", false, true); 303 this.keyExchangeGroup = ReadJSON.getString(jo, "keyExchangeGroup", true, false); 304 this.cipher = ReadJSON.getString(jo, "cipher", false, true); 305 this.mac = ReadJSON.getString(jo, "mac", true, false); 306 this.certificate = (jo.getJsonArray("certificate") == null) 307 ? null 308 : RJArrIntoStream.strArr(jo.getJsonArray("certificate"), null, 0).toArray(String[]::new); 309 310 this.subjectName = ReadJSON.getString(jo, "subjectName", false, true); 311 this.issuer = ReadJSON.getString(jo, "issuer", false, true); 312 this.validFrom = ReadNumberJSON.get(jo, "validFrom", false, true); 313 this.validTo = ReadNumberJSON.get(jo, "validTo", false, true); 314 this.certificateNetworkError = ReadJSON.getString(jo, "certificateNetworkError", true, false); 315 this.certificateHasWeakSignature = ReadPrimJSON.getBoolean(jo, "certificateHasWeakSignature"); 316 this.certificateHasSha1Signature = ReadPrimJSON.getBoolean(jo, "certificateHasSha1Signature"); 317 this.modernSSL = ReadPrimJSON.getBoolean(jo, "modernSSL"); 318 this.obsoleteSslProtocol = ReadPrimJSON.getBoolean(jo, "obsoleteSslProtocol"); 319 this.obsoleteSslKeyExchange = ReadPrimJSON.getBoolean(jo, "obsoleteSslKeyExchange"); 320 this.obsoleteSslCipher = ReadPrimJSON.getBoolean(jo, "obsoleteSslCipher"); 321 this.obsoleteSslSignature = ReadPrimJSON.getBoolean(jo, "obsoleteSslSignature"); 322 } 323 324 325 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 326 public boolean equals(Object other) 327 { 328 if (this == other) return true; 329 if (other == null) return false; 330 if (other.getClass() != this.getClass()) return false; 331 332 CertificateSecurityState o = (CertificateSecurityState) other; 333 334 return 335 Objects.equals(this.protocol, o.protocol) 336 && Objects.equals(this.keyExchange, o.keyExchange) 337 && Objects.equals(this.keyExchangeGroup, o.keyExchangeGroup) 338 && Objects.equals(this.cipher, o.cipher) 339 && Objects.equals(this.mac, o.mac) 340 && Arrays.deepEquals(this.certificate, o.certificate) 341 && Objects.equals(this.subjectName, o.subjectName) 342 && Objects.equals(this.issuer, o.issuer) 343 && Objects.equals(this.validFrom, o.validFrom) 344 && Objects.equals(this.validTo, o.validTo) 345 && Objects.equals(this.certificateNetworkError, o.certificateNetworkError) 346 && (this.certificateHasWeakSignature == o.certificateHasWeakSignature) 347 && (this.certificateHasSha1Signature == o.certificateHasSha1Signature) 348 && (this.modernSSL == o.modernSSL) 349 && (this.obsoleteSslProtocol == o.obsoleteSslProtocol) 350 && (this.obsoleteSslKeyExchange == o.obsoleteSslKeyExchange) 351 && (this.obsoleteSslCipher == o.obsoleteSslCipher) 352 && (this.obsoleteSslSignature == o.obsoleteSslSignature); 353 } 354 355 /** Generates a Hash-Code for {@code 'this'} instance */ 356 public int hashCode() 357 { 358 return 359 Objects.hashCode(this.protocol) 360 + Objects.hashCode(this.keyExchange) 361 + Objects.hashCode(this.keyExchangeGroup) 362 + Objects.hashCode(this.cipher) 363 + Objects.hashCode(this.mac) 364 + Arrays.deepHashCode(this.certificate) 365 + Objects.hashCode(this.subjectName) 366 + Objects.hashCode(this.issuer) 367 + Objects.hashCode(this.validFrom) 368 + Objects.hashCode(this.validTo) 369 + Objects.hashCode(this.certificateNetworkError) 370 + (this.certificateHasWeakSignature ? 1 : 0) 371 + (this.certificateHasSha1Signature ? 1 : 0) 372 + (this.modernSSL ? 1 : 0) 373 + (this.obsoleteSslProtocol ? 1 : 0) 374 + (this.obsoleteSslKeyExchange ? 1 : 0) 375 + (this.obsoleteSslCipher ? 1 : 0) 376 + (this.obsoleteSslSignature ? 1 : 0); 377 } 378 } 379 380 /** 381 * <CODE>[No Description Provided by Google]</CODE> 382 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 383 */ 384 public static class SafetyTipInfo 385 extends BaseType 386 implements java.io.Serializable 387 { 388 /** For Object Serialization. java.io.Serializable */ 389 protected static final long serialVersionUID = 1; 390 391 public boolean[] optionals() 392 { return new boolean[] { false, true, }; } 393 394 /** Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. */ 395 public final String safetyTipStatus; 396 397 /** 398 * The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. 399 * <BR /><B CLASS=Opt>OPTIONAL</B> 400 */ 401 public final String safeUrl; 402 403 /** 404 * Constructor 405 * 406 * @param safetyTipStatus Describes whether the page triggers any safety tips or reputation warnings. Default is unknown. 407 * 408 * @param safeUrl The URL the safety tip suggested ("Did you mean?"). Only filled in for lookalike matches. 409 * <BR /><B CLASS=Opt>OPTIONAL</B> 410 */ 411 public SafetyTipInfo(String safetyTipStatus, String safeUrl) 412 { 413 // Exception-Check(s) to ensure that if any parameters which are not declared as 414 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 415 416 if (safetyTipStatus == null) THROWS.throwNPE("safetyTipStatus"); 417 418 // Exception-Check(s) to ensure that if any parameters which must adhere to a 419 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 420 421 THROWS.checkIAE("safetyTipStatus", safetyTipStatus, "Security.SafetyTipStatus", Security.SafetyTipStatus); 422 423 this.safetyTipStatus = safetyTipStatus; 424 this.safeUrl = safeUrl; 425 } 426 427 /** 428 * JSON Object Constructor 429 * @param jo A Json-Object having data about an instance of {@code 'SafetyTipInfo'}. 430 */ 431 public SafetyTipInfo (JsonObject jo) 432 { 433 this.safetyTipStatus = ReadJSON.getString(jo, "safetyTipStatus", false, true); 434 this.safeUrl = ReadJSON.getString(jo, "safeUrl", true, false); 435 } 436 437 438 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 439 public boolean equals(Object other) 440 { 441 if (this == other) return true; 442 if (other == null) return false; 443 if (other.getClass() != this.getClass()) return false; 444 445 SafetyTipInfo o = (SafetyTipInfo) other; 446 447 return 448 Objects.equals(this.safetyTipStatus, o.safetyTipStatus) 449 && Objects.equals(this.safeUrl, o.safeUrl); 450 } 451 452 /** Generates a Hash-Code for {@code 'this'} instance */ 453 public int hashCode() 454 { 455 return 456 Objects.hashCode(this.safetyTipStatus) 457 + Objects.hashCode(this.safeUrl); 458 } 459 } 460 461 /** 462 * Security state information about the page. 463 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 464 */ 465 public static class VisibleSecurityState 466 extends BaseType 467 implements java.io.Serializable 468 { 469 /** For Object Serialization. java.io.Serializable */ 470 protected static final long serialVersionUID = 1; 471 472 public boolean[] optionals() 473 { return new boolean[] { false, true, true, false, }; } 474 475 /** The security level of the page. */ 476 public final String securityState; 477 478 /** 479 * Security state details about the page certificate. 480 * <BR /><B CLASS=Opt>OPTIONAL</B> 481 */ 482 public final Security.CertificateSecurityState certificateSecurityState; 483 484 /** 485 * The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown. 486 * <BR /><B CLASS=Opt>OPTIONAL</B> 487 */ 488 public final Security.SafetyTipInfo safetyTipInfo; 489 490 /** Array of security state issues ids. */ 491 public final String[] securityStateIssueIds; 492 493 /** 494 * Constructor 495 * 496 * @param securityState The security level of the page. 497 * 498 * @param certificateSecurityState Security state details about the page certificate. 499 * <BR /><B CLASS=Opt>OPTIONAL</B> 500 * 501 * @param safetyTipInfo The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown. 502 * <BR /><B CLASS=Opt>OPTIONAL</B> 503 * 504 * @param securityStateIssueIds Array of security state issues ids. 505 */ 506 public VisibleSecurityState( 507 String securityState, Security.CertificateSecurityState certificateSecurityState, 508 Security.SafetyTipInfo safetyTipInfo, String[] securityStateIssueIds 509 ) 510 { 511 // Exception-Check(s) to ensure that if any parameters which are not declared as 512 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 513 514 if (securityState == null) THROWS.throwNPE("securityState"); 515 if (securityStateIssueIds == null) THROWS.throwNPE("securityStateIssueIds"); 516 517 // Exception-Check(s) to ensure that if any parameters which must adhere to a 518 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 519 520 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 521 522 this.securityState = securityState; 523 this.certificateSecurityState = certificateSecurityState; 524 this.safetyTipInfo = safetyTipInfo; 525 this.securityStateIssueIds = securityStateIssueIds; 526 } 527 528 /** 529 * JSON Object Constructor 530 * @param jo A Json-Object having data about an instance of {@code 'VisibleSecurityState'}. 531 */ 532 public VisibleSecurityState (JsonObject jo) 533 { 534 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 535 this.certificateSecurityState = ReadJSON.getObject(jo, "certificateSecurityState", Security.CertificateSecurityState.class, true, false); 536 this.safetyTipInfo = ReadJSON.getObject(jo, "safetyTipInfo", Security.SafetyTipInfo.class, true, false); 537 this.securityStateIssueIds = (jo.getJsonArray("securityStateIssueIds") == null) 538 ? null 539 : RJArrIntoStream.strArr(jo.getJsonArray("securityStateIssueIds"), null, 0).toArray(String[]::new); 540 541 } 542 543 544 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 545 public boolean equals(Object other) 546 { 547 if (this == other) return true; 548 if (other == null) return false; 549 if (other.getClass() != this.getClass()) return false; 550 551 VisibleSecurityState o = (VisibleSecurityState) other; 552 553 return 554 Objects.equals(this.securityState, o.securityState) 555 && Objects.equals(this.certificateSecurityState, o.certificateSecurityState) 556 && Objects.equals(this.safetyTipInfo, o.safetyTipInfo) 557 && Arrays.deepEquals(this.securityStateIssueIds, o.securityStateIssueIds); 558 } 559 560 /** Generates a Hash-Code for {@code 'this'} instance */ 561 public int hashCode() 562 { 563 return 564 Objects.hashCode(this.securityState) 565 + this.certificateSecurityState.hashCode() 566 + this.safetyTipInfo.hashCode() 567 + Arrays.deepHashCode(this.securityStateIssueIds); 568 } 569 } 570 571 /** An explanation of an factor contributing to the security state. */ 572 public static class SecurityStateExplanation 573 extends BaseType 574 implements java.io.Serializable 575 { 576 /** For Object Serialization. java.io.Serializable */ 577 protected static final long serialVersionUID = 1; 578 579 public boolean[] optionals() 580 { return new boolean[] { false, false, false, false, false, false, true, }; } 581 582 /** Security state representing the severity of the factor being explained. */ 583 public final String securityState; 584 585 /** Title describing the type of factor. */ 586 public final String title; 587 588 /** Short phrase describing the type of factor. */ 589 public final String summary; 590 591 /** Full text explanation of the factor. */ 592 public final String description; 593 594 /** The type of mixed content described by the explanation. */ 595 public final String mixedContentType; 596 597 /** Page certificate. */ 598 public final String[] certificate; 599 600 /** 601 * Recommendations to fix any issues. 602 * <BR /><B CLASS=Opt>OPTIONAL</B> 603 */ 604 public final String[] recommendations; 605 606 /** 607 * Constructor 608 * 609 * @param securityState Security state representing the severity of the factor being explained. 610 * 611 * @param title Title describing the type of factor. 612 * 613 * @param summary Short phrase describing the type of factor. 614 * 615 * @param description Full text explanation of the factor. 616 * 617 * @param mixedContentType The type of mixed content described by the explanation. 618 * 619 * @param certificate Page certificate. 620 * 621 * @param recommendations Recommendations to fix any issues. 622 * <BR /><B CLASS=Opt>OPTIONAL</B> 623 */ 624 public SecurityStateExplanation( 625 String securityState, String title, String summary, String description, 626 String mixedContentType, String[] certificate, String[] recommendations 627 ) 628 { 629 // Exception-Check(s) to ensure that if any parameters which are not declared as 630 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 631 632 if (securityState == null) THROWS.throwNPE("securityState"); 633 if (title == null) THROWS.throwNPE("title"); 634 if (summary == null) THROWS.throwNPE("summary"); 635 if (description == null) THROWS.throwNPE("description"); 636 if (mixedContentType == null) THROWS.throwNPE("mixedContentType"); 637 if (certificate == null) THROWS.throwNPE("certificate"); 638 639 // Exception-Check(s) to ensure that if any parameters which must adhere to a 640 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 641 642 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 643 THROWS.checkIAE("mixedContentType", mixedContentType, "Security.MixedContentType", Security.MixedContentType); 644 645 this.securityState = securityState; 646 this.title = title; 647 this.summary = summary; 648 this.description = description; 649 this.mixedContentType = mixedContentType; 650 this.certificate = certificate; 651 this.recommendations = recommendations; 652 } 653 654 /** 655 * JSON Object Constructor 656 * @param jo A Json-Object having data about an instance of {@code 'SecurityStateExplanation'}. 657 */ 658 public SecurityStateExplanation (JsonObject jo) 659 { 660 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 661 this.title = ReadJSON.getString(jo, "title", false, true); 662 this.summary = ReadJSON.getString(jo, "summary", false, true); 663 this.description = ReadJSON.getString(jo, "description", false, true); 664 this.mixedContentType = ReadJSON.getString(jo, "mixedContentType", false, true); 665 this.certificate = (jo.getJsonArray("certificate") == null) 666 ? null 667 : RJArrIntoStream.strArr(jo.getJsonArray("certificate"), null, 0).toArray(String[]::new); 668 669 this.recommendations = (jo.getJsonArray("recommendations") == null) 670 ? null 671 : RJArrIntoStream.strArr(jo.getJsonArray("recommendations"), null, 0).toArray(String[]::new); 672 673 } 674 675 676 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 677 public boolean equals(Object other) 678 { 679 if (this == other) return true; 680 if (other == null) return false; 681 if (other.getClass() != this.getClass()) return false; 682 683 SecurityStateExplanation o = (SecurityStateExplanation) other; 684 685 return 686 Objects.equals(this.securityState, o.securityState) 687 && Objects.equals(this.title, o.title) 688 && Objects.equals(this.summary, o.summary) 689 && Objects.equals(this.description, o.description) 690 && Objects.equals(this.mixedContentType, o.mixedContentType) 691 && Arrays.deepEquals(this.certificate, o.certificate) 692 && Arrays.deepEquals(this.recommendations, o.recommendations); 693 } 694 695 /** Generates a Hash-Code for {@code 'this'} instance */ 696 public int hashCode() 697 { 698 return 699 Objects.hashCode(this.securityState) 700 + Objects.hashCode(this.title) 701 + Objects.hashCode(this.summary) 702 + Objects.hashCode(this.description) 703 + Objects.hashCode(this.mixedContentType) 704 + Arrays.deepHashCode(this.certificate) 705 + Arrays.deepHashCode(this.recommendations); 706 } 707 } 708 709 /** 710 * Information about insecure content on the page. 711 * <BR /><B CLASS=Dep>DEPRECATED</B> 712 */ 713 public static class InsecureContentStatus 714 extends BaseType 715 implements java.io.Serializable 716 { 717 /** For Object Serialization. java.io.Serializable */ 718 protected static final long serialVersionUID = 1; 719 720 public boolean[] optionals() 721 { return new boolean[] { false, false, false, false, false, false, false, }; } 722 723 /** Always false. */ 724 public final boolean ranMixedContent; 725 726 /** Always false. */ 727 public final boolean displayedMixedContent; 728 729 /** Always false. */ 730 public final boolean containedMixedForm; 731 732 /** Always false. */ 733 public final boolean ranContentWithCertErrors; 734 735 /** Always false. */ 736 public final boolean displayedContentWithCertErrors; 737 738 /** Always set to unknown. */ 739 public final String ranInsecureContentStyle; 740 741 /** Always set to unknown. */ 742 public final String displayedInsecureContentStyle; 743 744 /** 745 * Constructor 746 * 747 * @param ranMixedContent Always false. 748 * 749 * @param displayedMixedContent Always false. 750 * 751 * @param containedMixedForm Always false. 752 * 753 * @param ranContentWithCertErrors Always false. 754 * 755 * @param displayedContentWithCertErrors Always false. 756 * 757 * @param ranInsecureContentStyle Always set to unknown. 758 * 759 * @param displayedInsecureContentStyle Always set to unknown. 760 */ 761 public InsecureContentStatus( 762 boolean ranMixedContent, boolean displayedMixedContent, boolean containedMixedForm, 763 boolean ranContentWithCertErrors, boolean displayedContentWithCertErrors, 764 String ranInsecureContentStyle, String displayedInsecureContentStyle 765 ) 766 { 767 // Exception-Check(s) to ensure that if any parameters which are not declared as 768 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 769 770 if (ranInsecureContentStyle == null) THROWS.throwNPE("ranInsecureContentStyle"); 771 if (displayedInsecureContentStyle == null) THROWS.throwNPE("displayedInsecureContentStyle"); 772 773 // Exception-Check(s) to ensure that if any parameters which must adhere to a 774 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 775 776 THROWS.checkIAE("ranInsecureContentStyle", ranInsecureContentStyle, "Security.SecurityState", Security.SecurityState); 777 THROWS.checkIAE("displayedInsecureContentStyle", displayedInsecureContentStyle, "Security.SecurityState", Security.SecurityState); 778 779 this.ranMixedContent = ranMixedContent; 780 this.displayedMixedContent = displayedMixedContent; 781 this.containedMixedForm = containedMixedForm; 782 this.ranContentWithCertErrors = ranContentWithCertErrors; 783 this.displayedContentWithCertErrors = displayedContentWithCertErrors; 784 this.ranInsecureContentStyle = ranInsecureContentStyle; 785 this.displayedInsecureContentStyle = displayedInsecureContentStyle; 786 } 787 788 /** 789 * JSON Object Constructor 790 * @param jo A Json-Object having data about an instance of {@code 'InsecureContentStatus'}. 791 */ 792 public InsecureContentStatus (JsonObject jo) 793 { 794 this.ranMixedContent = ReadPrimJSON.getBoolean(jo, "ranMixedContent"); 795 this.displayedMixedContent = ReadPrimJSON.getBoolean(jo, "displayedMixedContent"); 796 this.containedMixedForm = ReadPrimJSON.getBoolean(jo, "containedMixedForm"); 797 this.ranContentWithCertErrors = ReadPrimJSON.getBoolean(jo, "ranContentWithCertErrors"); 798 this.displayedContentWithCertErrors = ReadPrimJSON.getBoolean(jo, "displayedContentWithCertErrors"); 799 this.ranInsecureContentStyle = ReadJSON.getString(jo, "ranInsecureContentStyle", false, true); 800 this.displayedInsecureContentStyle = ReadJSON.getString(jo, "displayedInsecureContentStyle", false, true); 801 } 802 803 804 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 805 public boolean equals(Object other) 806 { 807 if (this == other) return true; 808 if (other == null) return false; 809 if (other.getClass() != this.getClass()) return false; 810 811 InsecureContentStatus o = (InsecureContentStatus) other; 812 813 return 814 (this.ranMixedContent == o.ranMixedContent) 815 && (this.displayedMixedContent == o.displayedMixedContent) 816 && (this.containedMixedForm == o.containedMixedForm) 817 && (this.ranContentWithCertErrors == o.ranContentWithCertErrors) 818 && (this.displayedContentWithCertErrors == o.displayedContentWithCertErrors) 819 && Objects.equals(this.ranInsecureContentStyle, o.ranInsecureContentStyle) 820 && Objects.equals(this.displayedInsecureContentStyle, o.displayedInsecureContentStyle); 821 } 822 823 /** Generates a Hash-Code for {@code 'this'} instance */ 824 public int hashCode() 825 { 826 return 827 (this.ranMixedContent ? 1 : 0) 828 + (this.displayedMixedContent ? 1 : 0) 829 + (this.containedMixedForm ? 1 : 0) 830 + (this.ranContentWithCertErrors ? 1 : 0) 831 + (this.displayedContentWithCertErrors ? 1 : 0) 832 + Objects.hashCode(this.ranInsecureContentStyle) 833 + Objects.hashCode(this.displayedInsecureContentStyle); 834 } 835 } 836 837 /** 838 * There is a certificate error. If overriding certificate errors is enabled, then it should be 839 * handled with the {@code handleCertificateError} command. Note: this event does not fire if the 840 * certificate error has been allowed internally. Only one client per target should override 841 * certificate errors at the same time. 842 * <BR /><B CLASS=Dep>DEPRECATED</B> 843 */ 844 public static class certificateError 845 extends BrowserEvent 846 implements java.io.Serializable 847 { 848 /** For Object Serialization. java.io.Serializable */ 849 protected static final long serialVersionUID = 1; 850 851 public boolean[] optionals() 852 { return new boolean[] { false, false, false, }; } 853 854 /** The ID of the event. */ 855 public final int eventId; 856 857 /** The type of the error. */ 858 public final String errorType; 859 860 /** The url that was requested. */ 861 public final String requestURL; 862 863 /** 864 * Constructor 865 * 866 * @param eventId The ID of the event. 867 * 868 * @param errorType The type of the error. 869 * 870 * @param requestURL The url that was requested. 871 */ 872 public certificateError(int eventId, String errorType, String requestURL) 873 { 874 super("Security", "certificateError", 3); 875 876 // Exception-Check(s) to ensure that if any parameters which are not declared as 877 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 878 879 if (errorType == null) THROWS.throwNPE("errorType"); 880 if (requestURL == null) THROWS.throwNPE("requestURL"); 881 882 this.eventId = eventId; 883 this.errorType = errorType; 884 this.requestURL = requestURL; 885 } 886 887 /** 888 * JSON Object Constructor 889 * @param jo A Json-Object having data about an instance of {@code 'certificateError'}. 890 */ 891 public certificateError (JsonObject jo) 892 { 893 super("Security", "certificateError", 3); 894 895 this.eventId = ReadPrimJSON.getInt(jo, "eventId"); 896 this.errorType = ReadJSON.getString(jo, "errorType", false, true); 897 this.requestURL = ReadJSON.getString(jo, "requestURL", false, true); 898 } 899 900 901 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 902 public boolean equals(Object other) 903 { 904 if (this == other) return true; 905 if (other == null) return false; 906 if (other.getClass() != this.getClass()) return false; 907 908 certificateError o = (certificateError) other; 909 910 return 911 (this.eventId == o.eventId) 912 && Objects.equals(this.errorType, o.errorType) 913 && Objects.equals(this.requestURL, o.requestURL); 914 } 915 916 /** Generates a Hash-Code for {@code 'this'} instance */ 917 public int hashCode() 918 { 919 return 920 this.eventId 921 + Objects.hashCode(this.errorType) 922 + Objects.hashCode(this.requestURL); 923 } 924 } 925 926 /** 927 * The security state of the page changed. 928 * <BR /><B CLASS=Exp>EXPERIMENTAL</B> 929 */ 930 public static class visibleSecurityStateChanged 931 extends BrowserEvent 932 implements java.io.Serializable 933 { 934 /** For Object Serialization. java.io.Serializable */ 935 protected static final long serialVersionUID = 1; 936 937 public boolean[] optionals() 938 { return new boolean[] { false, }; } 939 940 /** Security state information about the page. */ 941 public final Security.VisibleSecurityState visibleSecurityState; 942 943 /** 944 * Constructor 945 * 946 * @param visibleSecurityState Security state information about the page. 947 */ 948 public visibleSecurityStateChanged(Security.VisibleSecurityState visibleSecurityState) 949 { 950 super("Security", "visibleSecurityStateChanged", 1); 951 952 // Exception-Check(s) to ensure that if any parameters which are not declared as 953 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 954 955 if (visibleSecurityState == null) THROWS.throwNPE("visibleSecurityState"); 956 957 this.visibleSecurityState = visibleSecurityState; 958 } 959 960 /** 961 * JSON Object Constructor 962 * @param jo A Json-Object having data about an instance of {@code 'visibleSecurityStateChanged'}. 963 */ 964 public visibleSecurityStateChanged (JsonObject jo) 965 { 966 super("Security", "visibleSecurityStateChanged", 1); 967 968 this.visibleSecurityState = ReadJSON.getObject(jo, "visibleSecurityState", Security.VisibleSecurityState.class, false, true); 969 } 970 971 972 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 973 public boolean equals(Object other) 974 { 975 if (this == other) return true; 976 if (other == null) return false; 977 if (other.getClass() != this.getClass()) return false; 978 979 visibleSecurityStateChanged o = (visibleSecurityStateChanged) other; 980 981 return 982 Objects.equals(this.visibleSecurityState, o.visibleSecurityState); 983 } 984 985 /** Generates a Hash-Code for {@code 'this'} instance */ 986 public int hashCode() 987 { 988 return 989 this.visibleSecurityState.hashCode(); 990 } 991 } 992 993 /** 994 * The security state of the page changed. No longer being sent. 995 * <BR /><B CLASS=Dep>DEPRECATED</B> 996 */ 997 public static class securityStateChanged 998 extends BrowserEvent 999 implements java.io.Serializable 1000 { 1001 /** For Object Serialization. java.io.Serializable */ 1002 protected static final long serialVersionUID = 1; 1003 1004 public boolean[] optionals() 1005 { return new boolean[] { false, false, false, false, true, }; } 1006 1007 /** Security state. */ 1008 public final String securityState; 1009 1010 /** 1011 * True if the page was loaded over cryptographic transport such as HTTPS. 1012 * <BR /><B CLASS=Dep>DEPRECATED</B> 1013 */ 1014 public final boolean schemeIsCryptographic; 1015 1016 /** 1017 * Previously a list of explanations for the security state. Now always 1018 * empty. 1019 * <BR /><B CLASS=Dep>DEPRECATED</B> 1020 */ 1021 public final Security.SecurityStateExplanation[] explanations; 1022 1023 /** 1024 * Information about insecure content on the page. 1025 * <BR /><B CLASS=Dep>DEPRECATED</B> 1026 */ 1027 public final Security.InsecureContentStatus insecureContentStatus; 1028 1029 /** 1030 * Overrides user-visible description of the state. Always omitted. 1031 * <BR /><B CLASS=Opt>OPTIONAL</B> 1032 <B CLASS=Dep>DEPRECATED</B> 1033 */ 1034 public final String summary; 1035 1036 /** 1037 * Constructor 1038 * 1039 * @param securityState Security state. 1040 * 1041 * @param schemeIsCryptographic True if the page was loaded over cryptographic transport such as HTTPS. 1042 * <BR /><B CLASS=Dep>DEPRECATED</B> 1043 * 1044 * @param explanations 1045 * Previously a list of explanations for the security state. Now always 1046 * empty. 1047 * <BR /><B CLASS=Dep>DEPRECATED</B> 1048 * 1049 * @param insecureContentStatus Information about insecure content on the page. 1050 * <BR /><B CLASS=Dep>DEPRECATED</B> 1051 * 1052 * @param summary Overrides user-visible description of the state. Always omitted. 1053 * <BR /><B CLASS=Opt>OPTIONAL</B><B CLASS=Dep>DEPRECATED</B> 1054 */ 1055 public securityStateChanged( 1056 String securityState, boolean schemeIsCryptographic, 1057 Security.SecurityStateExplanation[] explanations, 1058 Security.InsecureContentStatus insecureContentStatus, String summary 1059 ) 1060 { 1061 super("Security", "securityStateChanged", 5); 1062 1063 // Exception-Check(s) to ensure that if any parameters which are not declared as 1064 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1065 1066 if (securityState == null) THROWS.throwNPE("securityState"); 1067 if (explanations == null) THROWS.throwNPE("explanations"); 1068 if (insecureContentStatus == null) THROWS.throwNPE("insecureContentStatus"); 1069 1070 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1071 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1072 1073 THROWS.checkIAE("securityState", securityState, "Security.SecurityState", Security.SecurityState); 1074 1075 this.securityState = securityState; 1076 this.schemeIsCryptographic = schemeIsCryptographic; 1077 this.explanations = explanations; 1078 this.insecureContentStatus = insecureContentStatus; 1079 this.summary = summary; 1080 } 1081 1082 /** 1083 * JSON Object Constructor 1084 * @param jo A Json-Object having data about an instance of {@code 'securityStateChanged'}. 1085 */ 1086 public securityStateChanged (JsonObject jo) 1087 { 1088 super("Security", "securityStateChanged", 5); 1089 1090 this.securityState = ReadJSON.getString(jo, "securityState", false, true); 1091 this.schemeIsCryptographic = ReadPrimJSON.getBoolean(jo, "schemeIsCryptographic"); 1092 this.explanations = (jo.getJsonArray("explanations") == null) 1093 ? null 1094 : RJArrIntoStream.objArr(jo.getJsonArray("explanations"), null, 0, Security.SecurityStateExplanation.class).toArray(Security.SecurityStateExplanation[]::new); 1095 1096 this.insecureContentStatus = ReadJSON.getObject(jo, "insecureContentStatus", Security.InsecureContentStatus.class, false, true); 1097 this.summary = ReadJSON.getString(jo, "summary", true, false); 1098 } 1099 1100 1101 /** Checks whether {@code 'this'} equals an input Java-{@code Object} */ 1102 public boolean equals(Object other) 1103 { 1104 if (this == other) return true; 1105 if (other == null) return false; 1106 if (other.getClass() != this.getClass()) return false; 1107 1108 securityStateChanged o = (securityStateChanged) other; 1109 1110 return 1111 Objects.equals(this.securityState, o.securityState) 1112 && (this.schemeIsCryptographic == o.schemeIsCryptographic) 1113 && Arrays.deepEquals(this.explanations, o.explanations) 1114 && Objects.equals(this.insecureContentStatus, o.insecureContentStatus) 1115 && Objects.equals(this.summary, o.summary); 1116 } 1117 1118 /** Generates a Hash-Code for {@code 'this'} instance */ 1119 public int hashCode() 1120 { 1121 return 1122 Objects.hashCode(this.securityState) 1123 + (this.schemeIsCryptographic ? 1 : 0) 1124 + Arrays.deepHashCode(this.explanations) 1125 + this.insecureContentStatus.hashCode() 1126 + Objects.hashCode(this.summary); 1127 } 1128 } 1129 1130 1131 // Counter for keeping the WebSocket Request ID's distinct. 1132 private static int counter = 1; 1133 1134 /** 1135 * Disables tracking security state changes. 1136 * 1137 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1138 * {@link Ret0}></CODE> 1139 * 1140 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1141 * browser receives the invocation-request. 1142 * 1143 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1144 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1145 * {@code >} to ensure the Browser Function has run to completion. 1146 */ 1147 public static Script<String, JsonObject, Ret0> disable() 1148 { 1149 final int webSocketID = 38000000 + counter++; 1150 final boolean[] optionals = new boolean[0]; 1151 1152 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1153 String requestJSON = WriteJSON.get( 1154 parameterTypes.get("disable"), 1155 parameterNames.get("disable"), 1156 optionals, webSocketID, 1157 "Security.disable" 1158 ); 1159 1160 // This Remote Command does not have a Return-Value. 1161 return new Script<> 1162 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1163 } 1164 1165 /** 1166 * Enables tracking security state changes. 1167 * 1168 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1169 * {@link Ret0}></CODE> 1170 * 1171 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1172 * browser receives the invocation-request. 1173 * 1174 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1175 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1176 * {@code >} to ensure the Browser Function has run to completion. 1177 */ 1178 public static Script<String, JsonObject, Ret0> enable() 1179 { 1180 final int webSocketID = 38001000 + counter++; 1181 final boolean[] optionals = new boolean[0]; 1182 1183 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1184 String requestJSON = WriteJSON.get( 1185 parameterTypes.get("enable"), 1186 parameterNames.get("enable"), 1187 optionals, webSocketID, 1188 "Security.enable" 1189 ); 1190 1191 // This Remote Command does not have a Return-Value. 1192 return new Script<> 1193 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1194 } 1195 1196 /** 1197 * Enable/disable whether all certificate errors should be ignored. 1198 * 1199 * @param ignore If true, all certificate errors will be ignored. 1200 * 1201 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1202 * {@link Ret0}></CODE> 1203 * 1204 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1205 * browser receives the invocation-request. 1206 * 1207 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1208 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1209 * {@code >} to ensure the Browser Function has run to completion. 1210 */ 1211 public static Script<String, JsonObject, Ret0> setIgnoreCertificateErrors(boolean ignore) 1212 { 1213 final int webSocketID = 38002000 + counter++; 1214 final boolean[] optionals = { false, }; 1215 1216 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1217 String requestJSON = WriteJSON.get( 1218 parameterTypes.get("setIgnoreCertificateErrors"), 1219 parameterNames.get("setIgnoreCertificateErrors"), 1220 optionals, webSocketID, 1221 "Security.setIgnoreCertificateErrors", 1222 ignore 1223 ); 1224 1225 // This Remote Command does not have a Return-Value. 1226 return new Script<> 1227 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1228 } 1229 1230 /** 1231 * Handles a certificate error that fired a certificateError event. 1232 * <BR /><B CLASS=Dep-Top>DEPRECATED</B> 1233 * 1234 * @param eventId The ID of the event. 1235 * 1236 * @param action The action to take on the certificate error. 1237 * 1238 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1239 * {@link Ret0}></CODE> 1240 * 1241 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1242 * browser receives the invocation-request. 1243 * 1244 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1245 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1246 * {@code >} to ensure the Browser Function has run to completion. 1247 */ 1248 public static Script<String, JsonObject, Ret0> handleCertificateError 1249 (int eventId, String action) 1250 { 1251 // Exception-Check(s) to ensure that if any parameters which are not declared as 1252 // 'Optional', but have a 'null' value anyway, that a NullPointerException shall throw. 1253 1254 if (action == null) THROWS.throwNPE("action"); 1255 1256 // Exception-Check(s) to ensure that if any parameters which must adhere to a 1257 // provided List of Enumerated Values, fails, then IllegalArgumentException shall throw. 1258 1259 THROWS.checkIAE("action", action, "Security.CertificateErrorAction", Security.CertificateErrorAction); 1260 1261 final int webSocketID = 38003000 + counter++; 1262 final boolean[] optionals = { false, false, }; 1263 1264 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1265 String requestJSON = WriteJSON.get( 1266 parameterTypes.get("handleCertificateError"), 1267 parameterNames.get("handleCertificateError"), 1268 optionals, webSocketID, 1269 "Security.handleCertificateError", 1270 eventId, action 1271 ); 1272 1273 // This Remote Command does not have a Return-Value. 1274 return new Script<> 1275 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1276 } 1277 1278 /** 1279 * Enable/disable overriding certificate errors. If enabled, all certificate error events need to 1280 * be handled by the DevTools client and should be answered with {@code handleCertificateError} commands. 1281 * <BR /><B CLASS=Dep-Top>DEPRECATED</B> 1282 * 1283 * @param override If true, certificate errors will be overridden. 1284 * 1285 * @return An instance of <CODE>{@link Script}<String, {@link JsonObject}, 1286 * {@link Ret0}></CODE> 1287 * 1288 * <BR /><BR />This {@code Script} instance must be <B STYLE='color:red'>executed</B> before the 1289 * browser receives the invocation-request. 1290 * 1291 * <BR /><BR />This Browser-Function <I>does not have</I> a return-value. You may choose to 1292 * <B STYLE='color: red'>await</B> the {@link Promise}{@code <JsonObject,} {@link Ret0} 1293 * {@code >} to ensure the Browser Function has run to completion. 1294 */ 1295 public static Script<String, JsonObject, Ret0> setOverrideCertificateErrors 1296 (boolean override) 1297 { 1298 final int webSocketID = 38004000 + counter++; 1299 final boolean[] optionals = { false, }; 1300 1301 // Convert Method Parameters into JSON. Build the JSON Request-Object (as a String) 1302 String requestJSON = WriteJSON.get( 1303 parameterTypes.get("setOverrideCertificateErrors"), 1304 parameterNames.get("setOverrideCertificateErrors"), 1305 optionals, webSocketID, 1306 "Security.setOverrideCertificateErrors", 1307 override 1308 ); 1309 1310 // This Remote Command does not have a Return-Value. 1311 return new Script<> 1312 (webSocketID, requestJSON, VOID_RETURN.NoReturnValues); 1313 } 1314 1315}