Class Polyfill


  • public class Polyfill
    extends java.lang.Object
    Support to use polyfills for js features not implemented so far (idea from Colin Alworth).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<java.lang.String,​Polyfill> CACHE  
      private org.htmlunit.corejs.javascript.Script script_  
      private java.lang.String source_  
      private java.lang.String url_  
    • Constructor Summary

      Constructors 
      Constructor Description
      Polyfill()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void apply​(org.htmlunit.corejs.javascript.Context context, org.htmlunit.corejs.javascript.Scriptable scriptable)
      Compile the script if needed and exec to setup the context.
      static Polyfill getFetchPolyfill()  
      private static Polyfill getPolyfill​(java.lang.String resouceName)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CACHE

        private static final java.util.Map<java.lang.String,​Polyfill> CACHE
      • url_

        private java.lang.String url_
      • source_

        private java.lang.String source_
      • script_

        private org.htmlunit.corejs.javascript.Script script_
    • Constructor Detail

      • Polyfill

        public Polyfill()
    • Method Detail

      • getFetchPolyfill

        public static Polyfill getFetchPolyfill()
                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • getPolyfill

        private static Polyfill getPolyfill​(java.lang.String resouceName)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • apply

        public void apply​(org.htmlunit.corejs.javascript.Context context,
                          org.htmlunit.corejs.javascript.Scriptable scriptable)
        Compile the script if needed and exec to setup the context.
        Parameters:
        context - the context
        scriptable - the scriptable