<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28737</bug_id>
          
          <creation_ts>2015-06-02 06:38:14 +0000</creation_ts>
          <short_desc>Request to extend importScripts(urls) for ServiceWorkerGlobalScope</short_desc>
          <delta_ts>2015-09-02 19:02:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jungkee Song">jungkees</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>bkelly</cc>
    
    <cc>d</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>120650</commentid>
    <comment_count>0</comment_count>
    <who name="Jungkee Song">jungkees</who>
    <bug_when>2015-06-02 06:38:14 +0000</bug_when>
    <thetext>Currently service worker monkey patches the importScript(urls) method for its own environment: https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#importscripts

Incorporating this requirement in HTML would be more accurate. Could you address this?

Here&apos;s the related discussion: https://github.com/slightlyoff/ServiceWorker/issues/106#issuecomment-51204543</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122846</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-08-28 11:37:06 +0000</bug_when>
    <thetext>Would it not be easier for service workers to define its own method? Domenic&apos;s preference is that if they have a distinct implementation they should just be their own methods.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122850</commentid>
    <comment_count>2</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-08-28 12:49:05 +0000</bug_when>
    <thetext>This is kind of tricky though because either the SW importScripts will need to be defined as &quot;like HTML&apos;s importScripts, but insert these steps at these positions&quot; or SW will need to copy all the steps from HTML. The former seems fragile to any bugfixes in importScripts, and the latter will get out of date.

What do you think of extracting HTML&apos;s importScripts definition into a &quot;import scripts in to worker scope&quot; algorithm, which has hooks that can be overridden? The hooks I see needed are:

- A validation step, after step 1. In HTML this does nothing.
- A generic fetching step, replacing step 5. In HTML this does what step 5 currently does.
- A postprocessing step, between steps 6.1 and 6.2. In HTML this does nothing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122914</commentid>
    <comment_count>3</comment_count>
    <who name="Jungkee Song">jungkees</who>
    <bug_when>2015-08-31 09:22:35 +0000</bug_when>
    <thetext>I think incorporating the changes directly in HTML would be even better. Is there a reason that&apos;s not preferable? If so, I can do what Domenic suggested.

FYI. I&apos;d want to make another PR for appcache too: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27482.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122916</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-08-31 09:43:30 +0000</bug_when>
    <thetext>What Domenic suggests seems good. To be clear, PRs need to be against https://github.com/whatwg/html. Thank you!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123051</commentid>
    <comment_count>5</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2015-09-02 19:02:20 +0000</bug_when>
    <thetext>https://github.com/whatwg/html/commit/509578d97bd12374e50a409bd4f1ec63cd36a543</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>